|
| 1 | +{{- /* |
| 2 | +Default the derivable substitution values. |
| 3 | + |
| 4 | +This keeps the length of the values.txt file for each individual IOC |
| 5 | +to a minimum |
| 6 | +*/ -}} |
| 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" -}} |
| 9 | +{{- $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 -}} |
| 12 | +{{- $image := .Values.image | required "ERROR - You must supply image." -}} |
| 13 | + |
| 14 | +{{- $enabled := eq .Values.global.enabled false | ternary false true -}} |
| 15 | + |
| 16 | +apiVersion: apps/v1 |
| 17 | +kind: StatefulSet |
| 18 | +metadata: |
| 19 | + name: {{ include "fastcs.fullname" . }} |
| 20 | + labels: |
| 21 | + location: {{ $location }} |
| 22 | + ioc_group: {{ $ioc_group }} |
| 23 | + enabled: {{ $enabled | quote }} |
| 24 | + is_ioc: "true" |
| 25 | + {{- include "fastcs.labels" . | nindent 4 }} |
| 26 | +spec: |
| 27 | + replicas: {{ $enabled | ternary 1 0 }} |
| 28 | + selector: |
| 29 | + matchLabels: |
| 30 | + {{- include "fastcs.selectorLabels" . | nindent 6 }} |
| 31 | + template: |
| 32 | + metadata: |
| 33 | + {{- with .Values.podAnnotations }} |
| 34 | + annotations: |
| 35 | + {{- toYaml . | nindent 8 }} |
| 36 | + {{- end }} |
| 37 | + labels: |
| 38 | + {{- include "fastcs.labels" . | nindent 8 }} |
| 39 | + {{- with .Values.podLabels }} |
| 40 | + {{- toYaml . | nindent 8 }} |
| 41 | + {{- end }} |
| 42 | + # re-deploy in case the configMap has changed - use a random value |
| 43 | + # unless the Commit Hash is supplied (by ArgoCD or helm command line) |
| 44 | + rollme: {{ .Values.global.commitHash | default (randAlphaNum 5) | quote }} |
| 45 | + spec: |
| 46 | + serviceAccountName: {{ include "fastcs.serviceAccountName" . }} |
| 47 | + {{- with .Values.podSecurityContext }} |
| 48 | + securityContext: |
| 49 | + {{- toYaml . | nindent 8 }} |
| 50 | + {{- end }} |
| 51 | + containers: |
| 52 | + {{- range .Values.extra_containers }} |
| 53 | + - name: {{ .name }} |
| 54 | + {{- with $.Values.securityContext }} |
| 55 | + securityContext: |
| 56 | + {{- toYaml . | nindent 12 }} |
| 57 | + {{- end }} |
| 58 | + image: {{ .image }} |
| 59 | + {{- with .startCommand }} |
| 60 | + command: |
| 61 | + {{- if (kindIs "string" .) }} |
| 62 | + - {{ . }} |
| 63 | + {{- else if (kindIs "slice" .) }} |
| 64 | + {{- . | toYaml | nindent 10 }} |
| 65 | + {{- end }} |
| 66 | + {{- end }} |
| 67 | + volumeMounts: |
| 68 | + {{- with $.Values.volumeMounts }} |
| 69 | + {{- toYaml . | nindent 12 }} |
| 70 | + {{- end }} |
| 71 | + - name: opis-volume |
| 72 | + mountPath: /epics/opi |
| 73 | + subPath: "{{ $.Release.Name }}" |
| 74 | + - name: config-volume |
| 75 | + mountPath: {{ $.Values.iocConfig }} |
| 76 | + {{- end }} |
| 77 | + - name: {{ .Chart.Name }} |
| 78 | + {{- with .Values.securityContext }} |
| 79 | + securityContext: |
| 80 | + {{- toYaml . | nindent 12 }} |
| 81 | + {{- end }} |
| 82 | + image: "{{ .Values.image }}" |
| 83 | + imagePullPolicy: IfNotPresent |
| 84 | + {{- with .Values.startCommand }} |
| 85 | + command: |
| 86 | + {{- if (kindIs "string" .) }} |
| 87 | + - {{ . }} |
| 88 | + {{- else if (kindIs "slice" .) }} |
| 89 | + {{- . | toYaml | nindent 10 }} |
| 90 | + {{- end }} |
| 91 | + {{- end }} |
| 92 | + {{- with .Values.startArgs }} |
| 93 | + args: |
| 94 | + {{- if (kindIs "string" .) }} |
| 95 | + - {{ . }} |
| 96 | + {{- else if (kindIs "slice" .) }} |
| 97 | + {{- . | toYaml | nindent 10 }} |
| 98 | + {{- end }} |
| 99 | + {{- end }} |
| 100 | + |
| 101 | + ports: |
| 102 | + - name: channel-access |
| 103 | + containerPort: 5064 |
| 104 | + protocol: TCP |
| 105 | + - name: pv-access |
| 106 | + containerPort: 5075 |
| 107 | + protocol: TCP |
| 108 | + {{- with .Values.livenessProbe }} |
| 109 | + livenessProbe: |
| 110 | + {{- toYaml . | nindent 12 }} |
| 111 | + {{- end }} |
| 112 | + {{- with .Values.readinessProbe }} |
| 113 | + readinessProbe: |
| 114 | + {{- toYaml . | nindent 12 }} |
| 115 | + {{- end }} |
| 116 | + {{- with .Values.resources }} |
| 117 | + resources: |
| 118 | + {{- toYaml . | nindent 12 }} |
| 119 | + {{- end }} |
| 120 | + volumeMounts: |
| 121 | + {{- with .Values.volumeMounts }} |
| 122 | + {{- toYaml . | nindent 12 }} |
| 123 | + {{- end }} |
| 124 | + - name: opis-volume |
| 125 | + mountPath: /epics/opi |
| 126 | + subPath: "{{ .Release.Name }}" |
| 127 | + - name: config-volume |
| 128 | + mountPath: {{ .Values.iocConfig }} |
| 129 | + volumes: |
| 130 | + {{- with .Values.volumes }} |
| 131 | + {{- toYaml . | nindent 8 }} |
| 132 | + {{- end }} |
| 133 | + - name: opis-volume |
| 134 | + persistentVolumeClaim: |
| 135 | + claimName: {{ $opisClaim }} |
| 136 | + - name: config-volume |
| 137 | + configMap: |
| 138 | + name: {{ .Release.Name }}-config |
| 139 | + {{- with .Values.nodeSelector }} |
| 140 | + nodeSelector: |
| 141 | + {{- toYaml . | nindent 8 }} |
| 142 | + {{- end }} |
| 143 | + {{- with .Values.affinity }} |
| 144 | + affinity: |
| 145 | + {{- toYaml . | nindent 8 }} |
| 146 | + {{- end }} |
| 147 | + {{- with .Values.tolerations }} |
| 148 | + tolerations: |
| 149 | + {{- toYaml . | nindent 8 }} |
| 150 | + {{- end }} |
0 commit comments