blob: 0cd0eae610ddc36aa1ddc7d9af655afd840b3d0a [file] [log] [blame]
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -04001# Copyright © 2017 Amdocs, Bell Canada, AT&T
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15apiVersion: batch/v1
16kind: Job
17metadata:
18 name: {{ include "common.fullname" . }}-dbinit-job
19 namespace: {{ include "common.namespace" . }}
20 labels:
21 app: {{ include "common.name" . }}
22 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010023 release: {{ include "common.release" . }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -040024 heritage: {{ .Release.Service }}
25 annotations:
26 "helm.sh/hook": post-install
27 "helm.sh/hook-weight": "0"
28 "helm.sh/hook-delete-policy": before-hook-creation
29spec:
30 backoffLimit: 20
31 template:
32 metadata:
33 labels:
34 app: {{ include "common.name" . }}-job
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010035 release: {{ include "common.release" . }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -040036 name: {{ include "common.name" . }}
37 spec:
38 initContainers:
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010039 - command:
40 - sh
41 args:
42 - -c
43 - "cd /config-input && for PFILE in `ls -1 .`; do envsubst <${PFILE} >/config/${PFILE}; done"
44 env:
45 - name: AAI_CLIENT_NAME
46 {{- include "common.secret.envFromSecret" (dict "global" . "uid" "aai-user-creds" "key" "login") | indent 10 }}
47 - name: AAI_CLIENT_PASSWORD
48 {{- include "common.secret.envFromSecret" (dict "global" . "uid" "aai-user-creds" "key" "password") | indent 10 }}
49 - name: MODELSERVICE_USER
50 {{- include "common.secret.envFromSecret" (dict "global" . "uid" "modeling-user-creds" "key" "login") | indent 10 }}
51 - name: MODELSERVICE_PASSWORD
52 {{- include "common.secret.envFromSecret" (dict "global" . "uid" "modeling-user-creds" "key" "password") | indent 10 }}
53 - name: RESTCONF_USER
54 {{- include "common.secret.envFromSecret" (dict "global" . "uid" "restconf-creds" "key" "login") | indent 10 }}
55 - name: RESTCONF_PASSWORD
56 {{- include "common.secret.envFromSecret" (dict "global" . "uid" "restconf-creds" "key" "password") | indent 10 }}
57 - name: ANSIBLE_USER
58 {{- include "common.secret.envFromSecret" (dict "global" . "uid" "ansible-creds" "key" "login") | indent 10 }}
59 - name: ANSIBLE_PASSWORD
60 {{- include "common.secret.envFromSecret" (dict "global" . "uid" "ansible-creds" "key" "password") | indent 10 }}
61 - name: SCALEOUT_USER
62 {{- include "common.secret.envFromSecret" (dict "global" . "uid" "scaleout-creds" "key" "login") | indent 10 }}
63 - name: SCALEOUT_PASSWORD
64 {{- include "common.secret.envFromSecret" (dict "global" . "uid" "scaleout-creds" "key" "password") | indent 10 }}
65 - name: NETBOX_APIKEY
66 {{- include "common.secret.envFromSecret" (dict "global" . "uid" "netbox-apikey" "key" "password") | indent 10 }}
67 - name: SDNC_DB_USER
68 {{- include "common.secret.envFromSecret" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }}
69 - name: SDNC_DB_PASSWORD
70 {{- include "common.secret.envFromSecret" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }}
71 volumeMounts:
72 - mountPath: /config-input
73 name: config-input
74 - mountPath: /config
75 name: properties
76 image: "{{ .Values.global.envsubstImage }}"
77 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
78 name: {{ include "common.name" . }}-update-config
79
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -040080 - name: {{ include "common.name" . }}-readiness
81 command:
82 - /root/ready.py
83 args:
84 - --container-name
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010085 - {{ include "common.mariadbService" . }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -040086 env:
87 - name: NAMESPACE
88 valueFrom:
89 fieldRef:
90 apiVersion: v1
91 fieldPath: metadata.namespace
92 image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
93 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
94 containers:
95 - name: {{ include "common.name" . }}
Timoney, Dan (dt5972)103b69b2019-08-08 13:21:16 -040096 image: "{{ include "common.repository" . }}/{{ .Values.image }}"
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -040097 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
98 env:
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +010099 - name: MYSQL_ROOT_PASSWORD
100 {{- include "common.secret.envFromSecret" (dict "global" . "uid" "db-root-password" "key" "password") | indent 12 }}
101 - name: ODL_ADMIN_USERNAME
102 {{- include "common.secret.envFromSecret" (dict "global" . "uid" "odl-creds" "key" "login") | indent 12 }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400103 - name: ODL_ADMIN_PASSWORD
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100104 {{- include "common.secret.envFromSecret" (dict "global" . "uid" "odl-creds" "key" "password") | indent 12 }}
105 - name: SDNC_DB_USER
106 {{- include "common.secret.envFromSecret" (dict "global" . "uid" "db-secret" "key" "login") | indent 12 }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400107 - name: SDNC_DB_PASSWORD
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100108 {{- include "common.secret.envFromSecret" (dict "global" . "uid" "db-secret" "key" "password") | indent 12 }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400109 - name: MYSQL_HOST
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100110 value: {{ include "common.mariadbService" . }}
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400111 - name: SDNC_HOME
112 value: "{{.Values.config.sdncHome}}"
113 - name: ETC_DIR
114 value: "{{.Values.config.etcDir}}"
115 - name: BIN_DIR
116 value: "{{.Values.config.binDir}}"
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400117 - name: SDNC_DB_DATABASE
118 value: "{{.Values.config.dbSdnctlDatabase}}"
119 volumeMounts:
120 - mountPath: {{ .Values.config.binDir }}/installSdncDb.sh
121 name: bin
122 subPath: installSdncDb.sh
123 - mountPath: {{ .Values.config.configDir }}/svclogic.properties
124 name: properties
125 subPath: svclogic.properties
126 - mountPath: /opt/onap/sdnc/svclogic/config/svclogic.properties
127 name: properties
128 subPath: svclogic.properties
129 - mountPath: {{ .Values.config.configDir }}/dblib.properties
130 name: properties
131 subPath: dblib.properties
132 command:
133 - /bin/bash
134 args:
135 - {{.Values.config.binDir }}/installSdncDb.sh
136 resources:
137{{ include "common.resources" . | indent 12 }}
138 {{- if .Values.nodeSelector }}
139 nodeSelector:
140{{ toYaml .Values.nodeSelector | indent 10 }}
141 {{- end -}}
142 {{- if .Values.affinity }}
143 affinity:
144{{ toYaml .Values.affinity | indent 10 }}
145 {{- end }}
146 volumes:
147 - name: localtime
148 hostPath:
149 path: /etc/localtime
150 - name: docker-entrypoint-initdb-d
151 emptyDir: {}
152 - name: bin
153 configMap:
154 name: {{ include "common.fullname" . }}-bin
155 defaultMode: 0755
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100156 - name: config-input
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400157 configMap:
158 name: {{ include "common.fullname" . }}-properties
159 defaultMode: 0644
Krzysztof Opasiakcc97c732020-02-25 23:31:20 +0100160 - name: properties
161 emptyDir:
162 medium: Memory
Timoney, Dan (dt5972)a3bc1a52019-06-26 16:16:52 -0400163 restartPolicy: Never
164 imagePullSecrets:
165 - name: "{{ include "common.namespace" . }}-docker-registry-key"