Skip to content

Commit 1752a8c

Browse files
committed
genericize chart, removing references to EPICS, IOC and epics-containers
1 parent f4b0a48 commit 1752a8c

File tree

4 files changed

+77
-55
lines changed

4 files changed

+77
-55
lines changed

Charts/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ These features will be accessed via `ec`. See https://github.com/epics-container
5959

6060
This script will:
6161

62-
- Inspect the values of `editable` and `autostart` in the `values.yaml` file of the specified IOC (TODO: at present it uses the p47-services source code to do so but this should be determined from the cluster in future).
62+
- Inspect the values of `editable` and `autostart` in the `values.yaml` file of the specified service (TODO: at present it uses the p47-services source code to do so but this should be determined from the cluster in future).
6363
- Port forward the debugpy port (5678) from the pod to localhost.
6464
- If editable is true, it will mount the PVC locally using pv-mounter and open VSCode to the /workspaces/xxx folder.
6565
- If autostart is false, it will exec into the container and launch debugpy to run the main program.

Charts/fastcs/templates/statefulset.yaml

Lines changed: 34 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,27 @@ Default the derivable substitution values.
44
This keeps the length of the values.txt file for each individual IOC
55
to a minimum
66
*/ -}}
7-
{{- $location := default .Values.global.location .Values.location | required "ERROR - You must supply location or global.location" -}}
8-
{{- $ioc_group := default .Values.global.ioc_group .Values.ioc_group | required "ERROR - You must supply ioc_group or global.ioc_group" -}}
7+
{{- $location := default .Values.global.location .Values.location | default "" -}}
8+
# for epics-containers services repos, ioc_group is set in services/values.yaml
9+
{{- $ioc_group := default .Values.global.ioc_group .Values.ioc_group | default "" -}}
10+
# for epics-containers services repos, opisClaim is named after the ioc_group in services/values.yaml
11+
# for non-epics-containers services repos, opisClaim should be set in the service values.yaml
912
{{- $opisClaim := default (print $ioc_group "-opi-claim") .Values.opisClaim -}}
10-
{{- $runtimeClaim := default (print $ioc_group "-runtime-claim") .Values.runtimeClaim -}}
11-
{{- $autosaveClaim := default (print $ioc_group "-autosave-claim") .Values.autosaveClaim -}}
1213
{{- $image := .Values.image | required "ERROR - You must supply image." -}}
1314

14-
{{- $enabled := eq .Values.global.enabled false | ternary false true -}}
15+
{{- $enabled := eq .Values.global.enabled false | ternary false true }}
1516

