blob: bfc1ef8e7b8665e9eb2d1e6729a4d3469f9cfd16 [file] [log] [blame]
Jakub Latusekd8eaff62020-10-21 13:36:29 +02001{{/*
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +00002# Copyright © 2017 Amdocs, AT&T, Bell Canada
toshrajbhardwajf4fc1c62018-08-06 07:35:14 +00003# Modifications Copyright © 2018 ZTE
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +00004#
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.
Jakub Latusekd8eaff62020-10-21 13:36:29 +020016*/}}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +000017
18apiVersion: batch/v1
19kind: Job
20metadata:
21 name: {{ include "common.fullname" . }}-cassandra-init
22 namespace: {{ include "common.namespace" . }}
23 labels:
24 app: {{ include "common.name" . }}-job
25 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010026 release: {{ include "common.release" . }}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +000027 heritage: {{ .Release.Service }}
28spec:
Mike Elliott6482f502018-04-30 15:02:43 -040029 backoffLimit: 20
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +000030 template:
31 metadata:
32 labels:
33 app: {{ include "common.name" . }}-job
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010034 release: {{ include "common.release" . }}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +000035 spec:
36 restartPolicy: Never
37 initContainers:
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +000038 - name: {{ include "common.name" . }}-job-completion
Sylvain Desbureaux0a1eaf32020-11-19 17:56:08 +010039 image: {{ include "repositoryGenerator.image.readiness" . }}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +000040 imagePullPolicy: "{{ .Values.global.pullPolicy | default .Values.pullPolicy }}"
41 command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020042 - /app/ready.py
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +000043 args:
44 - --job-name
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010045 - {{ include "common.release" . }}-sdc-cs-config-cassandra
ChrisC32172342020-10-02 16:39:13 +020046 - "-t"
47 - "20"
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +000048 env:
49 - name: NAMESPACE
50 valueFrom:
51 fieldRef:
52 apiVersion: v1
53 fieldPath: metadata.namespace
ChrisC32172342020-10-02 16:39:13 +020054 resources:
55 limits:
56 cpu: 100m
57 memory: 100Mi
58 requests:
59 cpu: 3m
60 memory: 20Mi
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +000061 containers:
62 - name: {{ include "common.name" . }}-job
Sylvain Desbureaux0a1eaf32020-11-19 17:56:08 +010063 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.onboardingInitImage }}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +000064 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
othman touijer2b764d02022-01-05 14:40:37 +010065 {{- if include "common.onServiceMesh" . }}
66 args:
67 - echo "waiting 10s for istio side cars to be up"; sleep 10s; /home/sdc/startup.sh
68 command:
69 - /bin/sh
70 - -c
71 {{- end }}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +000072 volumeMounts:
73 - name: {{ include "common.fullname" . }}-environments
MichaelMorrisb137f7e2020-03-15 17:44:48 +000074 mountPath: /home/sdc/chef-solo/environments/
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +000075 env:
76 - name: ENVNAME
ChrisC742a7b22020-09-04 11:29:57 +020077 value: {{ .Values.env.name }}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +000078 - name: HOST_IP
79 valueFrom:
80 fieldRef:
81 fieldPath: status.podIP
82 - name: SDC_USER
83 valueFrom:
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010084 secretKeyRef: {name: {{ include "common.release" . }}-sdc-cs-secrets, key: sdc_user}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +000085 - name: SDC_PASSWORD
86 valueFrom:
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010087 secretKeyRef: {name: {{ include "common.release" . }}-sdc-cs-secrets, key: sdc_password}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +000088 - name: CS_PASSWORD
89 valueFrom:
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010090 secretKeyRef: {name: {{ include "common.release" . }}-sdc-cs-secrets, key: cs_password}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +000091 - name: CS_HOST_IP
Andreas Geisslerfd450c42021-12-10 08:36:45 +000092 value: "{{ .Values.global.sdc_cassandra.serviceName }}"
ChrisC32172342020-10-02 16:39:13 +020093 resources:
94 limits:
95 cpu: 800m
96 memory: 1024Mi
97 requests:
98 cpu: 200m
99 memory: 200Mi
othman touijer2b764d02022-01-05 14:40:37 +0100100 {{ include "common.waitForJobContainer" . | indent 6 | trim }}
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +0000101 volumes:
102 - name: {{ include "common.fullname" . }}-environments
103 configMap:
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +0100104 name: {{ include "common.release" . }}-sdc-environments-configmap
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +0000105 defaultMode: 0755
Mandeep Khinda51a8b1b2018-04-24 20:05:32 +0000106 imagePullSecrets:
107 - name: "{{ include "common.namespace" . }}-docker-registry-key"
108 restartPolicy: Never