|
1 | 1 | {{- template "common.deployment" (list . "activiti.notifications.deployment") -}} |
2 | 2 | {{- define "activiti.notifications.deployment" -}} |
3 | 3 | spec: |
4 | | - replicas: {{ .Values.replicaCount }} |
5 | 4 | template: |
6 | 5 | spec: |
7 | | -{{- if include "common.registry-pull-secrets" . }} |
8 | | - imagePullSecrets: |
9 | | - {{- include "common.registry-pull-secrets" . | indent 6 }} |
10 | | -{{- end }} |
11 | | - containers: |
12 | | - - name: {{ .Chart.Name }} |
13 | | - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" |
14 | | - imagePullPolicy: {{ .Values.image.pullPolicy }} |
15 | | - env: |
16 | | - - name: JAVA_OPTS |
17 | | - value: "-Xmx{{ .Values.javaOpts.xmx }} -Xms{{ .Values.javaOpts.xms }} {{ .Values.javaOpts.other}}" |
18 | | - - name: SPRING_APPLICATION_NAME |
19 | | - value: {{ template "servicename" . }} |
20 | | - - name: SPRING_RABBITMQ_HOST |
21 | | - {{- if .Values.global.rabbitmq.host.value }} |
22 | | - value: {{ .Values.global.rabbitmq.host.value | quote }} |
23 | | - {{- else }} |
24 | | - value: "{{ .Release.Name }}-rabbitmq" |
25 | | - {{- end }} |
26 | | - - name: SPRING_RABBITMQ_USERNAME |
27 | | - value: {{ .Values.global.rabbitmq.username.value }} |
28 | | - - name: SPRING_RABBITMQ_PASSWORD |
29 | | - value: {{ .Values.global.rabbitmq.password.value }} |
30 | | - {{- if include "common.keycloak-enabled" $ }} |
31 | | - - name: ACT_KEYCLOAK_URL |
32 | | - value: {{ include "common.keycloak-url" $ | quote }} |
33 | | - {{- end }} |
34 | | - {{- if include "common.keycloak-realm" . }} |
35 | | - - name: ACT_KEYCLOAK_REALM |
36 | | - value: {{ include "common.keycloak-realm" . | quote }} |
37 | | - {{- end }} |
38 | | - {{- if include "common.keycloak-resource" . }} |
39 | | - - name: ACT_KEYCLOAK_RESOURCE |
40 | | - value: {{ include "common.keycloak-resource" . | quote }} |
41 | | - {{- end }} |
42 | | -{{- if .Values.postgres.enabled }} |
43 | | - - name: SPRING_DATASOURCE_URL |
44 | | - {{- if .Values.postgres.uri }} |
45 | | - value: {{ .Values.postgres.uri | quote }} |
46 | | - {{- else }} |
47 | | - value: "jdbc:postgresql://{{ .Release.Name }}-{{ .Values.postgres.name }}:{{ .Values.postgres.port }}/postgres" |
48 | | - {{- end }} |
49 | | - - name: SPRING_DATASOURCE_DRIVER_CLASS_NAME |
50 | | - value: {{ default "org.postgresql.Driver" .Values.postgres.driver | quote }} |
51 | | - - name: SPRING_DATASOURCE_USERNAME |
52 | | - value: {{ default "postgres" .Values.postgres.username | quote }} |
53 | | - - name: SPRING_DATASOURCE_PASSWORD |
54 | | - {{- if .Values.postgres.password }} |
55 | | - value: {{ .Values.db.password | quote}} |
56 | | - {{- else }} |
57 | | - valueFrom: |
58 | | - secretKeyRef: |
59 | | - name: {{ .Release.Name }}-{{ .Values.postgres.name }} |
60 | | - key: postgresql-password |
61 | | - {{- end }} |
62 | | - - name: SPRING_JPA_DATABASE_PLATFORM |
63 | | - value: {{ default "org.hibernate.dialect.PostgreSQLDialect" .Values.postgres.platform | quote }} |
64 | | - - name: SPRING_JPA_GENERATE_DDL |
65 | | - value: {{ default "true" .Values.postgres.generateDdl | quote }} |
66 | | - - name: SPRING_JPA_HIBERNATE_DDL_AUTO |
67 | | - value: {{ default "update" .Values.postgres.ddlAuto | quote}} |
68 | | -{{- else }} |
69 | | - {{- if .Values.db.uri }} |
70 | | - - name: SPRING_DATASOURCE_URL |
71 | | - value: {{ .Values.db.uri | quote }} |
72 | | - {{- end }} |
73 | | - {{- if .Values.db.driver }} |
74 | | - - name: SPRING_DATASOURCE_DRIVER_CLASS_NAME |
75 | | - value: {{ .Values.db.driver | quote }} |
76 | | - {{- end }} |
77 | | - {{- if .Values.db.username }} |
78 | | - - name: SPRING_DATASOURCE_USERNAME |
79 | | - value: {{ .Values.db.username | quote }} |
80 | | - {{- end }} |
81 | | - {{- if .Values.db.password }} |
82 | | - - name: SPRING_DATASOURCE_PASSWORD |
83 | | - value: {{ .Values.db.password | quote}} |
84 | | - {{- end }} |
85 | | - {{- if .Values.db.platform }} |
86 | | - - name: SPRING_JPA_DATABASE_PLATFORM |
87 | | - value: {{ .Values.db.platform | quote}} |
88 | | - {{- end }} |
89 | | - {{- if .Values.db.generateDdl }} |
90 | | - - name: SPRING_JPA_GENERATE_DDL |
91 | | - value: {{ .Values.db.generateDdl | quote }} |
92 | | - {{- end }} |
93 | | - {{- if .Values.db.ddlAuto }} |
94 | | - - name: SPRING_JPA_HIBERNATE_DDL_AUTO |
95 | | - value: {{ default "update" .Values.db.ddlAuto | quote }} |
96 | | - {{- end }} |
97 | | -{{- end }} |
98 | | - {{- if include "common.ingress-path" . }} |
99 | | - - name: SERVER_SERVLET_CONTEXTPATH |
100 | | - value: {{ include "common.ingress-path" . | quote }} |
101 | | - {{- end }} |
102 | | - - name: ACT_CLOUD_CONFIG_SERVER_ENABLED |
103 | | - value: "false" |
104 | | -{{ include "common.extra-env" . | indent 8 }} |
105 | | - ports: |
106 | | - - containerPort: {{ .Values.service.internalPort }} |
107 | | - livenessProbe: |
108 | | - httpGet: |
109 | | - path: {{ tpl .Values.probePath . }} |
110 | | - port: {{ .Values.service.internalPort }} |
111 | | - initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} |
112 | | - periodSeconds: {{ .Values.livenessProbe.periodSeconds }} |
113 | | - successThreshold: {{ .Values.livenessProbe.successThreshold }} |
114 | | - timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} |
115 | | - failureThreshold: {{ .Values.livenessProbe.failureThreshold }} |
116 | | - readinessProbe: |
117 | | - httpGet: |
118 | | - path: {{ tpl .Values.probePath . }} |
119 | | - port: {{ .Values.service.internalPort }} |
120 | | - initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} |
121 | | - periodSeconds: {{ .Values.readinessProbe.periodSeconds }} |
122 | | - successThreshold: {{ .Values.readinessProbe.successThreshold }} |
123 | | - timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} |
124 | | - failureThreshold: {{ .Values.readinessProbe.failureThreshold }} |
125 | | - resources: |
126 | | -{{ toYaml .Values.resources | indent 12 }} |
127 | | - terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }} |
| 6 | + initContainers: |
| 7 | + {{- if .Values.postgres.enabled }} |
| 8 | + - name: wait-for-postgresql |
| 9 | + image: {{ .Values.init.container.image | quote }} |
| 10 | + imagePullPolicy: {{ .Values.init.container.imagePullPolicy }} |
| 11 | + command: |
| 12 | + - sh |
| 13 | + - -c |
| 14 | + - | |
| 15 | + until printf "." && nc -z -w 2 {{ .Release.Name }}-{{ .Values.postgres.name }} {{ .Values.postgres.port }}; do |
| 16 | + sleep 2; |
| 17 | + done; |
| 18 | + echo 'PostgreSQL OK ✓' |
| 19 | + {{- end }} |
| 20 | + {{- if .Values.rabbitmq.enabled }} |
| 21 | + - name: wait-for-rabbitmq |
| 22 | + image: {{ .Values.init.container.image | quote }} |
| 23 | + imagePullPolicy: {{ .Values.init.container.imagePullPolicy }} |
| 24 | + command: |
| 25 | + - sh |
| 26 | + - -c |
| 27 | + - | |
| 28 | + until printf "." && nc -z -w 2 {{ include "notifications.rabbitmq-name" . }} {{ .Values.rabbitmq.port | default 5672 }}; do |
| 29 | + sleep 2; |
| 30 | + done; |
| 31 | + echo 'RabbitMq OK ✓' |
| 32 | + {{- end }} |
| 33 | + {{- if .Values.extraInitContainers }} |
| 34 | +{{ tpl .Values.extraInitContainers . | indent 8 }} |
| 35 | + {{- end }} |
128 | 36 | {{- end -}} |
0 commit comments