blob: e0f0e55252a9b9cbd8a034dee0f678046d16b868 [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 }}
28 annotations:
29 "helm.sh/hook": post-install
30 "helm.sh/hook-weight": "0"
31 "helm.sh/hook-delete-policy": before-hook-creation
32spec:
33 backoffLimit: 20
34 template:
35 metadata:
36 labels:
37 app: {{ include "common.name" . }}-job
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010038 release: {{ include "common.release" . }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -040039 name: {{ include "common.name" . }}
40 spec:
41 initContainers:
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010042 - command:
43 - sh
44 args:
45 - -c
46 - "cd /config-input && for PFILE in `ls -1 .`; do envsubst <${PFILE} >/config/${PFILE}; done"
47 env:
48 - name: AAI_CLIENT_NAME
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010049 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "aai-user-creds" "key" "login") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010050 - name: AAI_CLIENT_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010051 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "aai-user-creds" "key" "password") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010052 - name: MODELSERVICE_USER
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010053 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "modeling-user-creds" "key" "login") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010054 - name: MODELSERVICE_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010055 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "modeling-user-creds" "key" "password") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010056 - name: RESTCONF_USER
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010057 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restconf-creds" "key" "login") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010058 - name: RESTCONF_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010059 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restconf-creds" "key" "password") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010060 - name: ANSIBLE_USER
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010061 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "ansible-creds" "key" "login") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010062 - name: ANSIBLE_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010063 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "ansible-creds" "key" "password") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010064 - name: SCALEOUT_USER
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010065 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "scaleout-creds" "key" "login") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010066 - name: SCALEOUT_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010067 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "scaleout-creds" "key" "password") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010068 - name: NETBOX_APIKEY
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010069 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "netbox-apikey" "key" "password") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010070 - name: SDNC_DB_USER
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010071 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010072 - name: SDNC_DB_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010073 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010074 volumeMounts:
75 - mountPath: /config-input
76 name: config-input
77 - mountPath: /config
78 name: properties
79 image: "{{ .Values.global.envsubstImage }}"
80 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
81 name: {{ include "common.name" . }}-update-config
82
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -040083 - name: {{ include "common.name" . }}-readiness
84 command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020085 - /app/ready.py
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -040086 args:
87 - --container-name
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010088 - {{ include "common.mariadbService" . }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -040089 env:
90 - name: NAMESPACE
91 valueFrom:
92 fieldRef:
93 apiVersion: v1
94 fieldPath: metadata.namespace
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020095 image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -040096 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
97 containers:
98 - name: {{ include "common.name" . }}
Timoney, Dan (dt5972)103b69b2019-08-08 13:21:16 -040099 image: "{{ include "common.repository" . }}/{{ .Values.image }}"
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400100 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
101 env:
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100102 - name: MYSQL_ROOT_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +0100103 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-root-password" "key" "password") | indent 12 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100104 - name: ODL_ADMIN_USERNAME
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +0100105 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "odl-creds" "key" "login") | indent 12 }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400106 - name: ODL_ADMIN_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +0100107 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "odl-creds" "key" "password") | indent 12 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100108 - name: SDNC_DB_USER
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +0100109 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 12 }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400110 - name: SDNC_DB_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +0100111 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 12 }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400112 - name: MYSQL_HOST
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100113 value: {{ include "common.mariadbService" . }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400114 - name: SDNC_HOME
115 value: "{{.Values.config.sdncHome}}"
116 - name: ETC_DIR
117 value: "{{.Values.config.etcDir}}"
118 - name: BIN_DIR
119 value: "{{.Values.config.binDir}}"
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400120 - name: SDNC_DB_DATABASE
121 value: "{{.Values.config.dbSdnctlDatabase}}"
122 volumeMounts:
123 - mountPath: {{ .Values.config.binDir }}/installSdncDb.sh
124 name: bin
125 subPath: installSdncDb.sh
126 - mountPath: {{ .Values.config.configDir }}/svclogic.properties
127 name: properties
128 subPath: svclogic.properties
129 - mountPath: /opt/onap/sdnc/svclogic/config/svclogic.properties
130 name: properties
131 subPath: svclogic.properties
132 - mountPath: {{ .Values.config.configDir }}/dblib.properties
133 name: properties
134 subPath: dblib.properties
135 command:
136 - /bin/bash
137 args:
138 - {{.Values.config.binDir }}/installSdncDb.sh
139 resources:
140{{ include "common.resources" . | indent 12 }}
141 {{- if .Values.nodeSelector }}
142 nodeSelector:
143{{ toYaml .Values.nodeSelector | indent 10 }}
144 {{- end -}}
145 {{- if .Values.affinity }}
146 affinity:
147{{ toYaml .Values.affinity | indent 10 }}
148 {{- end }}
149 volumes:
150 - name: localtime
151 hostPath:
152 path: /etc/localtime
153 - name: docker-entrypoint-initdb-d
154 emptyDir: {}
155 - name: bin
156 configMap:
157 name: {{ include "common.fullname" . }}-bin
158 defaultMode: 0755
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100159 - name: config-input
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400160 configMap:
161 name: {{ include "common.fullname" . }}-properties
162 defaultMode: 0644
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100163 - name: properties
164 emptyDir:
165 medium: Memory
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400166 restartPolicy: Never
167 imagePullSecrets:
168 - name: "{{ include "common.namespace" . }}-docker-registry-key"
Alexander Dehn9b797d62020-04-21 09:53:50 +0000169{{- end -}}