blob: a36b97d39c19afae0ec000b15eec5f9d3f411901 [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:
30 - --container-name
31 - {{.Values.elasticsearch.nameOverride}}-elasticsearch
32 - --container-name
33 - {{.Values.elasticsearch.nameOverride}}-nginx
34 - --container-name
35 - {{.Values.elasticsearch.nameOverride}}-master
36 env:
37 - name: NAMESPACE
38 valueFrom:
39 fieldRef:
40 apiVersion: v1
41 fieldPath: metadata.namespace
Sylvain Desbureauxcbc703c2020-11-19 17:52:07 +010042 image: {{ include "repositoryGenerator.image.readiness" . }}
Alexander Dehn9b797d62020-04-21 09:53:50 +000043 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
44 containers:
45 - name: {{ include "common.name" . }}-sdnrdb-init-job
Sylvain Desbureauxcbc703c2020-11-19 17:52:07 +010046 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Alexander Dehn9b797d62020-04-21 09:53:50 +000047 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
48 command: ["/bin/bash"]
Radoslaw Chmiel58662a32022-06-02 19:37:35 +020049 args:
50 - -c
51 - |
52 sleep 90; "{{ .Values.config.binDir }}/startODL.sh"
Alexander Dehn9b797d62020-04-21 09:53:50 +000053 env:
54 - name: SDNC_AAF_ENABLED
Andreas Geissler2af50792023-03-27 17:11:27 +020055 value: "false"
Alexander Dehn9b797d62020-04-21 09:53:50 +000056 - name: SDNC_HOME
57 value: "{{.Values.config.sdncHome}}"
58 - name: ETC_DIR
59 value: "{{.Values.config.etcDir}}"
60 - name: BIN_DIR
61 value: "{{.Values.config.binDir}}"
62 ## start sdnrdb parameter
63 - name: SDNRINIT
64 value: "true"
65 - name: SDNRDBURL
Alexander Dehn9b797d62020-04-21 09:53:50 +000066 value: "http://{{ .Values.elasticsearch.service.name | default "sdnrdb"}}.{{.Release.Namespace}}:{{.Values.elasticsearch.service.port | default "9200"}}"
Alexander Dehn9b797d62020-04-21 09:53:50 +000067 - name: SDNRDBPARAMETER
68 value: "-k"
miroslavmasaryka7ac7f02023-03-01 14:12:26 +010069 resources: {{ include "common.resources" . | nindent 10 }}
Radoslaw Chmiel58662a32022-06-02 19:37:35 +020070 {{- if include "common.onServiceMesh" . }}
71 - name: sdnrdb-service-mesh-wait-for-job-container
72 image: {{ include "repositoryGenerator.image.quitQuit" . }}
73 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
74 command:
75 - /bin/sh
76 - "-c"
77 args:
78 - |
79 echo "waiting 30s for istio side cars to be up"; sleep 30s;
80 /app/ready.py --service-mesh-check sdnc-sdnrdb-init-job -t 45;
81 env:
82 - name: NAMESPACE
83 valueFrom:
84 fieldRef:
85 apiVersion: v1
86 fieldPath: metadata.namespace
87 {{- end }}
Alexander Dehn9b797d62020-04-21 09:53:50 +000088 {{- if .Values.nodeSelector }}
89 nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }}
90 {{- end -}}
91 {{- if .Values.affinity }}
92 affinity: {{ toYaml .Values.affinity | nindent 10 }}
93 {{- end }}
94 volumes:
95 - name: localtime
96 hostPath:
97 path: /etc/localtime
98 - name: docker-entrypoint-initdb-d
99 emptyDir: {}
100 - name: bin
101 configMap:
102 name: {{ include "common.fullname" . }}-bin
103 defaultMode: 0755
104 - name: properties
105 configMap:
106 name: {{ include "common.fullname" . }}-properties
107 defaultMode: 0644
Alexander Dehn9b797d62020-04-21 09:53:50 +0000108 restartPolicy: Never
109 imagePullSecrets:
110 - name: "{{ include "common.namespace" . }}-docker-registry-key"
111
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +0200112{{ end -}}