{{- $app := include "checkmate.app" . | fromYaml -}} {{- if .Values.worker.enabled }} apiVersion: apps/v1 kind: Deployment metadata: name: checkmate-worker spec: {{- if not .Values.worker.autoscaling.enabled }} replicas: {{ .Values.worker.replicas }} # omitted when autoscaling owns the replica count {{- end }} selector: matchLabels: app: checkmate-worker template: metadata: labels: app: checkmate-worker spec: terminationGracePeriodSeconds: {{ .Values.worker.terminationGracePeriodSeconds }} {{- with .Values.worker.affinity }} affinity: {{- tpl ( . | toYaml) $ | nindent 8 }} {{- end }} {{- with .Values.worker.tolerations }} tolerations: {{- tpl ( . | toYaml) $ | nindent 8 }} {{- end }} containers: - name: worker image: {{ include "checkmate.image" (dict "image" (.Values.worker.image | default $app.image) "tag" (.Values.worker.tag | default $app.tag) "root" $) }} imagePullPolicy: {{ .Values.worker.imagePullPolicy | default $app.imagePullPolicy }} ports: - name: health containerPort: {{ .Values.worker.healthPort }} envFrom: - secretRef: name: checkmate-secrets # DB_CONNECTION_STRING (+ JWT_SECRET/CLIENT_HOST for validateEnv) env: # validateEnv requires a URL-shaped CLIENT_HOST, so mirror the app's default # here. Omitted when secrets.CLIENT_HOST is set, since `env` would otherwise # take precedence over the envFrom value and silently discard the override. {{- if not (hasKey .Values.secrets "CLIENT_HOST") }} - name: CLIENT_HOST value: "{{ $app.protocol }}://{{ $app.ingress.host }}" {{- end }} - name: QUEUE_MODE value: "worker" - name: HEALTH_PORT value: {{ .Values.worker.healthPort | quote }} livenessProbe: httpGet: path: /livez port: health initialDelaySeconds: {{ .Values.worker.probes.liveness.initialDelaySeconds }} periodSeconds: {{ .Values.worker.probes.liveness.periodSeconds }} timeoutSeconds: {{ .Values.worker.probes.liveness.timeoutSeconds }} failureThreshold: {{ .Values.worker.probes.liveness.failureThreshold }} readinessProbe: httpGet: path: /readyz port: health initialDelaySeconds: {{ .Values.worker.probes.readiness.initialDelaySeconds }} periodSeconds: {{ .Values.worker.probes.readiness.periodSeconds }} timeoutSeconds: {{ .Values.worker.probes.readiness.timeoutSeconds }} failureThreshold: {{ .Values.worker.probes.readiness.failureThreshold }} {{- with .Values.worker.resources }} resources: {{- tpl ( . | toYaml) $ | nindent 12 }} {{- end }} {{- end }}