blob: 11b1a87128a961043a5a12a93dbb144888439c1d [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:
83 - --container-name
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010084 - {{ include "common.mariadbService" . }}
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:
134 - {{.Values.config.binDir }}/installSdncDb.sh
Satoshi Fujii54bfd172021-07-04 16:39:41 +0000135 resources: {{ include "common.resources" . | nindent 10 }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400136 {{- if .Values.nodeSelector }}
Satoshi Fujii54bfd172021-07-04 16:39:41 +0000137 nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }}
138 {{- end }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400139 {{- if .Values.affinity }}
Satoshi Fujii54bfd172021-07-04 16:39:41 +0000140 affinity: {{ toYaml .Values.affinity | nindent 8 }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400141 {{- end }}
142 volumes:
143 - name: localtime
144 hostPath:
145 path: /etc/localtime
146 - name: docker-entrypoint-initdb-d
147 emptyDir: {}
148 - name: bin
149 configMap:
150 name: {{ include "common.fullname" . }}-bin
151 defaultMode: 0755
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100152 - name: config-input
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400153 configMap:
154 name: {{ include "common.fullname" . }}-properties
155 defaultMode: 0644
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100156 - name: properties
157 emptyDir:
158 medium: Memory
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400159 restartPolicy: Never
160 imagePullSecrets:
161 - name: "{{ include "common.namespace" . }}-docker-registry-key"
Alexander Dehn9b797d62020-04-21 09:53:50 +0000162{{- end -}}