|
| 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 | +{{- $image := .Values.image | required "ERROR - You must supply image." -}} |
| 10 | + |
| 11 | +{{- $enabled := eq .Values.global.enabled false | ternary false true -}} |
| 12 | + |
| 13 | +apiVersion: apps/v1 |
| 14 | +kind: StatefulSet |
| 15 | +metadata: |
| 16 | + name: {{ .Release.Name }} |
| 17 | + labels: |
| 18 | + app: {{ .Release.Name }} |
| 19 | + location: {{ $location }} |
| 20 | + ioc_group: {{ $ioc_group }} |
| 21 | + enabled: {{ $enabled | quote }} |
| 22 | + is_ioc: "true" |
| 23 | +spec: |
| 24 | + replicas: {{ $enabled | ternary 1 0 }} |
| 25 | + selector: |
| 26 | + matchLabels: |
| 27 | + app: {{ .Release.Name }} |
| 28 | + template: |
| 29 | + metadata: |
| 30 | + {{- with .Values.podAnnotations }} |
| 31 | + annotations: |
| 32 | + {{- toYaml . | nindent 8 }} |
| 33 | + {{- end }} |
| 34 | + labels: |
| 35 | + app: {{ .Release.Name }} |
| 36 | + location: {{ $location }} |
| 37 | + ioc_group: {{ $ioc_group }} |
| 38 | + is_ioc: "true" |
| 39 | + spec: |
| 40 | + hostNetwork: {{ .Values.hostNetwork }} |
| 41 | + {{- with .Values.imagePullSecrets }} |
| 42 | + imagePullSecrets: |
| 43 | + {{- toYaml . | nindent 8 }} |
| 44 | + {{- end }} |
| 45 | + terminationGracePeriodSeconds: 2 |
| 46 | + {{- with .Values.podSecurityContext }} |
| 47 | + securityContext: |
| 48 | + {{- toYaml . | nindent 8 }} |
| 49 | + {{- end }} |
| 50 | + containers: |
| 51 | + - name: {{ .Chart.Name }} |
| 52 | + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" |
| 53 | + command: |
| 54 | + {{- .Values.command | toYaml | nindent 12 }} |
| 55 | + stdin: true |
| 56 | + tty: true |
| 57 | + {{- $domain := (.Values.ioc_domain | default $location) | upper }} |
| 58 | + {{- $ioc_name := (.Values.ioc_name | default .Release.Name) | upper }} |
| 59 | + {{ $workingDir := "" }} {{- /* create the variable in global scope before setting in if/else!!! */ -}} |
| 60 | + {{- if .Values.ioc_path }} |
| 61 | + {{- $workingDir = printf "%s/%s" .Values.ioc_path $ioc_name }} |
| 62 | + {{- else }} |
| 63 | + {{- $workingDir = printf "/dls_sw/prod/%s/ioc/%s/%s/%s" .Values.epics_version $domain $ioc_name .Values.ioc_version }} |
| 64 | + {{- end }} |
| 65 | + workingDir: {{ $workingDir }} |
| 66 | + {{- with .Values.securityContext }} |
| 67 | + securityContext: |
| 68 | + {{- toYaml . | nindent 12 }} |
| 69 | + {{- end }} |
| 70 | + env: |
| 71 | + # psuedo home sets up epics module etc. |
| 72 | + - name: HOME |
| 73 | + value: /epics_home |
| 74 | + imagePullPolicy: {{ .Values.image.pullPolicy }} |
| 75 | + {{- with .Values.livenessProbe }} |
| 76 | + livenessProbe: |
| 77 | + {{- toYaml . | nindent 12 }} |
| 78 | + {{- end }} |
| 79 | + {{- with .Values.readinessProbe }} |
| 80 | + readinessProbe: |
| 81 | + {{- toYaml . | nindent 12 }} |
| 82 | + {{- end }} |
| 83 | + {{- with .Values.resources }} |
| 84 | + resources: |
| 85 | + {{- toYaml . | nindent 12 }} |
| 86 | + {{- end }} |
| 87 | + {{- with .Values.volumeMounts }} |
| 88 | + volumeMounts: |
| 89 | + {{- toYaml . | nindent 12 }} |
| 90 | + {{- end }} |
| 91 | + {{- with .Values.volumes }} |
| 92 | + volumes: |
| 93 | + {{- toYaml . | nindent 8 }} |
| 94 | + {{- end }} |
| 95 | + {{- with .Values.nodeSelector }} |
| 96 | + nodeSelector: |
| 97 | + {{- toYaml . | nindent 8 }} |
| 98 | + {{- end }} |
| 99 | + {{- with .Values.affinity }} |
| 100 | + affinity: |
| 101 | + {{- toYaml . | nindent 8 }} |
| 102 | + {{- end }} |
| 103 | + {{- with .Values.tolerations }} |
| 104 | + tolerations: |
| 105 | + {{- toYaml . | nindent 8 }} |
| 106 | + {{- end }} |
0 commit comments