blob: e7e8e52f6985387d3c009d75bee5ebe50dbce39c [file] [log] [blame]
Grzegorz-Lis4fad3022020-07-31 10:18:21 +02001apiVersion: apps/v1
Chenfei Gao9292e882019-02-27 22:14:45 -05002kind: Deployment
Andreas Geisslerf10c5552023-03-21 18:09:46 +01003metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
Chenfei Gao9292e882019-02-27 22:14:45 -05004spec:
Andreas Geisslerf10c5552023-03-21 18:09:46 +01005 selector: {{- include "common.selectors" . | nindent 4 }}
Chenfei Gao9292e882019-02-27 22:14:45 -05006 replicas: {{ .Values.replicaCount }}
7 template:
Andreas Geisslerf10c5552023-03-21 18:09:46 +01008 metadata: {{- include "common.templateMetadata" . | nindent 6 }}
Chenfei Gao9292e882019-02-27 22:14:45 -05009 spec:
Chenfei Gao8fdac3a2019-04-12 14:39:40 -040010 initContainers:
11 - command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020012 - /app/ready.py
Chenfei Gao8fdac3a2019-04-12 14:39:40 -040013 args:
jhhd4258672020-08-09 12:08:08 -050014 - --job-name
saul.gillef208b02023-04-26 16:16:05 +010015{{ if not .Values.global.postgres.localCluster }}
jhhd4258672020-08-09 12:08:08 -050016 - {{ include "common.release" . }}-policy-galera-config
saul.gillef208b02023-04-26 16:16:05 +010017{{ else }}
18 - {{ include "common.release" . }}-policy-pg-config
19{{ end }}
Chenfei Gao8fdac3a2019-04-12 14:39:40 -040020 env:
21 - name: NAMESPACE
22 valueFrom:
23 fieldRef:
24 apiVersion: v1
25 fieldPath: metadata.namespace
Sylvain Desbureaux7c8c6862020-11-19 18:02:37 +010026 image: {{ include "repositoryGenerator.image.readiness" . }}
Chenfei Gao8fdac3a2019-04-12 14:39:40 -040027 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
28 name: {{ include "common.name" . }}-readiness
Andreas Geissler47537432024-02-27 08:55:23 +010029 resources:
30 limits:
31 cpu: "100m"
32 memory: "0.5Gi"
33 requests:
34 cpu: "3m"
35 memory: "0.02Gi"
Krzysztof Opasiak09d1b312020-03-31 23:44:22 +020036 - command:
37 - sh
38 args:
39 - -c
Taka Choebd62952020-10-08 13:50:09 -040040 - "cd /config-input && for PFILE in `ls -1`; do envsubst <${PFILE} >/config/${PFILE}; done"
Krzysztof Opasiak09d1b312020-03-31 23:44:22 +020041 env:
42 - name: SQL_USER
Dominik Mizyn11038102020-04-14 17:14:42 +020043 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-creds" "key" "login") | indent 12 }}
Krzysztof Opasiak09d1b312020-03-31 23:44:22 +020044 - name: SQL_PASSWORD
Dominik Mizyn11038102020-04-14 17:14:42 +020045 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-creds" "key" "password") | indent 12 }}
46 - name: RESTSERVER_USER
47 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restserver-creds" "key" "login") | indent 12 }}
48 - name: RESTSERVER_PASSWORD
49 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restserver-creds" "key" "password") | indent 12 }}
Krzysztof Opasiak09d1b312020-03-31 23:44:22 +020050 volumeMounts:
51 - mountPath: /config-input
52 name: apiconfig
53 - mountPath: /config
54 name: apiconfig-processed
Sylvain Desbureaux7c8c6862020-11-19 18:02:37 +010055 image: {{ include "repositoryGenerator.image.envsubst" . }}
Krzysztof Opasiak09d1b312020-03-31 23:44:22 +020056 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
57 name: {{ include "common.name" . }}-update-config
Chenfei Gao9292e882019-02-27 22:14:45 -050058 containers:
59 - name: {{ include "common.name" . }}
Sylvain Desbureaux7c8c6862020-11-19 18:02:37 +010060 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Chenfei Gao9292e882019-02-27 22:14:45 -050061 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
62 command: ["/opt/app/policy/api/bin/policy-api.sh"]
a.sreekumar2f377362022-02-09 12:40:57 +000063 args: ["/opt/app/policy/api/etc/mounted/apiParameters.yaml"]
Andreas Geisslerf10c5552023-03-21 18:09:46 +010064 ports: {{ include "common.containerPorts" . | nindent 12 }}
Chenfei Gao9292e882019-02-27 22:14:45 -050065 # disable liveness probe when breakpoints set in debugger
66 # so K8s doesn't restart unresponsive container
67 {{- if eq .Values.liveness.enabled true }}
68 livenessProbe:
69 tcpSocket:
70 port: {{ .Values.service.internalPort }}
71 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
72 periodSeconds: {{ .Values.liveness.periodSeconds }}
73 {{ end -}}
74 readinessProbe:
a.sreekumar2f377362022-02-09 12:40:57 +000075 httpGet:
76 path: {{ .Values.readiness.api }}
Chenfei Gao9292e882019-02-27 22:14:45 -050077 port: {{ .Values.service.internalPort }}
a.sreekumar2f377362022-02-09 12:40:57 +000078 httpHeaders:
79 - name: Authorization
80 value: Basic {{ printf "%s:%s" .Values.restServer.user .Values.restServer.password | b64enc }}
Andreas Geisslerf10c5552023-03-21 18:09:46 +010081 scheme: HTTP
a.sreekumar2f377362022-02-09 12:40:57 +000082 successThreshold: {{ .Values.readiness.successThreshold }}
83 failureThreshold: {{ .Values.readiness.failureThreshold }}
Chenfei Gao9292e882019-02-27 22:14:45 -050084 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
85 periodSeconds: {{ .Values.readiness.periodSeconds }}
a.sreekumar2f377362022-02-09 12:40:57 +000086 timeoutSeconds: {{ .Values.readiness.timeout }}
Chenfei Gao9292e882019-02-27 22:14:45 -050087 volumeMounts:
88 - mountPath: /etc/localtime
89 name: localtime
90 readOnly: true
91 - mountPath: /opt/app/policy/api/etc/mounted
Krzysztof Opasiak09d1b312020-03-31 23:44:22 +020092 name: apiconfig-processed
miroslavmasaryka7ac7f02023-03-01 14:12:26 +010093 resources: {{ include "common.resources" . | nindent 12 }}
Chenfei Gao9292e882019-02-27 22:14:45 -050094 {{- if .Values.nodeSelector }}
95 nodeSelector:
96{{ toYaml .Values.nodeSelector | indent 10 }}
97 {{- end -}}
98 {{- if .Values.affinity }}
99 affinity:
100{{ toYaml .Values.affinity | indent 10 }}
101 {{- end }}
farida azmyc1178372021-04-11 12:55:33 +0200102 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
Chenfei Gao9292e882019-02-27 22:14:45 -0500103 volumes:
104 - name: localtime
105 hostPath:
106 path: /etc/localtime
107 - name: apiconfig
108 configMap:
109 name: {{ include "common.fullname" . }}-configmap
110 defaultMode: 0755
Krzysztof Opasiak09d1b312020-03-31 23:44:22 +0200111 - name: apiconfig-processed
112 emptyDir:
113 medium: Memory
Chenfei Gao9292e882019-02-27 22:14:45 -0500114 imagePullSecrets:
saul.gillef208b02023-04-26 16:16:05 +0100115 - name: "{{ include "common.namespace" . }}-docker-registry-key"