Skip to content

Commit 2735289

Browse files
fix: move worker-config from values.yaml volumeMount to statefulset.yaml volumeMount (#1527)
Fixes #1451 Tested on p48: - created a new PVC which was referenced in the p48-blueapi-0 pod under volumes: ``` name: my-pv-claim persistentVolumeClaim: claimName: my-pv-claim ``` - The PV was also bound: ``` pvc-905772f8-0fe1-4d8d-8186-4838473eb289 1Gi RWX Delete Bound p48-beamline/my-pv-claim ```
1 parent d880320 commit 2735289

5 files changed

Lines changed: 24 additions & 26 deletions

File tree

helm/blueapi/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ A Helm chart deploying a worker pod that runs Bluesky plans
4646
| startupProbe | object | `{"failureThreshold":5,"httpGet":{"path":"/healthz","port":"http"},"periodSeconds":10}` | A more lenient livenessProbe to allow the service to start fully. This is automatically disabled when in debug mode. |
4747
| tolerations | list | `[]` | May be required to run on specific nodes (e.g. the control machine) |
4848
| tracing | object | `{"fastapi":{"excludedURLs":"/healthz"},"otlp":{"enabled":false,"protocol":"http/protobuf","server":{"host":"http://opentelemetry-collector.tracing","port":4318}}}` | Exclude health probe requests from tracing by default to prevent spamming |
49-
| volumeMounts | list | `[{"mountPath":"/config","name":"worker-config","readOnly":true}]` | Additional volumeMounts on the output StatefulSet definition. Define how volumes are mounted to the container referenced by using the same name. |
49+
| volumeMounts | list | `[]` | Additional volumeMounts on the output StatefulSet definition. Define how volumes are mounted to the container referenced by using the same name. |
5050
| volumes | list | `[]` | Additional volumes on the output StatefulSet definition. Define volumes from e.g. Secrets, ConfigMaps or the Filesystem |
5151
| worker | object | `{"api":{"url":"http://0.0.0.0:8000/"},"env":{"sources":[{"kind":"planFunctions","module":"dodal.plans"},{"kind":"planFunctions","module":"dodal.plan_stubs.wrapped"}]},"logging":{"graylog":{"enabled":false,"url":"tcp://graylog-log-target.diamond.ac.uk:12231/"},"level":"INFO"},"scratch":{"repositories":[],"root":"/workspace"},"stomp":{"auth":{"password":"guest","username":"guest"},"enabled":false,"url":"tcp://rabbitmq:61613/"}}` | Config for the worker goes here, will be mounted into a config file |
5252
| worker.api.url | string | `"http://0.0.0.0:8000/"` | 0.0.0.0 required to allow non-loopback traffic If using hostNetwork, the port must be free on the host |

helm/blueapi/templates/statefulset.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ spec:
143143
{{- toYaml . | nindent 12 }}
144144
{{- end }}
145145
volumeMounts:
146+
- name: worker-config
147+
mountPath: "/config"
148+
readOnly: true
146149
{{- with .Values.volumeMounts }}
147150
{{- toYaml . | nindent 12 }}
148151
{{- end }}

helm/blueapi/values.schema.json

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -334,21 +334,7 @@
334334
},
335335
"volumeMounts": {
336336
"description": "Additional volumeMounts on the output StatefulSet definition. Define how volumes are mounted to the container referenced by using the same name.",
337-
"type": "array",
338-
"items": {
339-
"type": "object",
340-
"properties": {
341-
"mountPath": {
342-
"type": "string"
343-
},
344-
"name": {
345-
"type": "string"
346-
},
347-
"readOnly": {
348-
"type": "boolean"
349-
}
350-
}
351-
}
337+
"type": "array"
352338
},
353339
"volumes": {
354340
"description": "Additional volumes on the output StatefulSet definition. Define volumes from e.g. Secrets, ConfigMaps or the Filesystem",

helm/blueapi/values.yaml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ podAnnotations: {}
3636
# For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
3737
podLabels: {}
3838

39-
podSecurityContext: {}
40-
# fsGroup: 2000
39+
podSecurityContext: {} # fsGroup: 2000
4140

4241
securityContext:
4342
# https://github.com/DiamondLightSource/blueapi/issues/1096
@@ -131,13 +130,18 @@ startupProbe:
131130
# -- Additional volumes on the output StatefulSet definition.
132131
# Define volumes from e.g. Secrets, ConfigMaps or the Filesystem
133132
volumes: []
133+
# - name: dls-sw-bl
134+
# hostPath:
135+
# path: "/dls_sw/i23"
136+
# type: Directory
134137

135138
# -- Additional volumeMounts on the output StatefulSet definition.
136139
# Define how volumes are mounted to the container referenced by using the same name.
137-
volumeMounts:
138-
- name: worker-config
139-
mountPath: "/config"
140-
readOnly: true
140+
volumeMounts: []
141+
# - name: dls-sw-bl
142+
# mountPath: /dls_sw/i23
143+
# readOnly: true
144+
# mountPropagation: HostToContainer
141145

142146
# -- May be required to run on specific nodes (e.g. the control machine)
143147
nodeSelector: {}

tests/unit_tests/test_helm_chart.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,7 @@ def test_service_linked_to_api(worker_api_url: str | None, service_port: int):
12061206

12071207
@pytest.mark.parametrize(
12081208
"added_mounts",
1209-
[[{"name": "worker-config", "mountPath": "/config", "readOnly": True}], [], None],
1209+
[[{"name": "foo", "mountPath": "/bar", "readOnly": True}], [], None],
12101210
)
12111211
@pytest.mark.parametrize(
12121212
"added_volumes", [[{"name": "foo", "configMap": {"name": "bar"}}], [], None]
@@ -1218,6 +1218,13 @@ def test_volumes_created(
12181218
manifests = render_chart(
12191219
values={"volumes": added_volumes, "volumeMounts": added_mounts}
12201220
)
1221+
expected_mounts = [
1222+
{
1223+
"name": "worker-config",
1224+
"mountPath": "/config",
1225+
"readOnly": True,
1226+
}
1227+
]
12211228

12221229
expected_volumes = [
12231230
{
@@ -1229,9 +1236,7 @@ def test_volumes_created(
12291236
if added_volumes:
12301237
expected_volumes += added_volumes
12311238
if added_mounts:
1232-
expected_mounts = added_mounts
1233-
else:
1234-
expected_mounts = None
1239+
expected_mounts += added_mounts
12351240

12361241
container_mounts = manifests["StatefulSet"]["blueapi"]["spec"]["template"]["spec"][
12371242
"containers"

0 commit comments

Comments
 (0)