blob: afe0e72f157a7379bb767a5862b0b6dcad99586f [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
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -040079 - name: {{ include "common.name" . }}-readiness
80 command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020081 - /app/ready.py
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -040082 args:
Andreas Geisslercfd84342023-08-16 17:18:49 +020083 - --app-name
84 - {{ include "common.mariadbAppName" . }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -040085 env:
86 - name: NAMESPACE
87 valueFrom:
88 fieldRef:
89 apiVersion: v1
90 fieldPath: metadata.namespace
Sylvain Desbureauxcbc703c2020-11-19 17:52:07 +010091 image: {{ include "repositoryGenerator.image.readiness" . }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -040092 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
93 containers:
94 - name: {{ include "common.name" . }}
Sylvain Desbureauxcbc703c2020-11-19 17:52:07 +010095 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -040096 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
97 env:
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010098 - name: MYSQL_ROOT_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010099 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-root-password" "key" "password") | indent 12 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100100 - name: ODL_ADMIN_USERNAME
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +0100101 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "odl-creds" "key" "login") | indent 12 }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400102 - name: ODL_ADMIN_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +0100103 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "odl-creds" "key" "password") | indent 12 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100104 - name: SDNC_DB_USER
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +0100105 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 12 }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400106 - name: SDNC_DB_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +0100107 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 12 }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400108 - name: MYSQL_HOST
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100109 value: {{ include "common.mariadbService" . }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400110 - name: SDNC_HOME
111 value: "{{.Values.config.sdncHome}}"
112 - name: ETC_DIR
113 value: "{{.Values.config.etcDir}}"
114 - name: BIN_DIR
115 value: "{{.Values.config.binDir}}"
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400116 - name: SDNC_DB_DATABASE
117 value: "{{.Values.config.dbSdnctlDatabase}}"
118 volumeMounts:
119 - mountPath: {{ .Values.config.binDir }}/installSdncDb.sh
120 name: bin
121 subPath: installSdncDb.sh
122 - mountPath: {{ .Values.config.configDir }}/svclogic.properties
123 name: properties
124 subPath: svclogic.properties
125 - mountPath: /opt/onap/sdnc/svclogic/config/svclogic.properties
126 name: properties
127 subPath: svclogic.properties
128 - mountPath: {{ .Values.config.configDir }}/dblib.properties
129 name: properties
130 subPath: dblib.properties
131 command:
132 - /bin/bash
133 args:
Radoslaw Chmiel58662a32022-06-02 19:37:35 +0200134 - -c
135 - |
136 sleep 60; {{.Values.config.binDir }}/installSdncDb.sh
Satoshi Fujii54bfd172021-07-04 16:39:41 +0000137 resources: {{ include "common.resources" . | nindent 10 }}
Radoslaw Chmiel58662a32022-06-02 19:37:35 +0200138 {{- if include "common.onServiceMesh" . }}
139 - name: sdnc-service-mesh-wait-for-job-container
140 image: {{ include "repositoryGenerator.image.quitQuit" . }}
141 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
142 command:
143 - /bin/sh
144 - "-c"
145 args:
146 - |
147 echo "waiting 20s for istio side cars to be up"; sleep 20s;
148 /app/ready.py --service-mesh-check sdnc -t 45;
149 env:
150 - name: NAMESPACE
151 valueFrom:
152 fieldRef:
153 apiVersion: v1
154 fieldPath: metadata.namespace
155 {{- end }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400156 {{- if .Values.nodeSelector }}
Satoshi Fujii54bfd172021-07-04 16:39:41 +0000157 nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }}
158 {{- end }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400159 {{- if .Values.affinity }}
Satoshi Fujii54bfd172021-07-04 16:39:41 +0000160 affinity: {{ toYaml .Values.affinity | nindent 8 }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400161 {{- end }}
vladimir turokd8044182023-07-27 16:28:36 +0200162 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400163 volumes:
164 - name: localtime
165 hostPath:
166 path: /etc/localtime
167 - name: docker-entrypoint-initdb-d
168 emptyDir: {}
169 - name: bin
170 configMap:
171 name: {{ include "common.fullname" . }}-bin
172 defaultMode: 0755
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100173 - name: config-input
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400174 configMap:
175 name: {{ include "common.fullname" . }}-properties
176 defaultMode: 0644
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100177 - name: properties
178 emptyDir:
179 medium: Memory
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400180 restartPolicy: Never
181 imagePullSecrets:
182 - name: "{{ include "common.namespace" . }}-docker-registry-key"
Alexander Dehn9b797d62020-04-21 09:53:50 +0000183{{- end -}}