1617
apiVersion: apps/v1
1718
kind: StatefulSet
1819
metadata:
1920
name: {{ .Release.Name }}
2021
labels:
21-
location: {{ $location }}
22+
location: {{ $location | quote }}
23+
{{- with $ioc_group }}
2224
ioc_group: {{ $ioc_group }}
25+
{{- end }}
2326
enabled: {{ $enabled | quote }}
24-
is_ioc: "true"
27+
is_ioc: {{ .Values.is_ioc | quote }}
2528
{{- include "fastcs.labels" . | nindent 4 }}
2629
spec:
2730
replicas: {{ $enabled | ternary 1 0 }}
@@ -35,10 +38,12 @@ spec:
3538
{{- toYaml . | nindent 8 }}
3639
{{- end }}
3740
labels:
38-
location: {{ $location }}
41+
location: {{ $location | quote }}
42+
{{- with $ioc_group }}
3943
ioc_group: {{ $ioc_group }}
44+
{{- end }}
4045
enabled: {{ $enabled | quote }}
41-
is_ioc: "true"
46+
is_ioc: {{ .Values.is_ioc | quote }}
4247
{{- include "fastcs.labels" . | nindent 8 }}
4348
{{- with .Values.podLabels }}
4449
{{- toYaml . | nindent 8 }}
@@ -79,16 +84,16 @@ spec:
7984
image: {{ .image }}
8085
imagePullPolicy: {{ $.Values.image.pullPolicy }}
8186
# a writable place to have cwd
82-
workingDir: /epics/runtime
87+
workingDir: /tmp
8388
env:
8489
- name: HOME
85-
value: /epics/runtime
90+
value: /tmp
8691
- name: TERM
8792
value: xterm-256color
88-
{{- with $.Values.globalEnv }}
93+
{{- with $.Values.env }}
8994
{{- toYaml . | nindent 12}}
9095
{{- end }}
91-
{{- with $.Values.iocEnv }}
96+
{{- with $.Values.global.env }}
9297
{{- toYaml . | nindent 12}}
9398
{{- end }}
9499
{{- with $.Values.securityContext }}
@@ -103,17 +108,13 @@ spec:
103108
{{- with $.Values.volumeMounts }}
104109
{{- toYaml . | nindent 12 }}
105110
{{- end }}
106-
- name: runtime-volume
107-
mountPath: /epics/runtime
108-
subPath: {{ $.Release.Name }}
111+
{{- with $.Values.opisMountPoint }}
109112
- name: opis-volume
110-
mountPath: /epics/opi
111-
subPath: {{ $.Release.Name }}
112-
- name: autosave-volume
113-
mountPath: /autosave
113+
mountPath: .
114114
subPath: {{ $.Release.Name }}
115+
{{- end }}
115116
- name: config-volume
116-
mountPath: {{ $.Values.iocConfig }}
117+
mountPath: {{ $.Values.configFolder }}
117118
{{- if $.Values.editable }}
118119
- name: {{ $.Release.Name }}-develop
119120
mountPath: /dest
@@ -123,16 +124,16 @@ spec:
123124
image: '{{ .Values.image.repository }}{{ ternary "-debug" "" .Values.editable }}:{{ .Values.image.tag }}'
124125
{{- with .Values.securityContext }}
125126
# a writable place to have cwd
126-
workingDir: /epics/runtime
127+
workingDir: /tmp
127128
env:
128129
- name: HOME
129-
value: /epics/runtime
130+
value: /tmp
130131
- name: TERM
131132
value: xterm-256color
132-
{{- with $.Values.globalEnv }}
133+
{{- with $.Values.env }}
133134
{{- toYaml . | nindent 12}}
134135
{{- end }}
135-
{{- with $.Values.iocEnv }}
136+
{{- with $.Values.global.env }}
136137
{{- toYaml . | nindent 12}}
137138
{{- end }}
138139
securityContext:
@@ -170,17 +171,13 @@ spec:
170171
{{- with .Values.volumeMounts }}
171172
{{- toYaml . | nindent 12 }}
172173
{{- end }}
173-
- name: runtime-volume
174-
mountPath: /epics/runtime
175-
subPath: {{ .Release.Name }}
174+
{{- if $.Values.mountEpicsOpis | default true }}
176175
- name: opis-volume
177176
mountPath: /epics/opi
178-
subPath: {{ .Release.Name }}
179-
- name: autosave-volume
180-
mountPath: /autosave
181-
subPath: {{ .Release.Name }}
177+
subPath: {{ $.Release.Name }}
178+
{{- end }}
182179
- name: config-volume
183-
mountPath: {{ .Values.iocConfig }}
180+
mountPath: {{ .Values.configFolder }}
184181
{{- if .Values.editable }}
185182
- name: {{ .Release.Name }}-develop
186183
mountPath: /workspaces
@@ -193,15 +190,12 @@ spec:
193190
{{- with .Values.volumes }}
194191
{{- toYaml . | nindent 8 }}
195192
{{- end }}
196-
- name: runtime-volume
197-
persistentVolumeClaim:
198-
claimName: {{ $runtimeClaim }}
193+
{{- if $.Values.mountEpicsOpis | default true }}
199194
- name: opis-volume
200195
persistentVolumeClaim:
201-
claimName: {{ $opisClaim }}
202-
- name: autosave-volume
203-
persistentVolumeClaim:
204-
claimName: {{ $autosaveClaim }}
196+
# use the supplied claim name or default to one based on ioc_group
197+
claimName: {{ $.Values.opisClaimName | default $opisClaim }}
198+
{{- end }}
205199
- name: config-volume
206200
configMap:
207201
name: {{ .Release.Name }}-config

