[OOM] Fixing k8s ServiceAccounts
[oom.git] / kubernetes / sdc / components / sdc-onboarding-be / templates / job.yaml
index 0a314b6..eb0958c 100644 (file)
 
 apiVersion: batch/v1
 kind: Job
-metadata:
-  name: {{ include "common.fullname" . }}-cassandra-init
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}-job
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ include "common.release" . }}
-    heritage: {{ .Release.Service }}
+metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
 spec:
   backoffLimit: 20
   template:
@@ -36,13 +29,13 @@ spec:
       restartPolicy: Never
       initContainers:
       - name: {{ include "common.name" . }}-job-completion
-        image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
+        image: {{ include "repositoryGenerator.image.readiness" . }}
         imagePullPolicy: "{{ .Values.global.pullPolicy | default .Values.pullPolicy }}"
         command:
         - /app/ready.py
         args:
         - --job-name
-        - {{ include "common.release" . }}-sdc-cs-config-cassandra
+        - {{ include "common.release" . }}-sdc-cs
         - "-t"
         - "20"
         env:
@@ -60,11 +53,20 @@ spec:
             memory: 20Mi
       containers:
       - name: {{ include "common.name" . }}-job
-        image: "{{ include "common.repository" . }}/{{ .Values.onboardingInitImage }}"
+        image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.onboardingInitImage }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+        {{- if include "common.onServiceMesh" . }}
+        args:
+        - echo "waiting 10s for istio side cars to be up"; sleep 10s; /home/sdc/startup.sh
+        command:
+        - /bin/sh
+        - -c
+        {{- end }}
         volumeMounts:
         - name: {{ include "common.fullname" . }}-environments
           mountPath: /home/sdc/chef-solo/environments/
+        - name: {{ include "common.fullname" . }}-cqlshrc
+          mountPath: /home/sdc/.cassandra
         env:
         - name: ENVNAME
           value: {{ .Values.env.name }}
@@ -82,7 +84,7 @@ spec:
           valueFrom:
             secretKeyRef: {name: {{ include "common.release" . }}-sdc-cs-secrets, key: cs_password}
         - name: CS_HOST_IP
-          value: "{{ .Values.global.cassandra.serviceName }}"
+          value: "{{ .Values.global.sdc_cassandra.serviceName }}"
         resources:
           limits:
             cpu: 800m
@@ -90,11 +92,15 @@ spec:
           requests:
             cpu: 200m
             memory: 200Mi
+      {{ include "common.waitForJobContainer" . | indent 6 | trim }}
+      serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
       volumes:
       - name: {{ include "common.fullname" . }}-environments
         configMap:
           name: {{ include "common.release" . }}-sdc-environments-configmap
           defaultMode: 0755
+      - name: {{ include "common.fullname" . }}-cqlshrc
+        configMap:
+          name: {{ include "common.release" . }}-sdc-cqlshrc
       imagePullSecrets:
       - name: "{{ include "common.namespace" . }}-docker-registry-key"
-      restartPolicy: Never