[UUI] Update image version 16.0.1 of components of UUI
[oom.git] / kubernetes / sdc / components / sdc-onboarding-be / templates / job.yaml
index c8edb29..7ff54e8 100644 (file)
@@ -1,6 +1,7 @@
 {{/*
 # Copyright © 2017 Amdocs, AT&T, Bell Canada
 # Modifications Copyright © 2018  ZTE
+# Modifications Copyright © 2025 Deutsche Telekom
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 apiVersion: batch/v1
 kind: Job
 metadata:
-  name: {{ include "common.fullname" . }}-cassandra-init
+  name: {{ include "common.fullname" . }}
   namespace: {{ include "common.namespace" . }}
   labels:
-    app: {{ include "common.name" . }}-job
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+    app: {{ include "common.name" . }}
     release: {{ include "common.release" . }}
-    heritage: {{ .Release.Service }}
+  {{- if .Values.jobAnnotations }}
+  annotations:  {{- include "common.tplValue" (dict "value" .Values.jobAnnotations "context" $) | nindent 4 }}
+  {{- end }}
 spec:
   backoffLimit: 20
   template:
@@ -34,37 +36,26 @@ spec:
         release: {{ include "common.release" . }}
     spec:
       restartPolicy: Never
+      securityContext:
+        {{- toYaml .Values.jobPodSecurityContext | nindent 8 }}
       initContainers:
-      - name: {{ include "common.name" . }}-job-completion
-        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
-        - "-t"
-        - "20"
-        env:
-        - name: NAMESPACE
-          valueFrom:
-            fieldRef:
-              apiVersion: v1
-              fieldPath: metadata.namespace
-        resources:
-          limits:
-            cpu: 100m
-            memory: 100Mi
-          requests:
-            cpu: 3m
-            memory: 20Mi
+        {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.job_wait_for) | nindent 8 }}
       containers:
       - name: {{ include "common.name" . }}-job
         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,19 +73,43 @@ 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
-            memory: 1024Mi
+            cpu: "800m"
+            memory: "1Gi"
           requests:
-            cpu: 200m
-            memory: 200Mi
+            cpu: "200m"
+            memory: "200Mi"
+        {{ if eq .Values.liveness.enabled true }}
+        livenessProbe:
+          httpGet:
+            path:  /healthz
+            port: {{ .Values.service.jobPort }}
+          initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
+          periodSeconds: {{ .Values.liveness.periodSeconds }}
+          timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
+          successThreshold: {{ .Values.liveness.successThreshold }}
+          failureThreshold: {{ .Values.liveness.failureThreshold }}
+        {{ end }}
+        readinessProbe:
+          httpGet:
+            path:  /healthz
+            port: {{ .Values.service.jobPort }}
+          initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
+          periodSeconds: {{ .Values.readiness.periodSeconds }}
+          timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
+          successThreshold: {{ .Values.readiness.successThreshold }}
+          failureThreshold: {{ .Values.readiness.failureThreshold }}
+        {{ include "common.containerSecurityContext" . | indent 10 | trim }}
+      {{ 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
-      imagePullSecrets:
-      - name: "{{ include "common.namespace" . }}-docker-registry-key"
-      restartPolicy: Never
+      - name: {{ include "common.fullname" . }}-cqlshrc
+        configMap:
+          name: {{ include "common.release" . }}-sdc-cqlshrc
+      {{- include "common.imagePullSecrets" . | nindent 6 }}