From a66f7452c50bfa248aa81e48e6c1fa5e4b931dc4 Mon Sep 17 00:00:00 2001 From: Marcell Nagy Date: Mon, 3 Jun 2024 15:12:10 +0100 Subject: [PATCH] Make a demo with handcrafted schemas Nest schema Merge into single schema Detail out schema Fix some parameters Add schema release action --- .github/workflows/schema_release.yml | 20 +++ Charts/ioc-instance/values.yaml | 2 + Schemas/ioc-instance.json | 195 +++++++++++++++++++++++++++ 3 files changed, 217 insertions(+) create mode 100644 .github/workflows/schema_release.yml create mode 100644 Schemas/ioc-instance.json diff --git a/.github/workflows/schema_release.yml b/.github/workflows/schema_release.yml new file mode 100644 index 0000000..8e496e4 --- /dev/null +++ b/.github/workflows/schema_release.yml @@ -0,0 +1,20 @@ +name: Publish schemas + +on: + push + +jobs: + release: + # Release on tag push - publish schema + if: ${{ github.ref_type == 'tag' }} + runs-on: ubuntu-latest + + steps: + - name: Check out repository code + uses: actions/checkout@v4 + - name: Github Release + uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15 + with: + files: | + Schemas/*.schema.json + generate_release_notes: true \ No newline at end of file diff --git a/Charts/ioc-instance/values.yaml b/Charts/ioc-instance/values.yaml index 3e0b643..ff5bf04 100644 --- a/Charts/ioc-instance/values.yaml +++ b/Charts/ioc-instance/values.yaml @@ -1,3 +1,5 @@ +# yaml-language-server: $schema=../../Schemas/ioc-instance.json#/$defs/base + # default values for all IOCs # see end of file for values that may be overridden per individual IOC diff --git a/Schemas/ioc-instance.json b/Schemas/ioc-instance.json new file mode 100644 index 0000000..acb9bb2 --- /dev/null +++ b/Schemas/ioc-instance.json @@ -0,0 +1,195 @@ +{ + "$defs":{ + "base": { + "type": "object", + "properties": { + "beamline": { + "type": "string", + "description": "The beamline name." + }, + "location": { + "type": "string", + "description": "The location where the IOCs will run - same as beamline for beamlines" + }, + "ioc_group": { + "type": "string", + "description": "The name of the repository in which the IOC is grouped - same as beamline for beamlines" + }, + "hostNetwork": { + "type": "boolean", + "description": "Use host network for IOC - required for Channel Access to work outside of the cluster" + }, + "useAffinity": { + "type": "boolean", + "description": "Run only on nodes with label beamline: or location:" + }, + "iocFolder": { + "type": "string", + "description": "Root folder for ioc source/binaries inside generic IOC container", + "default": "/epics/ioc" + }, + "iocConfig": { + "type": "string", + "description": "Root folder for ioc source/binaries inside generic IOC container", + "default": "/epics/ioc/config" + }, + "startCommand": { + "type": "string", + "description": "The command run as the entry point of the container.", + "default": "bash" + }, + "startArgs": { + "type": "string", + "description": "The arguments for the entry point of the container.", + "default": "/epics/ioc/start.sh" + }, + "stop": { + "type": "string", + "description": "Script run before stopping the IOC", + "default": "/epics/ioc/stop.sh" + }, + "liveness": { + "type": "string", + "description": "Script for determining the liveness of the IOC", + "default": "/epics/ioc/liveness.sh" + }, + "globalEnv": { + "type": "string", + "description": "" + }, + "securityContext": { + "type": "object", + "description": "Override runAsXXX in the individual IOC values.yaml", + "properties": { + "allowPrivilegeEscalation": { + "type": "boolean", + "description": "", + "default": "false" + }, + "runAsUser": { + "type": "integer" + }, + "runAsGroup": { + "type": "integer" + }, + "capabilities": { + "type": "object" + }, + "readOnlyRootFilesystem": { + "type": "string" + }, + "runAsNonRoot": { + "type": "string" + } + } + }, + "image": { + "type": "string", + "description": "" + }, + "dataVolume": { + "type": "object", + "description": "A volume to mount for writing data to. This can be a PVC or a hostPath", + "properties": { + "pvc": { + "type": "boolean", + "description": "Create a PVC called {{ .Release.Name }}-data when true", + "default": "true" + }, + "hostPath": { + "type": "string", + "description": "A path on the host machine to write data into. Also used as the path that the pvc or hostPath will be mounted at so that users need not be confused about inside/outside container paths", + "default": "/data" + } + } + }, + "opisClaim": { + "type": "string", + "description": "Use the shared PVC for publishing opi files over http (see services/opis)" + }, + "runtimeClaim": { + "type": "string", + "description": "Use the shared PVC for holding runtime files for each IOC" + }, + "autosaveClaim": { + "type": "string", + "description": "Use the shared PVC autosave files (exclude for no autosave)" + }, + "resources": { + "type": "object", + "description": "Set resource limits", + "properties": { + "limits": { + "type": "object", + "properties":{ + "cpu": { + "type": "string", + "default": "500m" + }, + "memory": { + "type": "string", + "default": "256Mi" + } + } + }, + "requests": { + "type": "object", + "properties":{ + "cpu": { + "type": "string", + "default": "100m" + }, + "memory": { + "type": "string", + "default": "64Mi" + } + } + } + } + }, + "tolerations": { + "type": "object", + "description": "Extra tolerations if needed" + } + }, + "additionalProperties": false + }, + "repo":{ + "type": "object", + "properties": { + "ioc-instance": { + "$ref": "#/$defs/base", + "required": [ + "autosaveClaim", + "beamline", + "dataVolume", + "globalEnv", + "hostNetwork", + "useAffinity", + "ioc_group", + "location", + "opisClaim", + "runtimeClaim", + "securityContext" + ] + } + } + }, + "service":{ + "type": "object", + "properties": { + "shared": { + "type": "object", + "properties": { + "ioc-instance": { + "$ref": "#/$defs/base", + "required": [ + "image" + ] + } + } + } + } + } + } +} \ No newline at end of file