blob: cb8d7574db128bd2198d6c89c33f63e371e53d80 [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:
26 {{ include "common.certInitializer.initContainer" . | indent 6 }}
27 {{ if .Values.global.aafEnabled }}
28 - name: {{ include "common.name" . }}-chown
Sylvain Desbureauxcbc703c2020-11-19 17:52:07 +010029 image: {{ include "repositoryGenerator.image.busybox" . }}
Alexander Dehn9b797d62020-04-21 09:53:50 +000030 command: ["sh", "-c", "chown -R {{ .Values.config.odlUid }}:{{ .Values.config.odlGid}} {{ .Values.certInitializer.credsPath }}"]
31 volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
32 {{ end }}
33 - name: {{ include "common.name" . }}-readiness
34 command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020035 - /app/ready.py
Alexander Dehn9b797d62020-04-21 09:53:50 +000036 args:
37 - --container-name
38 - {{.Values.elasticsearch.nameOverride}}-elasticsearch
39 - --container-name
40 - {{.Values.elasticsearch.nameOverride}}-nginx
41 - --container-name
42 - {{.Values.elasticsearch.nameOverride}}-master
43 env:
44 - name: NAMESPACE
45 valueFrom:
46 fieldRef:
47 apiVersion: v1
48 fieldPath: metadata.namespace
Sylvain Desbureauxcbc703c2020-11-19 17:52:07 +010049 image: {{ include "repositoryGenerator.image.readiness" . }}
Alexander Dehn9b797d62020-04-21 09:53:50 +000050 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
51 containers:
52 - name: {{ include "common.name" . }}-sdnrdb-init-job
Sylvain Desbureauxcbc703c2020-11-19 17:52:07 +010053 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Alexander Dehn9b797d62020-04-21 09:53:50 +000054 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
55 command: ["/bin/bash"]
Dan Timoney6d1973f2020-10-07 14:00:37 -040056 args: ["-c", "{{ .Values.config.binDir }}/startODL.sh"]
Alexander Dehn9b797d62020-04-21 09:53:50 +000057 env:
58 - name: SDNC_AAF_ENABLED
59 value: "{{ .Values.global.aafEnabled}}"
60 - name: SDNC_HOME
61 value: "{{.Values.config.sdncHome}}"
62 - name: ETC_DIR
63 value: "{{.Values.config.etcDir}}"
64 - name: BIN_DIR
65 value: "{{.Values.config.binDir}}"
66 ## start sdnrdb parameter
67 - name: SDNRINIT
68 value: "true"
69 - name: SDNRDBURL
70 {{ if .Values.global.aafEnabled -}}
71 value: "https://{{ .Values.elasticsearch.service.name | default "sdnrdb"}}.{{.Release.Namespace}}:{{.Values.elasticsearch.service.port | default "9200"}}"
72 {{- else -}}
73 value: "http://{{ .Values.elasticsearch.service.name | default "sdnrdb"}}.{{.Release.Namespace}}:{{.Values.elasticsearch.service.port | default "9200"}}"
74 {{- end }}
75 - name: SDNRDBPARAMETER
76 value: "-k"
77 volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
78 resources: {{ include "common.resources" . | nindent 12 }}
79 {{- if .Values.nodeSelector }}
80 nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }}
81 {{- end -}}
82 {{- if .Values.affinity }}
83 affinity: {{ toYaml .Values.affinity | nindent 10 }}
84 {{- end }}
85 volumes:
86 - name: localtime
87 hostPath:
88 path: /etc/localtime
89 - name: docker-entrypoint-initdb-d
90 emptyDir: {}
91 - name: bin
92 configMap:
93 name: {{ include "common.fullname" . }}-bin
94 defaultMode: 0755
95 - name: properties
96 configMap:
97 name: {{ include "common.fullname" . }}-properties
98 defaultMode: 0644
99{{ include "common.certInitializer.volumes" . | nindent 6 }}
100 restartPolicy: Never
101 imagePullSecrets:
102 - name: "{{ include "common.namespace" . }}-docker-registry-key"
103
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +0200104{{ end -}}