diff --git a/helm/blueapi/README.md b/helm/blueapi/README.md index 4ece387b72..8e347d5947 100644 --- a/helm/blueapi/README.md +++ b/helm/blueapi/README.md @@ -21,9 +21,10 @@ A Helm chart deploying a worker pod that runs Bluesky plans | imagePullSecrets | list | `[]` | | | ingress | object | `{"annotations":{},"className":"nginx","enabled":false,"hosts":[{"host":"example.diamond.ac.uk","paths":[{"path":"/","pathType":"Prefix"}]}],"tls":[]}` | Configuring and enabling an ingress allows blueapi to be served at a nicer address, e.g. ixx-blueapi.diamond.ac.uk | | ingress.hosts[0] | object | `{"host":"example.diamond.ac.uk","paths":[{"path":"/","pathType":"Prefix"}]}` | Request a host from https://jira.diamond.ac.uk/servicedesk/customer/portal/2/create/91 of the form ixx-blueapi.diamond.ac.uk. Note: pathType: Prefix is required in Diamond's clusters | -| initContainer | object | `{"enabled":false,"persistentVolume":{"enabled":false,"existingClaimName":"","size":"1Gi"}}` | Configure the initContainer that checks out the scratch configuration repositories | +| initContainer | object | `{"enabled":false,"persistentVolume":{"customName":"","enabled":false,"existingClaimName":"","size":"1Gi"}}` | Configure the initContainer that checks out the scratch configuration repositories | +| initContainer.persistentVolume.customName | string | `""` | May be set to create or use a PVC named `ixx-blueapi-scratch-{customName}-a.b.c` | | initContainer.persistentVolume.enabled | bool | `false` | Whether to use a persistent volume in the cluster or check out onto the mounted host filesystem If persistentVolume.enabled: False, mounts scratch.root as scratch.root in the container | -| initContainer.persistentVolume.existingClaimName | string | `""` | May be set to an existing persistent volume claim to re-use the volume, else a new one is created for each blueapi release | +| initContainer.persistentVolume.existingClaimName | string | `""` | Deprecated. May be set to an existing persistent volume claim to re-use the volume, else a new one is created for each blueapi release | | initContainer.persistentVolume.size | string | `"1Gi"` | Size of persistent volume | | initResources | object | `{}` | Override resources for init container. By default copies resources of main container. | | livenessProbe | object | `{"failureThreshold":3,"httpGet":{"path":"/healthz","port":"http"},"periodSeconds":10}` | Liveness probe, if configured kubernetes will kill the pod and start a new one if failed consecutively. This is automatically disabled when in debug mode. | diff --git a/helm/blueapi/templates/statefulset.yaml b/helm/blueapi/templates/statefulset.yaml index 556089965e..4df8bcaa12 100644 --- a/helm/blueapi/templates/statefulset.yaml +++ b/helm/blueapi/templates/statefulset.yaml @@ -62,6 +62,8 @@ spec: persistentVolumeClaim: {{- if .Values.initContainer.persistentVolume.existingClaimName }} claimName: {{ .Values.initContainer.persistentVolume.existingClaimName }} + {{- else if .Values.initContainer.persistentVolume.customName }} + claimName: {{ include "blueapi.fullname" . }}-scratch-{{ .Values.initContainer.persistentVolume.customName }}-{{ .Values.image.tag | default .Chart.AppVersion }} {{- else }} claimName: {{ include "blueapi.fullname" . }}-scratch-{{ .Values.image.tag | default .Chart.AppVersion }} {{- end }} diff --git a/helm/blueapi/templates/volumes.yaml b/helm/blueapi/templates/volumes.yaml index 9dd796888b..92b855f73c 100644 --- a/helm/blueapi/templates/volumes.yaml +++ b/helm/blueapi/templates/volumes.yaml @@ -2,7 +2,11 @@ apiVersion: v1 kind: PersistentVolumeClaim metadata: + {{- if .Values.initContainer.persistentVolume.customName }} + name: {{ include "blueapi.fullname" . }}-scratch-{{ .Values.initContainer.persistentVolume.customName }}-{{ .Values.image.tag | default .Chart.AppVersion }} + {{- else }} name: {{ include "blueapi.fullname" . }}-scratch-{{ .Values.image.tag | default .Chart.AppVersion }} + {{- end }} annotations: argocd.argoproj.io/sync-options: Prune=false,Delete=false argocd.argoproj.io/compare-options: IgnoreExtraneous diff --git a/helm/blueapi/values.schema.json b/helm/blueapi/values.schema.json index c16ca03dc8..51b89beadb 100644 --- a/helm/blueapi/values.schema.json +++ b/helm/blueapi/values.schema.json @@ -115,12 +115,16 @@ "persistentVolume": { "type": "object", "properties": { + "customName": { + "description": "May be set to create or use a PVC named `ixx-blueapi-scratch-{customName}-a.b.c`", + "type": "string" + }, "enabled": { "description": "Whether to use a persistent volume in the cluster or check out onto the mounted host filesystem If persistentVolume.enabled: False, mounts scratch.root as scratch.root in the container", "type": "boolean" }, "existingClaimName": { - "description": "May be set to an existing persistent volume claim to re-use the volume, else a new one is created for each blueapi release", + "description": "Deprecated. May be set to an existing persistent volume claim to re-use the volume, else a new one is created for each blueapi release", "type": "string" }, "size": { diff --git a/helm/blueapi/values.yaml b/helm/blueapi/values.yaml index 36a82eeb5d..941575fb91 100644 --- a/helm/blueapi/values.yaml +++ b/helm/blueapi/values.yaml @@ -223,8 +223,10 @@ initContainer: # -- Whether to use a persistent volume in the cluster or check out onto the mounted host filesystem # If persistentVolume.enabled: False, mounts scratch.root as scratch.root in the container enabled: false - # -- May be set to an existing persistent volume claim to re-use the volume, else a new one is created for each blueapi release + # -- Deprecated. May be set to an existing persistent volume claim to re-use the volume, else a new one is created for each blueapi release existingClaimName: "" + # -- May be set to create or use a PVC named `ixx-blueapi-scratch-{customName}-a.b.c` + customName: "" # -- Size of persistent volume size: "1Gi"