summaryrefslogtreecommitdiffstats
path: root/kubernetes/common/cassandra/templates/backup/cronjob.yaml
diff options
context:
space:
mode:
authorSylvain Desbureaux <sylvain.desbureaux@orange.com>2020-08-21 09:58:25 +0200
committerGrzegorz Lis <grzegorz.lis@nokia.com>2020-09-04 09:44:19 +0000
commit1694e1d1f6ea1af001ed651609cc66b35a0ac4e4 (patch)
tree0aa6860d0734ae9ffb8bae4de71eb455f0cdabcc /kubernetes/common/cassandra/templates/backup/cronjob.yaml
parentd56af0efca443e5aa285c4d493db4160c96fd0fb (diff)
[GENERAL] Use readiness container v3.0.1
Readiness container v3.x and up are now present in ONAP main repository. They're also not using root user anymore and then script path has changed. Finally, "job_complete" script has been integrated in main "ready" script. As those changes are significant, we must upgrade all the components at once. Depends-On: I5afa83892043f4844afe12e61724a8d368a9f2e0 Issue-ID: OOM-2545 Signed-off-by: Grzegorz Lis <grzegorz.lis@nokia.com> Change-Id: I0b4eb5dd86390273532d67d0a9696e1cfcadf110
Diffstat (limited to 'kubernetes/common/cassandra/templates/backup/cronjob.yaml')
-rw-r--r--kubernetes/common/cassandra/templates/backup/cronjob.yaml23
1 files changed, 11 insertions, 12 deletions
diff --git a/kubernetes/common/cassandra/templates/backup/cronjob.yaml b/kubernetes/common/cassandra/templates/backup/cronjob.yaml
index f536be5053..1d1e4594da 100644
--- a/kubernetes/common/cassandra/templates/backup/cronjob.yaml
+++ b/kubernetes/common/cassandra/templates/backup/cronjob.yaml
@@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
*/}}
-{{- $global := . }}
{{- if .Values.backup.enabled }}
apiVersion: batch/v1beta1
kind: CronJob
@@ -36,7 +35,7 @@ spec:
restartPolicy: Never
initContainers:
- command:
- - /root/ready.py
+ - /app/ready.py
args:
- --container-name
- {{ include "common.name" . }}
@@ -46,21 +45,21 @@ spec:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
+ image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
name: {{ include "common.name" . }}-readiness
- name: "cassandra-backup-init"
- image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
+ image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
command:
- - /bin/sh
+ - /bin/bash
- -c
- |
clearSnapshot(){
curr_time=$1
echo "Clearing snapshots!!!"
command="nodetool clearsnapshot -t $curr_time"
- /root/exec.py -p "cassandra" -c "$command"
+ /app/exec.py -p "cassandra" -c "$command"
}
{{ $root := . }}
curr_time=`date +%s`
@@ -76,11 +75,11 @@ spec:
echo "Executing cleanup!!"
command="nodetool cleanup"
- /root/exec.py -p "cassandra" -c "$command"
+ /app/exec.py -p "cassandra" -c "$command"
echo "Cleaned Node!! Backing up database now!!!"
command="nodetool snapshot -t $curr_time"
- /root/exec.py -p "cassandra" -c "$command"
+ /app/exec.py -p "cassandra" -c "$command"
retCode=$?
if [ $retCode -ne 0 ]; then
echo "Backup Failed!!!"
@@ -96,7 +95,7 @@ spec:
d=$(echo $d | sed 's:/*$::')
keyspace_name=$(echo "$d" | awk -F/ '{ print $NF }')
if [ 1 ] {{- range $t, $keyspace := $root.Values.backup.keyspacesToSkip }} && [ "{{ $keyspace.name }}" != "$keyspace_name" ] {{- end }}; then
- /root/restore.sh -b $backup_dir/cassandra-{{ $i }}/data -s /onap-data/cassandra-{{ $i }}/data/$keyspace_name -k $keyspace_name -t $curr_time &
+ /app/restore.sh -b $backup_dir/cassandra-{{ $i }}/data -s /onap-data/cassandra-{{ $i }}/data/$keyspace_name -k $keyspace_name -t $curr_time &
pids="$pids $!"
fi
done
@@ -143,10 +142,10 @@ spec:
- mountPath: /backup
name: backup-dir
- name: scripts
- mountPath: /root/restore.sh
+ mountPath: /app/restore.sh
subPath: restore.sh
- name: scripts
- mountPath: /root/exec.py
+ mountPath: /app/exec.py
subPath: exec.py
containers:
- name: cassandra-backup-validate
@@ -238,7 +237,7 @@ spec:
{{- range $i := until (int .Values.replicaCount)}}
- name: data-dir-{{ $i }}
persistentVolumeClaim:
- claimName: {{ include "common.fullname" $global }}-data-{{ include "common.fullname" $global }}-{{ $i }}
+ claimName: {{ include "common.fullname" . }}-data-{{ $i }}
{{- end }}
- name: backup-dir
persistentVolumeClaim: