|
| 1 | +apiVersion: apps/v1 |
| 2 | +kind: Deployment |
| 3 | +metadata: |
| 4 | + name: {{ include "kobo.fullname" . }}-kpi-worker-long-running |
| 5 | + labels: |
| 6 | + app.kubernetes.io/component: kpi-worker-long-running |
| 7 | + {{- include "kobo.labels" . | nindent 4 }} |
| 8 | +spec: |
| 9 | + replicas: 1 |
| 10 | + selector: |
| 11 | + matchLabels: |
| 12 | + app.kubernetes.io/component: kpi-worker-long-running |
| 13 | + {{- include "kobo.selectorLabels" . | nindent 6 }} |
| 14 | + template: |
| 15 | + metadata: |
| 16 | + annotations: |
| 17 | + checksum/secret: {{ include (print $.Template.BasePath "/kpi/secrets.yaml") . | sha256sum }} |
| 18 | + checksum/configmap: {{ include (print $.Template.BasePath "/kpi/configmap.yaml") . | sha256sum }} |
| 19 | + tag: "{{ .Values.kpi.version }}" |
| 20 | + labels: |
| 21 | + app.kubernetes.io/component: kpi-worker-long-running |
| 22 | + {{- include "kobo.selectorLabels" . | nindent 8 }} |
| 23 | + spec: |
| 24 | + securityContext: |
| 25 | + {{- toYaml .Values.podSecurityContext | nindent 8 }} |
| 26 | + containers: |
| 27 | + - name: {{ .Chart.Name }} |
| 28 | + securityContext: |
| 29 | + {{- toYaml .Values.securityContext | nindent 12 }} |
| 30 | + image: "{{ .Values.kpi.image.repository }}:{{ .Values.kpi.version }}" |
| 31 | + imagePullPolicy: {{ .Values.kpi.image.pullPolicy }} |
| 32 | + {{- if .Values.kpi.workerLongRunning.livenessProbe}} |
| 33 | + livenessProbe: |
| 34 | + {{- .Values.kpi.workerLongRunning.livenessProbe | toYaml | nindent 12 }} |
| 35 | + {{- end }} |
| 36 | + resources: |
| 37 | + {{- toYaml .Values.kpi.workerLongRunning.resources | nindent 12 }} |
| 38 | + env: |
| 39 | + - name: POD_IP |
| 40 | + valueFrom: |
| 41 | + fieldRef: |
| 42 | + fieldPath: status.podIP |
| 43 | + {{- if .Values.postgresql.enabled }} |
| 44 | + - name: POSTGRES_PASSWORD |
| 45 | + valueFrom: |
| 46 | + secretKeyRef: |
| 47 | + name: {{ default (include "kobo.postgresql.fullname" .) .Values.postgresql.auth.existingSecret }} |
| 48 | + key: postgres-password |
| 49 | + - name: DATABASE_URL |
| 50 | + value: {{ (include "kobo.postgresql.url" .) }} |
| 51 | + - name: KC_DATABASE_URL |
| 52 | + value: {{ (include "kobo.postgresql.kc_url" .) }} |
| 53 | + {{- end }} |
| 54 | + {{- if .Values.mongodb.enabled }} |
| 55 | + - name: MONGODB_PASSWORD |
| 56 | + valueFrom: |
| 57 | + secretKeyRef: |
| 58 | + name: {{ default (include "kobo.mongodb.fullname" .) .Values.mongodb.auth.existingSecret }} |
| 59 | + key: mongodb-passwords |
| 60 | + - name: MONGO_DB_URL |
| 61 | + value: {{ (include "kobo.mongodb.url" .) }} |
| 62 | + {{- end }} |
| 63 | + {{- if .Values.redis.enabled }} |
| 64 | + - name: REDIS_PASSWORD |
| 65 | + valueFrom: |
| 66 | + secretKeyRef: |
| 67 | + name: {{ default (include "kobo.redis.fullname" .) .Values.redis.auth.existingSecret }} |
| 68 | + key: redis-password |
| 69 | + - name: ENKETO_REDIS_MAIN_URL |
| 70 | + value: {{ (include "kobo.redis.url" .) }}/0 |
| 71 | + - name: REDIS_SESSION_URL |
| 72 | + value: {{ (include "kobo.redis.url" .) }}/1 |
| 73 | + - name: SERVICE_ACCOUNT_BACKEND_URL |
| 74 | + value: {{ (include "kobo.redis.url" .) }}/6 |
| 75 | + - name: CELERY_BROKER_URL |
| 76 | + value: {{ (include "kobo.redis.url" .) }}/2 |
| 77 | + - name: CACHE_URL |
| 78 | + value: {{ (include "kobo.redis.url" .) }}/4 |
| 79 | + - name: CELERY_WORKER_AUTOSCALE |
| 80 | + value: {{ .Values.workerLongRunning.celeryAutoscale }} |
| 81 | + {{- end }} |
| 82 | + envFrom: |
| 83 | + - secretRef: |
| 84 | + name: {{ include "kobo.fullname" . }}-kpi |
| 85 | + - configMapRef: |
| 86 | + name: {{ include "kobo.fullname" . }}-kpi |
| 87 | + command: ["celery", "-A", "kobo", "worker", "--queues=kpi_long_running_tasks_queue", "-l", "info", "--hostname=kpi_main_worker@%h"] |
| 88 | + {{- with .Values.kpi.extraVolumeMounts }} |
| 89 | + volumeMounts: |
| 90 | + {{- toYaml . | nindent 10 }} |
| 91 | + {{- end }} |
| 92 | + {{- with .Values.kpi.workerLongRunning.nodeSelector }} |
| 93 | + nodeSelector: |
| 94 | + {{- toYaml . | nindent 8 }} |
| 95 | + {{- end }} |
| 96 | + {{- with .Values.kpi.workerLongRunning.affinity }} |
| 97 | + affinity: |
| 98 | + {{- toYaml . | nindent 8 }} |
| 99 | + {{- end }} |
| 100 | + {{- with .Values.kpi.workerLongRunning.tolerations }} |
| 101 | + tolerations: |
| 102 | + {{- toYaml . | nindent 8 }} |
| 103 | + {{- end }} |
| 104 | + {{- with .Values.kpi.extraVolumes }} |
| 105 | + volumes: |
| 106 | + {{- toYaml . | nindent 6 }} |
| 107 | + {{- end }} |
0 commit comments