Skip to content

Commit a149b7d

Browse files
committed
tidy up new schema annotations for charts
1 parent 651d4de commit a149b7d

File tree

11 files changed

+106
-17432
lines changed

11 files changed

+106
-17432
lines changed

.github/workflows/_helm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
uses: actions/upload-artifact@v4
5757
with:
5858
name: helm-chart-schemas
59-
path: schemas/
59+
path: schemas/*.schema.json
6060

6161
- name: Push tagged helm chart to registry
6262
# TODO - switch to using https://github.com/helm/chart-releaser-action of maybe the docker action?

.pre-commit-config.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,20 @@ repos:
2828
rev: v2.2.1
2929
hooks:
3030
- id: helm-schema
31-
args: ["--values", "Charts/fastcs/values.yaml", "--no-additional-properties", "-o", "Charts/fastcs/values.schema.json"]
31+
args:
32+
- --values
33+
- Charts/fastcs/values.yaml
34+
- --no-additional-properties
35+
- -o
36+
- Charts/fastcs/values.schema.json
3237

3338
- repo: https://github.com/losisin/helm-values-schema-json
3439
rev: v2.2.1
3540
hooks:
3641
- id: helm-schema
37-
args: ["--values", "Charts/fastcs-service/values.yaml", "--bundle", "--no-additional-properties", "-o", "Charts/fastcs-service/values.schema.json"]
42+
args:
43+
- --values
44+
- schemas/fastcs-service-values.yaml
45+
- --no-additional-properties
46+
- -o
47+
- schemas/fastcs-service.schema.json

Charts/fastcs-service/Chart.yaml

Lines changed: 0 additions & 8 deletions
This file was deleted.

Charts/fastcs-service/values.schema.json

Lines changed: 0 additions & 17381 deletions
This file was deleted.

Charts/fastcs-service/values.yaml

Lines changed: 0 additions & 9 deletions
This file was deleted.

Charts/fastcs/values.schema.json

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,51 @@
88
"additionalProperties": false
99
},
1010
"args": {
11+
"description": "command args to pass to the production container",
1112
"type": "array"
1213
},
1314
"autostart": {
15+
"description": "editable and autostart are used for debugging and development in-cluster",
1416
"type": "boolean"
1517
},
1618
"baseIp": {
19+
"description": "CIDR for services addresses.",
1720
"type": "string",
1821
"pattern": "^(\\d{1,3}\\.){3}\\d{1,3}\\/\\d{1,2}$"
1922
},
2023
"ca_server_port": {
24+
"description": "service port for Channel Access",
2125
"type": "integer"
2226
},
2327
"clusterIP": {
28+
"description": "Override for the cluster IP - only needed if allocateIpFromName clashes",
2429
"type": "null",
2530
"pattern": "^(\\d{1,3}\\.){3}\\d{1,3}$"
2631
},
2732
"command": {
33+
"description": "command to run for the production container",
2834
"type": "array"
2935
},
3036
"debugCommand": {
37+
"description": "command to run for the debugging (non- autostart) container",
3138
"type": "array",
3239
"items": {
3340
"type": "string"
3441
}
3542
},
3643
"editable": {
44+
"description": "editable and autostart are used for debugging and development in-cluster",
3745
"type": "boolean"
3846
},
3947
"extraContainers": {
4048
"type": "array"
4149
},
4250
"hostNetwork": {
51+
"description": "enable host networking for the pod",
4352
"type": "boolean"
4453
},
4554
"image": {
55+
"description": "container image URI",
4656
"type": "object",
4757
"properties": {
4858
"pullPolicy": {
@@ -58,12 +68,14 @@
5868
"additionalProperties": false
5969
},
6070
"initCommand": {
71+
"description": "command to run in the init container for editable mode",
6172
"type": "array",
6273
"items": {
6374
"type": "string"
6475
}
6576
},
6677
"iocConfig": {
78+
"description": "path to the location of config folder (defaults to be the same as C++ IOCs)",
6779
"type": "string"
6880
},
6981
"livenessProbe": {
@@ -79,10 +91,12 @@
7991
"additionalProperties": false
8092
},
8193
"podAnnotations": {
94+
"description": "Add annotations to the pod",
8295
"type": "object",
8396
"additionalProperties": false
8497
},
8598
"podLabels": {
99+
"description": "Add labels to the pod",
86100
"type": "object",
87101
"additionalProperties": false
88102
},
@@ -92,6 +106,7 @@
92106
"additionalProperties": false
93107
},
94108
"pva_server_port": {
109+
"description": "service port for PV Access",
95110
"type": "integer"
96111
},
97112
"readinessProbe": {
@@ -110,6 +125,7 @@
110125
"additionalProperties": false
111126
},
112127
"service": {
128+
"description": "The service will be configured for Channel Access and PVA.",
113129
"type": "object",
114130
"properties": {
115131
"ca_port": {
@@ -128,7 +144,7 @@
128144
"$ref": "https://kubernetesjsonschema.dev/v1.18.1/_definitions.json#/definitions/io.k8s.api.core.v1.Toleration",
129145
"type": "array"
130146
},
131-
"volumeMount": {
147+
"volumeMounts": {
132148
"$ref": "https://kubernetesjsonschema.dev/v1.18.1/_definitions.json#/definitions/io.k8s.api.core.v1.VolumeMount",
133149
"type": "array"
134150
},

Charts/fastcs/values.yaml

Lines changed: 42 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,25 @@
44
# With annotations for building the schema using:
55
# https://github.com/losisin/helm-values-schema-json.git
66

7-
# container image URI
7+
# @schema description: container image URI
88
image:
99
repository: ""
1010
pullPolicy: IfNotPresent
1111
tag: ""
1212

13-
# command to run for the production container
13+
# @schema description: command to run for the production container
1414
command: []
1515

16-
# command args to pass to the production container
16+
# @schema description: command args to pass to the production container
1717
args: []
1818

19-
# command to run for the debugging (non- autostart) container
19+
# @schema description: command to run for the debugging (non- autostart) container
2020
debugCommand:
2121
- /bin/bash
2222
- -c
2323
- "sleep infinity"
2424

25-
# command to run in the init container for editable mode
25+
# @schema description: command to run in the init container for editable mode
2626
initCommand:
2727
- /bin/bash
2828
- -c
@@ -40,37 +40,38 @@ initCommand:
4040
fi
4141
echo "Init container completed successfully"
4242
43-
# enable host networking for the pod
43+
# @schema description: enable host networking for the pod
4444
hostNetwork: true
4545

46-
# editable and autostart are used for debugging and development in-cluster.
47-
# editable:
48-
# creates a PVC with /venv and /workspaces mounted into the container
49-
# runs an init container with entrypoint initCommand above
46+
# @schema description: editable and autostart are used for debugging and development in-cluster
47+
# editable:
48+
# creates a PVC with /venv and /workspaces mounted into the container
49+
# runs an init container with entrypoint initCommand above
50+
editable: false
51+
# @schema description: editable and autostart are used for debugging and development in-cluster
5052
# autostart:
5153
# false: entrypoint is debugCommand above
5254
# true: entrypoint is command above
53-
editable: false
5455
autostart: true
5556

56-
# path to the location of config folder (defaults to be the same as C++ IOCs)
57+
# @schema description: path to the location of config folder (defaults to be the same as C++ IOCs)
5758
iocConfig: /epics/ioc/config
5859

59-
# service port for Channel Access
60+
# @schema description: service port for Channel Access
6061
ca_server_port: 5064
61-
# service port for PV Access
62+
# @schema description: service port for PV Access
6263
pva_server_port: 5075
6364

64-
# CIDR for services addresses.
65+
# @schema description: CIDR for services addresses.
6566
# Used by allocateIpFromName to allocate a fixed cluster IP for the service.
6667
# The default is the same for all DLS clusters.
6768
baseIp: 10.96.0.0/12 # @schema pattern:^(\d{1,3}\.){3}\d{1,3}\/\d{1,2}$
6869

69-
# Override for the cluster IP - only needed if allocateIpFromName clashes
70+
# @schema description: Override for the cluster IP - only needed if allocateIpFromName clashes
7071
clusterIP: # @schema pattern:^(\d{1,3}\.){3}\d{1,3}$
7172

72-
# The service will be configured for Channel Access and PVA. Here you can override
73-
# the ports and also make this a LoadBalancer service if required.
73+
# @schema description: The service will be configured for Channel Access and PVA.
74+
# Here you can override the ports or make this a LoadBalancer service if required.
7475
service:
7576
type: ClusterIP
7677
ca_port: 5064
@@ -99,28 +100,40 @@ service:
99100
# @schema
100101
extraContainers: []
101102

103+
# @schema description: Add annotations to the pod
102104
podAnnotations: {}
103105

106+
# @schema description: Add labels to the pod
104107
podLabels: {}
105108

106-
podSecurityContext: {} # @schema $ref: https://kubernetesjsonschema.dev/v1.18.1/_definitions.json#/definitions/io.k8s.api.core.v1.SecurityContext
109+
# @schema $ref: https://kubernetesjsonschema.dev/v1.18.1/_definitions.json#/definitions/io.k8s.api.core.v1.SecurityContext
110+
podSecurityContext: {}
107111

108-
securityContext: {} # @schema $ref: https://kubernetesjsonschema.dev/v1.18.1/_definitions.json#/definitions/io.k8s.api.core.v1.SecurityContext
112+
# @schema $ref: https://kubernetesjsonschema.dev/v1.18.1/_definitions.json#/definitions/io.k8s.api.core.v1.SecurityContext
113+
securityContext: {}
109114

110-
resources: {} # @schema $ref: https://kubernetesjsonschema.dev/v1.18.1/_definitions.json#/definitions/io.k8s.api.core.v1.ResourceRequirements
115+
# @schema $ref: https://kubernetesjsonschema.dev/v1.18.1/_definitions.json#/definitions/io.k8s.api.core.v1.ResourceRequirements
116+
resources: {}
111117

112-
livenessProbe: {} # @schema $ref: https://kubernetesjsonschema.dev/v1.18.1/_definitions.json#/definitions/io.k8s.api.core.v1.Probe
118+
# @schema $ref: https://kubernetesjsonschema.dev/v1.18.1/_definitions.json#/definitions/io.k8s.api.core.v1.Probe
119+
livenessProbe: {}
113120

114-
readinessProbe: {} # @schema $ref: https://kubernetesjsonschema.dev/v1.18.1/_definitions.json#/definitions/io.k8s.api.core.v1.Probe
121+
# @schema $ref: https://kubernetesjsonschema.dev/v1.18.1/_definitions.json#/definitions/io.k8s.api.core.v1.Probe
122+
readinessProbe: {}
115123

116-
volumes: [] # @schema $ref: https://kubernetesjsonschema.dev/v1.18.1/_definitions.json#/definitions/io.k8s.api.core.v1.Volume
124+
# @schema $ref: https://kubernetesjsonschema.dev/v1.18.1/_definitions.json#/definitions/io.k8s.api.core.v1.Volume
125+
volumes: []
117126

118-
volumeMount: [] # @schema $ref: https://kubernetesjsonschema.dev/v1.18.1/_definitions.json#/definitions/io.k8s.api.core.v1.VolumeMount
127+
# @schema $ref: https://kubernetesjsonschema.dev/v1.18.1/_definitions.json#/definitions/io.k8s.api.core.v1.VolumeMount
128+
volumeMounts: []
119129

120-
# TODO I cant find a way to allow null for nodeSelector but also pass
130+
# TODO I cant find a way to allow null for nodeSelector but also pass the ref for the object
121131
# $ref: https://kubernetesjsonschema.dev/v1.18.1/_definitions.json#/definitions/io.k8s.api.core.v1.NodeSelector
122-
nodeSelector: {} # @schema type:[object, null]
132+
# @schema type:[object, null]
133+
nodeSelector: {}
123134

124-
tolerations: [] # @schema $ref: https://kubernetesjsonschema.dev/v1.18.1/_definitions.json#/definitions/io.k8s.api.core.v1.Toleration
135+
# @schema $ref: https://kubernetesjsonschema.dev/v1.18.1/_definitions.json#/definitions/io.k8s.api.core.v1.Toleration
136+
tolerations: []
125137

126-
affinity: {} # @schema $ref: https://kubernetesjsonschema.dev/v1.18.1/_definitions.json#/definitions/io.k8s.api.core.v1.Affinity
138+
# @schema $ref: https://kubernetesjsonschema.dev/v1.18.1/_definitions.json#/definitions/io.k8s.api.core.v1.Affinity
139+
affinity: {}

schemas/fastcs-ioc.schema.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

schemas/fastcs-service-values.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# yaml-language-server: $schema=fastcs-service.schema.json
2+
3+
# This yaml file represents the values used in services projects where
4+
# fastcs is a subchart.
5+
#
6+
# It is used to generate the schema for fastcs-service.schema.json
7+
# which is used to validate the values.yaml files in services projects.
8+
9+
# fast cs schema appears under the subchart fastcs
10+
# @schema $ref: fastcs-values.schema.json
11+
fastcs: {}
12+
13+
# Because fastcs and ioc-instance will share the same global values file
14+
# we must also allow ioc-instance to be defined here but do not use it in
15+
# fastcs itself.
16+
#
17+
# @schema required:false;additionalProperties:true
18+
ioc-instance: {}

schemas/fastcs-service.schema.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"type": "object",
4+
"properties": {
5+
"fastcs": {
6+
"$ref": "fastcs-values.schema.json",
7+
"type": "object",
8+
"additionalProperties": false
9+
},
10+
"ioc-instance": {
11+
"type": "object",
12+
"additionalProperties": true
13+
}
14+
},
15+
"additionalProperties": false
16+
}

0 commit comments

Comments
 (0)