diff --git a/cronjob-ssh.yaml b/cronjob-ssh.yaml index 42fa6db..d1a0eb0 100644 --- a/cronjob-ssh.yaml +++ b/cronjob-ssh.yaml @@ -27,7 +27,7 @@ spec: name: kube-backup spec: containers: - - image: quay.io/plange/kube-backup:1.12.0-1 + - image: eu.gcr.io/gpp-dev/rms/kube-backup:1.12.3 imagePullPolicy: Always name: backup resources: {} diff --git a/entrypoint.sh b/entrypoint.sh index f11890c..45dd6ae 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -74,14 +74,19 @@ for namespace in $NAMESPACES; do fi kubectl --namespace="${namespace}" get "$type" $label_selector -o custom-columns=SPACE:.metadata.namespace,KIND:..kind,NAME:.metadata.name --no-headers | while read -r a b name; do + [[ "${SKIP_RESOURCE,,}" =~ "${namespace,,}/${type,,}/${name,,}" ]] && continue [ -z $name ] && continue - # Service account tokens cannot be exported if [[ "$type" == 'secret' && $(kubectl get -n "${namespace}" -o jsonpath="{.type}" secret "$name") == "kubernetes.io/service-account-token" ]]; then continue fi - kubectl --namespace="${namespace}" get -o=json "$type" "$name" | jq --sort-keys \ + nameval="$name" + if [[ "$nameval" != "$type*" ]]; then + nameval="$type/$nameval" + fi + + kubectl --namespace="${namespace}" get -o=json "$nameval" | jq --sort-keys \ 'del( .metadata.annotations."control-plane.alpha.kubernetes.io/leader", .metadata.annotations."kubectl.kubernetes.io/last-applied-configuration",