blob: bce94f3008885a1e7e960183a98022aa821d7d5a [file] [log] [blame]
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +01001{{/*
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -04002# Copyright © 2017 Amdocs, Bell Canada, AT&T
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010015*/}}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -040016
17apiVersion: batch/v1
18kind: Job
19metadata:
20 name: {{ include "common.fullname" . }}-dbinit-job
21 namespace: {{ include "common.namespace" . }}
22 labels:
23 app: {{ include "common.name" . }}
24 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010025 release: {{ include "common.release" . }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -040026 heritage: {{ .Release.Service }}
27 annotations:
28 "helm.sh/hook": post-install
29 "helm.sh/hook-weight": "0"
30 "helm.sh/hook-delete-policy": before-hook-creation
31spec:
32 backoffLimit: 20
33 template:
34 metadata:
35 labels:
36 app: {{ include "common.name" . }}-job
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010037 release: {{ include "common.release" . }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -040038 name: {{ include "common.name" . }}
39 spec:
40 initContainers:
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010041 - command:
42 - sh
43 args:
44 - -c
45 - "cd /config-input && for PFILE in `ls -1 .`; do envsubst <${PFILE} >/config/${PFILE}; done"
46 env:
47 - name: AAI_CLIENT_NAME
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010048 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "aai-user-creds" "key" "login") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010049 - name: AAI_CLIENT_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010050 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "aai-user-creds" "key" "password") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010051 - name: MODELSERVICE_USER
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010052 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "modeling-user-creds" "key" "login") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010053 - name: MODELSERVICE_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010054 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "modeling-user-creds" "key" "password") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010055 - name: RESTCONF_USER
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010056 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restconf-creds" "key" "login") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010057 - name: RESTCONF_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010058 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restconf-creds" "key" "password") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010059 - name: ANSIBLE_USER
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010060 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "ansible-creds" "key" "login") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010061 - name: ANSIBLE_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010062 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "ansible-creds" "key" "password") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010063 - name: SCALEOUT_USER
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010064 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "scaleout-creds" "key" "login") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010065 - name: SCALEOUT_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010066 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "scaleout-creds" "key" "password") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010067 - name: NETBOX_APIKEY
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010068 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "netbox-apikey" "key" "password") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010069 - name: SDNC_DB_USER
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010070 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010071 - name: SDNC_DB_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +010072 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010073 volumeMounts:
74 - mountPath: /config-input
75 name: config-input
76 - mountPath: /config
77 name: properties
78 image: "{{ .Values.global.envsubstImage }}"
79 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
80 name: {{ include "common.name" . }}-update-config
81
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -040082 - name: {{ include "common.name" . }}-readiness
83 command:
84 - /root/ready.py
85 args:
86 - --container-name
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010087 - {{ include "common.mariadbService" . }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -040088 env:
89 - name: NAMESPACE
90 valueFrom:
91 fieldRef:
92 apiVersion: v1
93 fieldPath: metadata.namespace
94 image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
95 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
96 containers:
97 - name: {{ include "common.name" . }}
Timoney, Dan (dt5972)103b69b2019-08-08 13:21:16 -040098 image: "{{ include "common.repository" . }}/{{ .Values.image }}"
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -040099 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
100 env:
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100101 - name: MYSQL_ROOT_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +0100102 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-root-password" "key" "password") | indent 12 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100103 - name: ODL_ADMIN_USERNAME
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +0100104 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "odl-creds" "key" "login") | indent 12 }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400105 - name: ODL_ADMIN_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +0100106 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "odl-creds" "key" "password") | indent 12 }}
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100107 - name: SDNC_DB_USER
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +0100108 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 12 }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400109 - name: SDNC_DB_PASSWORD
Krzysztof Opasiakab7a6bb2020-03-24 03:30:51 +0100110 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 12 }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400111 - name: MYSQL_HOST
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100112 value: {{ include "common.mariadbService" . }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400113 - name: SDNC_HOME
114 value: "{{.Values.config.sdncHome}}"
115 - name: ETC_DIR
116 value: "{{.Values.config.etcDir}}"
117 - name: BIN_DIR
118 value: "{{.Values.config.binDir}}"
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400119 - name: SDNC_DB_DATABASE
120 value: "{{.Values.config.dbSdnctlDatabase}}"
121 volumeMounts:
122 - mountPath: {{ .Values.config.binDir }}/installSdncDb.sh
123 name: bin
124 subPath: installSdncDb.sh
125 - mountPath: {{ .Values.config.configDir }}/svclogic.properties
126 name: properties
127 subPath: svclogic.properties
128 - mountPath: /opt/onap/sdnc/svclogic/config/svclogic.properties
129 name: properties
130 subPath: svclogic.properties
131 - mountPath: {{ .Values.config.configDir }}/dblib.properties
132 name: properties
133 subPath: dblib.properties
134 command:
135 - /bin/bash
136 args:
137 - {{.Values.config.binDir }}/installSdncDb.sh
138 resources:
139{{ include "common.resources" . | indent 12 }}
140 {{- if .Values.nodeSelector }}
141 nodeSelector:
142{{ toYaml .Values.nodeSelector | indent 10 }}
143 {{- end -}}
144 {{- if .Values.affinity }}
145 affinity:
146{{ toYaml .Values.affinity | indent 10 }}
147 {{- end }}
148 volumes:
149 - name: localtime
150 hostPath:
151 path: /etc/localtime
152 - name: docker-entrypoint-initdb-d
153 emptyDir: {}
154 - name: bin
155 configMap:
156 name: {{ include "common.fullname" . }}-bin
157 defaultMode: 0755
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100158 - name: config-input
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400159 configMap:
160 name: {{ include "common.fullname" . }}-properties
161 defaultMode: 0644
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100162 - name: properties
163 emptyDir:
164 medium: Memory
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400165 restartPolicy: Never
166 imagePullSecrets:
167 - name: "{{ include "common.namespace" . }}-docker-registry-key"