diff --git a/helm/blueapi/README.md b/helm/blueapi/README.md index 3862290fb..4ece387b7 100644 --- a/helm/blueapi/README.md +++ b/helm/blueapi/README.md @@ -46,7 +46,7 @@ A Helm chart deploying a worker pod that runs Bluesky plans | 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. | | tolerations | list | `[]` | May be required to run on specific nodes (e.g. the control machine) | | 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 | -| 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. | +| volumeMounts | list | `[]` | Additional volumeMounts on the output StatefulSet definition. Define how volumes are mounted to the container referenced by using the same name. | | volumes | list | `[]` | Additional volumes on the output StatefulSet definition. Define volumes from e.g. Secrets, ConfigMaps or the Filesystem | | 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 | | 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 | diff --git a/helm/blueapi/templates/statefulset.yaml b/helm/blueapi/templates/statefulset.yaml index 36695459b..556089965 100644 --- a/helm/blueapi/templates/statefulset.yaml +++ b/helm/blueapi/templates/statefulset.yaml @@ -143,6 +143,9 @@ spec: {{- toYaml . | nindent 12 }} {{- end }} volumeMounts: + - name: worker-config + mountPath: "/config" + readOnly: true {{- with .Values.volumeMounts }} {{- toYaml . | nindent 12 }} {{- end }} diff --git a/helm/blueapi/values.schema.json b/helm/blueapi/values.schema.json index 639209dd9..74deedadb 100644 --- a/helm/blueapi/values.schema.json +++ b/helm/blueapi/values.schema.json @@ -334,21 +334,7 @@ }, "volumeMounts": { "description": "Additional volumeMounts on the output StatefulSet definition. Define how volumes are mounted to the container referenced by using the same name.", - "type": "array", - "items": { - "type": "object", - "properties": { - "mountPath": { - "type": "string" - }, - "name": { - "type": "string" - }, - "readOnly": { - "type": "boolean" - } - } - } + "type": "array" }, "volumes": { "description": "Additional volumes on the output StatefulSet definition. Define volumes from e.g. Secrets, ConfigMaps or the Filesystem", diff --git a/helm/blueapi/values.yaml b/helm/blueapi/values.yaml index 876b37a98..36a82eeb5 100644 --- a/helm/blueapi/values.yaml +++ b/helm/blueapi/values.yaml @@ -36,8 +36,7 @@ podAnnotations: {} # For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ podLabels: {} -podSecurityContext: {} - # fsGroup: 2000 +podSecurityContext: {} # fsGroup: 2000 securityContext: # https://github.com/DiamondLightSource/blueapi/issues/1096 @@ -131,13 +130,18 @@ startupProbe: # -- Additional volumes on the output StatefulSet definition. # Define volumes from e.g. Secrets, ConfigMaps or the Filesystem volumes: [] +# - name: dls-sw-bl +# hostPath: +# path: "/dls_sw/i23" +# type: Directory # -- Additional volumeMounts on the output StatefulSet definition. # Define how volumes are mounted to the container referenced by using the same name. -volumeMounts: - - name: worker-config - mountPath: "/config" - readOnly: true +volumeMounts: [] +# - name: dls-sw-bl +# mountPath: /dls_sw/i23 +# readOnly: true +# mountPropagation: HostToContainer # -- May be required to run on specific nodes (e.g. the control machine) nodeSelector: {} diff --git a/tests/unit_tests/test_helm_chart.py b/tests/unit_tests/test_helm_chart.py index 43b8b5769..4c1dcb24b 100644 --- a/tests/unit_tests/test_helm_chart.py +++ b/tests/unit_tests/test_helm_chart.py @@ -1206,7 +1206,7 @@ def test_service_linked_to_api(worker_api_url: str | None, service_port: int): @pytest.mark.parametrize( "added_mounts", - [[{"name": "worker-config", "mountPath": "/config", "readOnly": True}], [], None], + [[{"name": "foo", "mountPath": "/bar", "readOnly": True}], [], None], ) @pytest.mark.parametrize( "added_volumes", [[{"name": "foo", "configMap": {"name": "bar"}}], [], None] @@ -1218,6 +1218,13 @@ def test_volumes_created( manifests = render_chart( values={"volumes": added_volumes, "volumeMounts": added_mounts} ) + expected_mounts = [ + { + "name": "worker-config", + "mountPath": "/config", + "readOnly": True, + } + ] expected_volumes = [ { @@ -1229,9 +1236,7 @@ def test_volumes_created( if added_volumes: expected_volumes += added_volumes if added_mounts: - expected_mounts = added_mounts - else: - expected_mounts = None + expected_mounts += added_mounts container_mounts = manifests["StatefulSet"]["blueapi"]["spec"]["template"]["spec"][ "containers"