2 # Copyright (C) 2021 Wipro Limited.
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
8 # http://www.apache.org/licenses/LICENSE-2.0
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.
19 name: {{ include "common.fullname" . }}-job
20 namespace: {{ include "common.namespace" . }}
22 app: {{ include "common.name" . }}
23 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
24 release: {{ include "common.release" . }}
25 heritage: {{ .Release.Service }}
27 backoffLimit: {{ .Values.backoffLimit }}
31 # Workarround to exclude K8S API from istio communication
32 # as init-container (readinessCheck) does not work with the
33 # Istio CNI plugin, see:
34 # (https://istio.io/latest/docs/setup/additional-setup/cni/#compatibility-with-application-init-containers)
35 traffic.sidecar.istio.io/excludeOutboundPorts: "443"
37 app: {{ include "common.name" . }}
38 release: {{ include "common.release" . }}
39 name: {{ include "common.name" . }}
42 - name: {{ include "common.name" . }}-readiness
47 - {{ .Values.etcd.serviceName }}
53 fieldPath: metadata.namespace
54 image: {{ include "repositoryGenerator.image.readiness" . }}
55 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
64 - name: {{ include "common.name" . }}
65 image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.image }}
66 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
71 {{- if include "common.onServiceMesh" . }}
72 echo "waiting 15s for istio side cars to be up"; sleep 15s;{{- end }}
74 export ETCDCTL_ENDPOINTS=http://${ETCD_HOST}:${ETCD_PORT}
76 echo "${ROOT_PASSWORD}" | etcdctl user add root --interactive=false
77 echo "${APP_PASSWORD}" | etcdctl user add ${APP_USER} --interactive=false
80 etcdctl role add ${APP_ROLE}
81 etcdctl role grant-permission ${APP_ROLE} --prefix=true readwrite ${KEY_PREFIX}
83 etcdctl user grant-role ${APP_USER} ${APP_ROLE}
86 - name: ALLOW_NONE_AUTHENTICATION
89 value: "{{ .Values.etcd.serviceName }}.{{ include "common.namespace" . }}"
91 value: "{{ .Values.etcd.port }}"
93 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "root-password" "key" "password" ) | indent 10 }}
95 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "app-creds" "key" "login") | indent 10 }}
97 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "app-creds" "key" "password") | indent 10 }}
99 value: "{{ .Values.config.appRole }}"
101 value: "{{ .Values.config.keyPrefix }}"
102 resources: {{ include "common.resources" . | nindent 10 }}
103 {{ include "common.waitForJobContainer" . | indent 6 | trim }}
104 {{- if .Values.nodeSelector }}
105 nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }}
107 {{- if .Values.affinity }}
108 affinity: {{ toYaml .Values.affinity | nindent 10 }}
110 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
112 {{- include "common.imagePullSecrets" . | nindent 6 }}