blob: 451c5b045380aeb442d38d10ac85257354ee630c [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 }}
Andreas Geissler47537432024-02-27 08:55:23 +010093 resources:
94 limits:
95 cpu: "100m"
96 memory: "0.5Gi"
97 requests:
98 cpu: "3m"
99 memory: "0.02Gi"
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400100 containers:
101 - name: {{ include "common.name" . }}
Sylvain Desbureauxcbc703c2020-11-19 17:52:07 +0100102 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400103 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
104 env:
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100105 - name: MYSQL_ROOT_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +0100106 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-root-password" "key" "password") | indent 12 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100107 - name: ODL_ADMIN_USERNAME
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +0100108 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "odl-creds" "key" "login") | indent 12 }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400109 - name: ODL_ADMIN_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +0100110 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "odl-creds" "key" "password") | indent 12 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100111 - name: SDNC_DB_USER
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +0100112 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 12 }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400113 - name: SDNC_DB_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +0100114 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 12 }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400115 - name: MYSQL_HOST
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100116 value: {{ include "common.mariadbService" . }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400117 - name: SDNC_HOME
118 value: "{{.Values.config.sdncHome}}"
119 - name: ETC_DIR
120 value: "{{.Values.config.etcDir}}"
121 - name: BIN_DIR
122 value: "{{.Values.config.binDir}}"
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400123 - name: SDNC_DB_DATABASE
124 value: "{{.Values.config.dbSdnctlDatabase}}"
125 volumeMounts:
126 - mountPath: {{ .Values.config.binDir }}/installSdncDb.sh
127 name: bin
128 subPath: installSdncDb.sh
129 - mountPath: {{ .Values.config.configDir }}/svclogic.properties
130 name: properties
131 subPath: svclogic.properties
132 - mountPath: /opt/onap/sdnc/svclogic/config/svclogic.properties
133 name: properties
134 subPath: svclogic.properties
135 - mountPath: {{ .Values.config.configDir }}/dblib.properties
136 name: properties
137 subPath: dblib.properties
138 command:
139 - /bin/bash
140 args:
Radoslaw Chmiel58662a32022-06-02 19:37:35 +0200141 - -c
142 - |
143 sleep 60; {{.Values.config.binDir }}/installSdncDb.sh
Satoshi Fujii54bfd172021-07-04 16:39:41 +0000144 resources: {{ include "common.resources" . | nindent 10 }}
Radoslaw Chmiel58662a32022-06-02 19:37:35 +0200145 {{- if include "common.onServiceMesh" . }}
146 - name: sdnc-service-mesh-wait-for-job-container
147 image: {{ include "repositoryGenerator.image.quitQuit" . }}
148 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
149 command:
150 - /bin/sh
151 - "-c"
152 args:
153 - |
154 echo "waiting 20s for istio side cars to be up"; sleep 20s;
155 /app/ready.py --service-mesh-check sdnc -t 45;
156 env:
157 - name: NAMESPACE
158 valueFrom:
159 fieldRef:
160 apiVersion: v1
161 fieldPath: metadata.namespace
162 {{- end }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400163 {{- if .Values.nodeSelector }}
Satoshi Fujii54bfd172021-07-04 16:39:41 +0000164 nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }}
165 {{- end }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400166 {{- if .Values.affinity }}
Satoshi Fujii54bfd172021-07-04 16:39:41 +0000167 affinity: {{ toYaml .Values.affinity | nindent 8 }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400168 {{- end }}
vladimir turokd8044182023-07-27 16:28:36 +0200169 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400170 volumes:
171 - name: localtime
172 hostPath:
173 path: /etc/localtime
174 - name: docker-entrypoint-initdb-d
175 emptyDir: {}
176 - name: bin
177 configMap:
178 name: {{ include "common.fullname" . }}-bin
179 defaultMode: 0755
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100180 - name: config-input
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400181 configMap:
182 name: {{ include "common.fullname" . }}-properties
183 defaultMode: 0644
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100184 - name: properties
185 emptyDir:
186 medium: Memory
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400187 restartPolicy: Never
188 imagePullSecrets:
189 - name: "{{ include "common.namespace" . }}-docker-registry-key"
Alexander Dehn9b797d62020-04-21 09:53:50 +0000190{{- end -}}