Charts/fastcs/values.schema.json

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
"description": "command to run for the production container",
3535
"type": "array"
3636
},
37+
"configFolder": {
38+
"description": "path to the location of config folder",
39+
"type": "string"
40+
},
3741
"debugCommand": {
3842
"description": "command to run for the debugging (non- autostart) container",
3943
"type": "array",
@@ -45,6 +49,10 @@
4549
"description": "editable and autostart are used for debugging and development in-cluster",
4650
"type": "boolean"
4751
},
52+
"env": {
53+
"description": "Add environment to individual services",
54+
"type": "array"
55+
},
4856
"extraContainers": {
4957
"description": "Add arbitrary containers to the pod",
5058
"type": "array",
@@ -71,10 +79,15 @@
7179
"global": {
7280
"description": "shared values for all services",
7381
"type": "object",
82+
"properties": {
83+
"env": {
84+
"description": "Add environment to all services",
85+
"type": "array"
86+
}
87+
},
7488
"additionalProperties": true
7589
},
7690
"globalEnv": {
77-
"description": "Add environment to all IOCs",
7891
"type": "array",
7992
"items": {
8093
"type": "object",
@@ -114,12 +127,7 @@
114127
"type": "string"
115128
}
116129
},
117-
"iocConfig": {
118-
"description": "path to the location of config folder (defaults to be the same as C++ IOCs)",
119-
"type": "string"
120-
},
121130
"iocEnv": {
122-
"description": "Add environment to individual IOCs",
123131
"type": "array",
124132
"items": {
125133
"type": "object",
@@ -133,6 +141,10 @@
133141
}
134142
}
135143
},
144+
"is_ioc": {
145+
"description": "set to true of IOCs in services repos",
146+
"type": "boolean"
147+
},
136148
"livenessProbe": {
137149
"$ref": "https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.33.3/container.json#/properties/livenessProbe",
138150
"type": "object"
@@ -141,6 +153,14 @@
141153
"$ref": "https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.33.3/podspec.json#/properties/nodeSelector",
142154
"type": "object"
143155
},
156+
"opisClaim": {
157+
"description": "name of the PVC to use to store opi files, leave blank for IOCs - will then default to ixx-epics-opis",
158+
"type": "null"
159+
},
160+
"opisMountPoint": {
161+
"description": "where to mount the opis volume inside the container",
162+
"type": "string"
163+
},
144164
"podAnnotations": {
145165
"description": "Add annotations to the pod",
146166
"type": "object"

Charts/fastcs/values.yaml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@
1010

1111
# @schema description: shared values for all services
1212
# @schema additionalProperties: true
13-
global: {}
13+
global:
14+
# @schema description: Add environment to all services
15+
env: []
1416

15-
# @schema description: Add environment to all IOCs
16-
globalEnv: []
17-
18-
# @schema description: Add environment to individual IOCs
19-
iocEnv: []
17+
# @schema description: Add environment to individual services
18+
env: []
2019

2120
# @schema description: container image URI
2221
image:
@@ -68,8 +67,17 @@ editable: false
6867
# true: entrypoint is command above
6968
autostart: true
7069

71-
# @schema description: path to the location of config folder (defaults to be the same as C++ IOCs)
72-
iocConfig: /epics/ioc/config
70+
# @schema description: path to the location of config folder
71+
configFolder: /config
72+
73+
# @schema description: name of the PVC to use to store opi files, leave blank for IOCs - will then default to ixx-epics-opis
74+
opisClaim:
75+
76+
# @schema description: where to mount the opis volume inside the container
77+
opisMountPoint: /epics/opi
78+
79+
# @schema description: set to true of IOCs in services repos
80+
is_ioc: false
7381

7482
# @schema description: service port for Channel Access
7583
ca_server_port: 5064

0 commit comments

Comments
 (0)