[COMMON] Harmonize resource settings
[oom.git] / kubernetes / common / cassandra / templates / backup / cronjob.yaml
index 1d1e459..8773cd3 100644 (file)
@@ -14,6 +14,8 @@
 # limitations under the License.
 */}}
 {{- if .Values.backup.enabled }}
+{{- if .Values.global.cassandra.useOperator }}
+{{ else }}
 apiVersion: batch/v1beta1
 kind: CronJob
 metadata:
@@ -37,7 +39,7 @@ spec:
             - command:
               - /app/ready.py
               args:
-              - --container-name
+              - --app-name
               - {{ include "common.name" . }}
               env:
               - name: NAMESPACE
@@ -45,12 +47,26 @@ spec:
                   fieldRef:
                     apiVersion: v1
                     fieldPath: metadata.namespace
-              image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
+              image: {{ include "repositoryGenerator.image.readiness" . }}
               imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
               name: {{ include "common.name" . }}-readiness
+              resources:
+                limits:
+                  cpu: "100m"
+                  memory: "0.5Gi"
+                requests:
+                  cpu: "3m"
+                  memory: "0.02Gi"
             - name: "cassandra-backup-init"
-              image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
+              image: {{ include "repositoryGenerator.image.readiness" . }}
               imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+              resources:
+                limits:
+                  cpu: "100m"
+                  memory: "0.5Gi"
+                requests:
+                  cpu: "3m"
+                  memory: "0.02Gi"
               command:
               - /bin/bash
               - -c
@@ -59,7 +75,7 @@ spec:
                   curr_time=$1
                   echo "Clearing snapshots!!!"
                   command="nodetool clearsnapshot -t $curr_time"
-                  /app/exec.py -p "cassandra" -c "$command"
+                  /app/exec.py -p "{{ include "common.name" . }}" -c "$command"
                 }
                 {{ $root := . }}
                 curr_time=`date +%s`
@@ -75,11 +91,11 @@ spec:
 
                 echo "Executing cleanup!!"
                 command="nodetool cleanup"
-                /app/exec.py -p "cassandra" -c "$command"
+                /app/exec.py -p "{{ include "common.name" . }}" -c "$command"
                 echo "Cleaned Node!! Backing up database now!!!"
 
                 command="nodetool snapshot -t $curr_time"
-                /app/exec.py -p "cassandra" -c "$command"
+                /app/exec.py -p "{{ include "common.name" . }}" -c "$command"
                 retCode=$?
                 if [ $retCode -ne 0 ]; then
                   echo "Backup Failed!!!"
@@ -149,7 +165,7 @@ spec:
                 subPath: exec.py
           containers:
             - name: cassandra-backup-validate
-              image: "{{ .Values.image }}"
+              image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.image }}
               imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
               command:
               - /bin/bash
@@ -243,3 +259,4 @@ spec:
             persistentVolumeClaim:
               claimName: {{ include "common.fullname" . }}-backup-data
 {{- end -}}
+{{- end -}}
\ No newline at end of file