#!/bin/bash -eu for NS in `kubectl get psmdb -A --no-headers -o custom-columns=":metadata.namespace"`; do echo $NS export psmdb=`kubectl get psmdb -n $NS --no-headers -o custom-columns=":metadata.name"` echo $psmdb kubectl -n ${NS} patch psmdb ${psmdb} --type=json -p '[{"op":"replace","path":"/spec/backup/tasks/0/schedule","value":"'"$(( $RANDOM % 59 ))"' '"$(( $RANDOM % 5 ))"' * * *"}]' done for NS in `kubectl get cj -l application=spilo -A --no-headers -o custom-columns=":metadata.namespace"`; do echo $NS export cj=`kubectl -n ${NS} get cj -l application=spilo --no-headers -o custom-columns=":metadata.name"` echo $cj kubectl -n ${NS} patch cj ${cj} --type=json -p '[{"op":"replace","path":"/spec/schedule","value":"'"$(( $RANDOM % 59 ))"' '"$(( $RANDOM % 5 ))"' * * *"}]' done