123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214 |
- apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
- kind: Deployment
- metadata:
- name: {{ include "common.names.fullname" . }}
- namespace: {{ .Release.Namespace | quote }}
- labels: {{- include "common.labels.standard" . | nindent 4 }}
- {{- if .Values.commonLabels }}
- {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
- {{- end }}
- {{- if .Values.commonAnnotations }}
- annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
- {{- end }}
- spec:
- selector:
- matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
- {{- if .Values.updateStrategy }}
- strategy: {{- toYaml .Values.updateStrategy | nindent 4 }}
- {{- end }}
- replicas: {{ .Values.replicaCount }}
- template:
- metadata:
- labels: {{- include "common.labels.standard" . | nindent 8 }}
- {{- if .Values.podLabels }}
- {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }}
- {{- end }}
- {{- if .Values.podAnnotations }}
- annotations:
- {{- if .Values.podAnnotations }}
- {{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }}
- {{- end }}
- {{- if .Values.metrics.podAnnotations }}
- {{- include "common.tplvalues.render" (dict "value" .Values.metrics.podAnnotations "context" $) | nindent 8 }}
- {{- end }}
- {{- end }}
- spec:
- {{- include "halo.imagePullSecrets" . | nindent 6 }}
- {{- if .Values.hostAliases }}
- # yamllint disable rule:indentation
- hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }}
- # yamllint enable rule:indentation
- {{- end }}
- {{- if .Values.affinity }}
- affinity: {{- include "common.tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 8 }}
- {{- else }}
- affinity:
- podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "context" $) | nindent 10 }}
- podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "context" $) | nindent 10 }}
- nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }}
- {{- end }}
- {{- if .Values.nodeSelector }}
- nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }}
- {{- end }}
- {{- if .Values.tolerations }}
- tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" $) | nindent 8 }}
- {{- end }}
- {{- if .Values.priorityClassName }}
- priorityClassName: {{ .Values.priorityClassName }}
- {{- end }}
- {{- if .Values.schedulerName }}
- schedulerName: {{ .Values.schedulerName | quote }}
- {{- end }}
- {{- if .Values.podSecurityContext.enabled }}
- securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }}
- {{- end }}
- serviceAccountName: {{ include "halo.serviceAccountName" .}}
- {{- if .Values.topologySpreadConstraints }}
- topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.topologySpreadConstraints "context" .) | nindent 8 }}
- {{- end }}
- initContainers:
- - name: wait-database
- image: busybox:latest
- imagePullPolicy: IfNotPresent
- command:
- - sh
- - -c
- - |
- set -ex
- until nc -zv {{ include "halo.databaseHost" . }} {{ include "halo.databasePort" . }}; do sleep 5; done
- sleep 10
- {{- if and .Values.podSecurityContext.enabled .Values.volumePermissions.enabled .Values.persistence.enabled }}
- - name: volume-permissions
- image: "{{ include "halo.volumePermissions.image" . }}"
- imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }}
- command:
- - /bin/bash
- args:
- - -ec
- - |
- mkdir -p /data/halo
- {{- if eq ( toString ( .Values.volumePermissions.containerSecurityContext.runAsUser )) "auto" }}
- find /data/halo -mindepth 0 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" | xargs -r chown -R $(id -u):$(id -G | cut -d " " -f2)
- {{- else }}
- find /data/halo -mindepth 0 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" | xargs -r chown -R {{ .Values.containerSecurityContext.runAsUser }}:{{ .Values.podSecurityContext.fsGroup }}
- {{- end }}
- {{- if eq ( toString ( .Values.volumePermissions.containerSecurityContext.runAsUser )) "auto " }}
- securityContext: {{- omit .Values.volumePermissions.containerSecurityContext "runAsUser" | toYaml | nindent 12 }}
- {{- else }}
- securityContext: {{- .Values.volumePermissions.containerSecurityContext | toYaml | nindent 12 }}
- {{- end }}
- {{- if .Values.volumePermissions.resources }}
- resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
- {{- end }}
- volumeMounts:
- - mountPath: /data/halo
- name: halo-data
- subPath: halo
- {{- end }}
- {{- if .Values.initContainers }}
- {{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }}
- {{- end }}
- containers:
- - name: halo
- image: {{ include "halo.image" . }}
- imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
- {{- if .Values.diagnosticMode.enabled }}
- command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
- {{- else if .Values.command }}
- command: {{- include "common.tplvalues.render" ( dict "value" .Values.command "context" $) | nindent 12 }}
- {{- end }}
- {{- if .Values.diagnosticMode.enabled }}
- args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
- {{- else if .Values.args }}
- args: {{- include "common.tplvalues.render" ( dict "value" .Values.args "context" $) | nindent 12 }}
- {{- end }}
- {{- if .Values.containerSecurityContext.enabled }}
- securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
- {{- end }}
- env:
- - name: SERVER_PORT
- value: "{{ .Values.containerPorts.http }}"
- - name: HALO_WORK_DIR
- value: /data/halo
- - name: SPRING_R2DBC_URL
- value: {{ include "halo.r2dbcUrl" . | quote }}
- - name: SPRING_R2DBC_USERNAME
- value: {{ include "halo.databaseUser" . | quote }}
- - name: SPRING_R2DBC_PASSWORD
- valueFrom:
- secretKeyRef:
- name: {{ include "halo.databaseSecretName" . }}
- key: {{ include "halo.databaseSecretKeyName" . }}
- - name: SPRING_SQL_INIT_PLATFORM
- value: {{ include "halo.databasePlatform" . | quote }}
- - name: HALO_EXTERNAL_URL
- value: http://localhost:8090/
- - name: HALO_SECURITY_INITIALIZER_SUPERADMINUSERNAME
- value: {{ .Values.haloUsername | quote }}
- - name: HALO_SECURITY_INITIALIZER_SUPERADMINPASSWORD
- valueFrom:
- secretKeyRef:
- name: {{ include "halo.secretName" . }}
- key: halo-password
- {{- if .Values.extraEnvVars }}
- {{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }}
- {{- end }}
- envFrom:
- {{- if .Values.extraEnvVarsCM }}
- - configMapRef:
- name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsCM "context" $) }}
- {{- end }}
- {{- if .Values.extraEnvVarsSecret }}
- - secretRef:
- name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }}
- {{- end }}
- ports:
- - name: http
- containerPort: {{ .Values.containerPorts.http }}
- {{- if .Values.extraContainerPorts }}
- {{- include "common.tplvalues.render" (dict "value" .Values.extraContainerPorts "context" $) | nindent 12 }}
- {{- end }}
- {{- if .Values.lifecycleHooks }}
- lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }}
- {{- end }}
- {{- if not .Values.diagnosticMode.enabled }}
- {{- if .Values.customLivenessProbe }}
- livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }}
- {{- else if .Values.livenessProbe.enabled }}
- livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.livenessProbe "enabled") "context" $) | nindent 12 }}
- {{- end }}
- {{- if .Values.customReadinessProbe }}
- readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }}
- {{- else if .Values.readinessProbe.enabled }}
- readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.readinessProbe "enabled") "context" $) | nindent 12 }}
- {{- end }}
- {{- if .Values.customStartupProbe }}
- startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customStartupProbe "context" $) | nindent 12 }}
- {{- else if .Values.startupProbe.enabled }}
- startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.startupProbe "enabled") "context" $) | nindent 12 }}
- {{- end }}
- {{- end }}
- {{- if .Values.resources }}
- resources: {{- toYaml .Values.resources | nindent 12 }}
- {{- end }}
- volumeMounts:
- - mountPath: /data/halo
- name: halo-data
- subPath: halo
- {{- if .Values.extraVolumeMounts }}
- {{- include "common.tplvalues.render" (dict "value" .Values.extraVolumeMounts "context" $) | nindent 12 }}
- {{- end }}
- {{- if .Values.sidecars }}
- {{- include "common.tplvalues.render" (dict "value" .Values.sidecars "context" $) | nindent 8 }}
- {{- end }}
- volumes:
- - name: halo-data
- {{- if .Values.persistence.enabled }}
- persistentVolumeClaim:
- claimName: {{ .Values.persistence.existingClaim | default (include "common.names.fullname" .) }}
- {{- else }}
- emptyDir: {}
- {{- end }}
- {{- if .Values.extraVolumes }}
- {{- include "common.tplvalues.render" (dict "value" .Values.extraVolumes "context" $) | nindent 8 }}
- {{- end }}
|