blob: 5aaae2a2a337fbaadde6d6262646e7567c6ae6a3 [file] [log] [blame]
Alexander Dehn9b797d62020-04-21 09:53:50 +00001{{- if .Values.dgbuilder.enabled -}}
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +01002{{/*
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -04003# Copyright © 2017 Amdocs, Bell Canada, AT&T
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010016*/}}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -040017
18apiVersion: batch/v1
19kind: Job
20metadata:
21 name: {{ include "common.fullname" . }}-dbinit-job
22 namespace: {{ include "common.namespace" . }}
23 labels:
24 app: {{ include "common.name" . }}
25 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010026 release: {{ include "common.release" . }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -040027 heritage: {{ .Release.Service }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -040028spec:
29 backoffLimit: 20
30 template:
31 metadata:
32 labels:
33 app: {{ include "common.name" . }}-job
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010034 release: {{ include "common.release" . }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -040035 name: {{ include "common.name" . }}
36 spec:
37 initContainers:
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010038 - command:
39 - sh
40 args:
41 - -c
42 - "cd /config-input && for PFILE in `ls -1 .`; do envsubst <${PFILE} >/config/${PFILE}; done"
43 env:
44 - name: AAI_CLIENT_NAME
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010045 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "aai-user-creds" "key" "login") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010046 - name: AAI_CLIENT_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010047 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "aai-user-creds" "key" "password") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010048 - name: MODELSERVICE_USER
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010049 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "modeling-user-creds" "key" "login") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010050 - name: MODELSERVICE_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010051 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "modeling-user-creds" "key" "password") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010052 - name: RESTCONF_USER
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010053 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restconf-creds" "key" "login") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010054 - name: RESTCONF_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010055 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restconf-creds" "key" "password") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010056 - name: ANSIBLE_USER
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010057 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "ansible-creds" "key" "login") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010058 - name: ANSIBLE_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010059 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "ansible-creds" "key" "password") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010060 - name: SCALEOUT_USER
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010061 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "scaleout-creds" "key" "login") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010062 - name: SCALEOUT_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010063 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "scaleout-creds" "key" "password") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010064 - name: NETBOX_APIKEY
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010065 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "netbox-apikey" "key" "password") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010066 - name: SDNC_DB_USER
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010067 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010068 - name: SDNC_DB_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010069 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010070 volumeMounts:
71 - mountPath: /config-input
72 name: config-input
73 - mountPath: /config
74 name: properties
Sylvain Desbureauxcbc703c2020-11-19 17:52:07 +010075 image: {{ include "repositoryGenerator.image.envsubst" . }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010076 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
77 name: {{ include "common.name" . }}-update-config
78
Andreas Geissler060bc372024-03-11 17:26:53 +010079 {{- if .Values.global.mariadbGalera.localCluster }}
80 {{- if .Values.global.mariadbGalera.useOperator }}
81 {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_local_operator ) | indent 6 | trim }}
82 {{ else }}
83 {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_local ) | indent 6 | trim }}
84 {{- end }}
85 {{ else }}
86 {{- if .Values.global.mariadbGalera.useOperator }}
87 {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_global_operator ) | indent 6 | trim }}
88 {{ else }}
89 {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_global ) | indent 6 | trim }}
90 {{- end }}
91 {{- end }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -040092 containers:
93 - name: {{ include "common.name" . }}
Sylvain Desbureauxcbc703c2020-11-19 17:52:07 +010094 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -040095 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
96 env:
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010097 - name: MYSQL_ROOT_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010098 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-root-password" "key" "password") | indent 12 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010099 - name: ODL_ADMIN_USERNAME
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +0100100 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "odl-creds" "key" "login") | indent 12 }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400101 - name: ODL_ADMIN_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +0100102 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "odl-creds" "key" "password") | indent 12 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100103 - name: SDNC_DB_USER
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +0100104 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 12 }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400105 - name: SDNC_DB_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +0100106 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 12 }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400107 - name: MYSQL_HOST
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100108 value: {{ include "common.mariadbService" . }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400109 - name: SDNC_HOME
110 value: "{{.Values.config.sdncHome}}"
111 - name: ETC_DIR
112 value: "{{.Values.config.etcDir}}"
113 - name: BIN_DIR
114 value: "{{.Values.config.binDir}}"
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400115 - name: SDNC_DB_DATABASE
116 value: "{{.Values.config.dbSdnctlDatabase}}"
117 volumeMounts:
118 - mountPath: {{ .Values.config.binDir }}/installSdncDb.sh
119 name: bin
120 subPath: installSdncDb.sh
121 - mountPath: {{ .Values.config.configDir }}/svclogic.properties
122 name: properties
123 subPath: svclogic.properties
124 - mountPath: /opt/onap/sdnc/svclogic/config/svclogic.properties
125 name: properties
126 subPath: svclogic.properties
127 - mountPath: {{ .Values.config.configDir }}/dblib.properties
128 name: properties
129 subPath: dblib.properties
130 command:
131 - /bin/bash
132 args:
Radoslaw Chmiel58662a32022-06-02 19:37:35 +0200133 - -c
134 - |
135 sleep 60; {{.Values.config.binDir }}/installSdncDb.sh
Satoshi Fujii54bfd172021-07-04 16:39:41 +0000136 resources: {{ include "common.resources" . | nindent 10 }}
Radoslaw Chmiel58662a32022-06-02 19:37:35 +0200137 {{- if include "common.onServiceMesh" . }}
138 - name: sdnc-service-mesh-wait-for-job-container
139 image: {{ include "repositoryGenerator.image.quitQuit" . }}
140 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
141 command:
142 - /bin/sh
143 - "-c"
144 args:
145 - |
146 echo "waiting 20s for istio side cars to be up"; sleep 20s;
147 /app/ready.py --service-mesh-check sdnc -t 45;
148 env:
149 - name: NAMESPACE
150 valueFrom:
151 fieldRef:
152 apiVersion: v1
153 fieldPath: metadata.namespace
154 {{- end }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400155 {{- if .Values.nodeSelector }}
Satoshi Fujii54bfd172021-07-04 16:39:41 +0000156 nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }}
157 {{- end }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400158 {{- if .Values.affinity }}
Satoshi Fujii54bfd172021-07-04 16:39:41 +0000159 affinity: {{ toYaml .Values.affinity | nindent 8 }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400160 {{- end }}
vladimir turokd8044182023-07-27 16:28:36 +0200161 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400162 volumes:
163 - name: localtime
164 hostPath:
165 path: /etc/localtime
166 - name: docker-entrypoint-initdb-d
167 emptyDir: {}
168 - name: bin
169 configMap:
170 name: {{ include "common.fullname" . }}-bin
171 defaultMode: 0755
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100172 - name: config-input
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400173 configMap:
174 name: {{ include "common.fullname" . }}-properties
175 defaultMode: 0644
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100176 - name: properties
177 emptyDir:
178 medium: Memory
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400179 restartPolicy: Never
Andreas Geisslerbd0d31a2024-03-20 09:51:32 +0100180 {{- include "common.imagePullSecrets" . | nindent 6 }}
Alexander Dehn9b797d62020-04-21 09:53:50 +0000181{{- end -}}