{{/*
# 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" . }}-config-cassandra
+ 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:
release: {{ include "common.release" . }}
spec:
restartPolicy: Never
+ {{ include "common.podSecurityContext" . | indent 6 | trim }}
initContainers:
- - name: {{ include "common.name" . }}-init-readiness
- image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
- imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
- command:
- - /app/ready.py
- args:
- - --container-name
- {{- if .Values.global.cassandra.localCluster }}
- - sdc-cs
- {{- else }}
- - cassandra
- {{- end }}
- - "-t"
- - "15"
- 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" . | nindent 8 }}
containers:
- name: {{ include "common.name" . }}-job
- image: "{{ include "common.repository" . }}/{{ .Values.cassandraInitImage }}"
+ image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.cassandraInitImage }}
imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+ command:
+ - /bin/sh
+ - -c
+ - |
+ /tmp/config/cassandra-db-scripts-common/execution.sh
volumeMounts:
- - name: {{ include "common.fullname" . }}-environments
- mountPath: /home/sdc/chef-solo/environments/
- - name: {{ include "common.fullname" . }}-chef-cache
- mountPath: /home/sdc/chef-solo/cache
+ - name: {{ include "common.fullname" . }}-cqlshrc
+ mountPath: /home/sdc/.cassandra
+ - name: {{ include "common.fullname" . }}-cassandra-db-scripts
+ mountPath: /tmp/config/cassandra-db-scripts-common
+ - name: {{ include "common.fullname" . }}-cassandra-config
+ mountPath: /tmp/config
+ - name: {{ include "common.fullname" . }}-writable-scripts
+ mountPath: /tmp/writable-config
+ - name: {{ include "common.fullname" . }}-importconf-tmp
+ mountPath: /tmp/writable-config/tmp
env:
- name: ENVNAME
value: {{ .Values.env.name }}
valueFrom:
fieldRef:
fieldPath: status.podIP
- resources:
- limits:
- cpu: 800m
- memory: 1024Mi
- requests:
- cpu: 200m
- memory: 300Mi
+ {{ 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 }}
+ resources: {{ include "common.resources" . | nindent 12 }}
+ {{ include "common.waitForJobContainer" . | indent 6 | trim }}
+ serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
volumes:
- - name: {{ include "common.fullname" . }}-environments
+ - name: {{ include "common.fullname" . }}-cassandra-db-scripts
configMap:
- name: {{ include "common.release" . }}-sdc-environments-configmap
+ name: {{ include "common.fullname" . }}-cassandra-db-scripts
defaultMode: 0755
- - name: {{ include "common.fullname" . }}-chef-cache
- emptyDir: {}
- imagePullSecrets:
- - name: "{{ include "common.namespace" . }}-docker-registry-key"
- restartPolicy: Never
+ - name: {{ include "common.fullname" . }}-cassandra-config
+ emptyDir:
+ sizeLimit: {{ .Values.volumes.cassandraConfigSizeLimit }}
+ - name: {{ include "common.fullname" . }}-writable-scripts
+ emptyDir:
+ sizeLimit: {{ .Values.volumes.writableScriptsSizeLimit }}
+ - name: {{ include "common.fullname" . }}-importconf-tmp
+ emptyDir:
+ sizeLimit: {{ .Values.volumes.importConfTmpSizeLimit }}
+ - name: {{ include "common.fullname" . }}-cqlshrc
+ configMap:
+ name: {{ include "common.release" . }}-sdc-cqlshrc
+ {{- include "common.imagePullSecrets" . | nindent 6 }}