blob: 2c31411f877e6ca24c5f3a71825a02de7f0b7d1c [file] [log] [blame]
Jakub Latuseke0e8ca72020-10-21 13:36:29 +02001{{/*
Alexander Dehn9b797d62020-04-21 09:53:50 +00002# Copyright © 2020 highstreet technologies GmbH
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
Jakub Latuseke0e8ca72020-10-21 13:36:29 +020015*/}}
Alexander Dehn9b797d62020-04-21 09:53:50 +000016{{ if .Values.config.sdnr.enabled -}}
17apiVersion: batch/v1
18kind: Job
19metadata: {{- include "common.resourceMetadata" (dict "suffix" "sdnrdb-init-job" "dot" . ) | nindent 2 }}
20spec:
21 backoffLimit: 20
22 template:
23 metadata: {{ include "common.templateMetadata" . | indent 6}}
24 spec:
25 initContainers:
Alexander Dehn9b797d62020-04-21 09:53:50 +000026 - name: {{ include "common.name" . }}-readiness
27 command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020028 - /app/ready.py
Alexander Dehn9b797d62020-04-21 09:53:50 +000029 args:
demskeq84e1f84c2023-07-04 08:39:43 +000030 {{- if .Values.config.sdnr.mariadb.enabled }}
Andreas Geisslercfd84342023-08-16 17:18:49 +020031 - --app-name
32 - {{ include "common.mariadbAppName" . }}
33 {{- else }}
Alexander Dehn9b797d62020-04-21 09:53:50 +000034 - --container-name
35 - {{.Values.elasticsearch.nameOverride}}-elasticsearch
36 - --container-name
37 - {{.Values.elasticsearch.nameOverride}}-nginx
38 - --container-name
39 - {{.Values.elasticsearch.nameOverride}}-master
demskeq84e1f84c2023-07-04 08:39:43 +000040 {{- end }}
Alexander Dehn9b797d62020-04-21 09:53:50 +000041 env:
42 - name: NAMESPACE
43 valueFrom:
44 fieldRef:
45 apiVersion: v1
46 fieldPath: metadata.namespace
Sylvain Desbureauxcbc703c2020-11-19 17:52:07 +010047 image: {{ include "repositoryGenerator.image.readiness" . }}
Alexander Dehn9b797d62020-04-21 09:53:50 +000048 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Andreas Geissler47537432024-02-27 08:55:23 +010049 resources:
50 limits:
51 cpu: "100m"
Andreas Geissler8cbb3d92024-03-12 16:44:56 +010052 memory: "500Mi"
Andreas Geissler47537432024-02-27 08:55:23 +010053 requests:
54 cpu: "3m"
Andreas Geissler8cbb3d92024-03-12 16:44:56 +010055 memory: "20Mi"
Alexander Dehn9b797d62020-04-21 09:53:50 +000056 containers:
57 - name: {{ include "common.name" . }}-sdnrdb-init-job
Sylvain Desbureauxcbc703c2020-11-19 17:52:07 +010058 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Alexander Dehn9b797d62020-04-21 09:53:50 +000059 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
60 command: ["/bin/bash"]
Radoslaw Chmiel58662a32022-06-02 19:37:35 +020061 args:
62 - -c
63 - |
demskeq84e1f84c2023-07-04 08:39:43 +000064 {{- if .Values.config.sdnr.mariadb.enabled }}
65 "{{ .Values.config.binDir }}/createSdnrDb.sh";
Andreas Geisslercfd84342023-08-16 17:18:49 +020066 {{- end }}
Radoslaw Chmiel58662a32022-06-02 19:37:35 +020067 sleep 90; "{{ .Values.config.binDir }}/startODL.sh"
Alexander Dehn9b797d62020-04-21 09:53:50 +000068 env:
69 - name: SDNC_AAF_ENABLED
Andreas Geissler2af50792023-03-27 17:11:27 +020070 value: "false"
Alexander Dehn9b797d62020-04-21 09:53:50 +000071 - name: SDNC_HOME
72 value: "{{.Values.config.sdncHome}}"
73 - name: ETC_DIR
74 value: "{{.Values.config.etcDir}}"
75 - name: BIN_DIR
76 value: "{{.Values.config.binDir}}"
77 ## start sdnrdb parameter
78 - name: SDNRINIT
79 value: "true"
demskeq84e1f84c2023-07-04 08:39:43 +000080 {{- if .Values.config.sdnr.mariadb.enabled }}
81 - name: SDNRDBTYPE
82 value: MARIADB
83 - name: MYSQL_HOST
84 value: {{ include "common.mariadbService" . }}
85 - name: MYSQL_ROOT_PASSWORD
86 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-root-password" "key" "password") | indent 12 }}
87 - name: SDNRDBURL
88 value: "jdbc:mysql://{{ include "common.mariadbService" . }}:3306/{{ .Values.config.sdnr.mariadb.databaseName }}"
89 - name: SDNRDBDATABASE
90 value: "{{ .Values.config.sdnr.mariadb.databaseName }}"
91 - name: SDNRDBUSERNAME
92 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdnrdb-secret" "key" "login") | indent 12 }}
93 - name: SDNRDBPASSWORD
94 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdnrdb-secret" "key" "password") | indent 12 }}
Andreas Geisslercfd84342023-08-16 17:18:49 +020095 {{- else }}
Alexander Dehn9b797d62020-04-21 09:53:50 +000096 - name: SDNRDBURL
Alexander Dehn9b797d62020-04-21 09:53:50 +000097 value: "http://{{ .Values.elasticsearch.service.name | default "sdnrdb"}}.{{.Release.Namespace}}:{{.Values.elasticsearch.service.port | default "9200"}}"
Alexander Dehn9b797d62020-04-21 09:53:50 +000098 - name: SDNRDBPARAMETER
99 value: "-k"
Andreas Geisslercfd84342023-08-16 17:18:49 +0200100 {{- end }}
demskeq84e1f84c2023-07-04 08:39:43 +0000101 {{- if .Values.config.sdnr.mariadb.enabled }}
102 volumeMounts:
103 - mountPath: {{ .Values.config.binDir }}/createSdnrDb.sh
104 name: bin
105 subPath: createSdnrDb.sh
106 {{- end }}
miroslavmasaryka7ac7f02023-03-01 14:12:26 +0100107 resources: {{ include "common.resources" . | nindent 10 }}
Radoslaw Chmiel58662a32022-06-02 19:37:35 +0200108 {{- if include "common.onServiceMesh" . }}
109 - name: sdnrdb-service-mesh-wait-for-job-container
110 image: {{ include "repositoryGenerator.image.quitQuit" . }}
111 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
112 command:
113 - /bin/sh
114 - "-c"
115 args:
116 - |
117 echo "waiting 30s for istio side cars to be up"; sleep 30s;
118 /app/ready.py --service-mesh-check sdnc-sdnrdb-init-job -t 45;
119 env:
120 - name: NAMESPACE
121 valueFrom:
122 fieldRef:
123 apiVersion: v1
124 fieldPath: metadata.namespace
125 {{- end }}
Alexander Dehn9b797d62020-04-21 09:53:50 +0000126 {{- if .Values.nodeSelector }}
127 nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }}
128 {{- end -}}
129 {{- if .Values.affinity }}
130 affinity: {{ toYaml .Values.affinity | nindent 10 }}
131 {{- end }}
vladimir turokd8044182023-07-27 16:28:36 +0200132 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
Alexander Dehn9b797d62020-04-21 09:53:50 +0000133 volumes:
134 - name: localtime
135 hostPath:
136 path: /etc/localtime
137 - name: docker-entrypoint-initdb-d
138 emptyDir: {}
139 - name: bin
140 configMap:
141 name: {{ include "common.fullname" . }}-bin
142 defaultMode: 0755
143 - name: properties
144 configMap:
145 name: {{ include "common.fullname" . }}-properties
146 defaultMode: 0644
Alexander Dehn9b797d62020-04-21 09:53:50 +0000147 restartPolicy: Never
Andreas Geisslerbd0d31a2024-03-20 09:51:32 +0100148 {{- include "common.imagePullSecrets" . | nindent 6 }}
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +0200149{{ end -}}