Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip resources var #58

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cronjob-ssh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please drop this change :)

imagePullPolicy: Always
name: backup
resources: {}
Expand Down
9 changes: 7 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down