| gio | c916187 | 2024-04-21 10:46:35 +0400 | [diff] [blame^] | 1 | {{- range $workerName, $workerValues := .Values.workers }} |
| 2 | {{- with $ -}} |
| 3 | --- |
| 4 | apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }} |
| 5 | kind: Deployment |
| 6 | metadata: |
| 7 | name: {{ include "common.names.fullname" . }}-worker-{{ $workerName }} |
| 8 | labels: |
| 9 | {{- include "common.labels.standard" . | nindent 4 }} |
| 10 | openproject/process: worker-{{ $workerName }} |
| 11 | spec: |
| 12 | replicas: {{( kindIs "invalid" $workerValues.replicaCount) | ternary .Values.backgroundReplicaCount $workerValues.replicaCount }} |
| 13 | strategy: |
| 14 | {{ coalesce $workerValues.strategy .Values.strategy | toYaml | nindent 4 }} |
| 15 | selector: |
| 16 | matchLabels: |
| 17 | {{- include "common.labels.matchLabels" . | nindent 6 }} |
| 18 | openproject/process: worker-{{ $workerName }} |
| 19 | template: |
| 20 | metadata: |
| 21 | annotations: |
| 22 | {{- range $key, $val := .Values.podAnnotations }} |
| 23 | {{ $key }}: {{ $val | quote }} |
| 24 | {{- end }} |
| 25 | {{- include "openproject.envChecksums" . | nindent 8 }} |
| 26 | labels: |
| 27 | {{- include "common.labels.standard" . | nindent 8 }} |
| 28 | openproject/process: worker-{{ $workerName }} |
| 29 | spec: |
| 30 | {{- include "openproject.imagePullSecrets" . | indent 6 }} |
| 31 | {{- with .Values.affinity }} |
| 32 | affinity: |
| 33 | {{ toYaml . | nindent 8 | trim }} |
| 34 | {{- end }} |
| 35 | {{- with .Values.tolerations }} |
| 36 | tolerations: |
| 37 | {{ toYaml . | nindent 8 | trim }} |
| 38 | {{- end }} |
| 39 | {{- with .Values.nodeSelector }} |
| 40 | nodeSelector: |
| 41 | {{ toYaml . | nindent 8 | trim }} |
| 42 | {{- end }} |
| 43 | {{- include "openproject.podSecurityContext" . | indent 6 }} |
| 44 | serviceAccountName: {{ include "common.names.fullname" . }} |
| 45 | volumes: |
| 46 | {{- include "openproject.tmpVolumeSpec" . | indent 8 }} |
| 47 | {{- if .Values.egress.tls.rootCA.fileName }} |
| 48 | - name: ca-pemstore |
| 49 | configMap: |
| 50 | name: "{{- .Values.egress.tls.rootCA.configMap }}" |
| 51 | {{- end }} |
| 52 | {{- if .Values.persistence.enabled }} |
| 53 | - name: "data" |
| 54 | persistentVolumeClaim: |
| 55 | claimName: {{ include "common.names.fullname" . }} |
| 56 | {{- end }} |
| 57 | initContainers: |
| 58 | - name: wait-for-db |
| 59 | {{- include "openproject.containerSecurityContext" . | indent 10 }} |
| 60 | image: {{ include "openproject.image" . }} |
| 61 | imagePullPolicy: {{ .Values.image.imagePullPolicy }} |
| 62 | envFrom: |
| 63 | {{- include "openproject.envFrom" . | nindent 12 }} |
| 64 | env: |
| 65 | {{- include "openproject.env" . | nindent 12 }} |
| 66 | command: |
| 67 | - bash |
| 68 | - /app/docker/prod/wait-for-db |
| 69 | containers: |
| 70 | - name: "openproject" |
| 71 | {{- include "openproject.containerSecurityContext" . | indent 10 }} |
| 72 | image: {{ include "openproject.image" . }} |
| 73 | imagePullPolicy: {{ .Values.image.imagePullPolicy }} |
| 74 | envFrom: |
| 75 | {{- include "openproject.envFrom" . | nindent 12 }} |
| 76 | command: |
| 77 | - bash |
| 78 | - /app/docker/prod/worker |
| 79 | env: |
| 80 | {{- include "openproject.env" . | nindent 12 }} |
| 81 | - name: "QUEUE" |
| 82 | value: "{{ $workerValues.queues }}" |
| 83 | volumeMounts: |
| 84 | {{- include "openproject.tmpVolumeMounts" . | indent 12 }} |
| 85 | {{- if .Values.persistence.enabled }} |
| 86 | - name: "data" |
| 87 | mountPath: "/var/openproject/assets" |
| 88 | {{- end }} |
| 89 | {{- if .Values.egress.tls.rootCA.fileName }} |
| 90 | - name: ca-pemstore |
| 91 | mountPath: /etc/ssl/certs/custom-ca.pem |
| 92 | subPath: {{ .Values.egress.tls.rootCA.fileName }} |
| 93 | readOnly: false |
| 94 | {{- end }} |
| 95 | resources: |
| 96 | {{- coalesce $workerValues.resources .Values.resources | toYaml | nindent 12 }} |
| 97 | {{- end }} |
| 98 | {{ end }} |