Last active
September 21, 2023 12:46
-
-
Save haarchri/5d84301babe2a921885d933fdc926319 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## get all managed resources | |
kubectl get managed -l crossplane.io/claim-name=test123 -o yaml >> export.yaml | |
## use only .items[] | |
cat export.yaml | yq e -P '.items' >> temp.yaml | |
## create individual files | |
yq '.[]' temp.yaml -s '"backup_" + .kind +"_"+ .metadata.name' | |
## add paused annotation | |
for file in backup* ; do yq eval '.metadata.annotations += {"crossplane.io/paused": "true"}' -i "$file"; done | |
## apply all files | |
kubectl apply --dry-run=client $(ls backup*.yml | awk ' { print " -f " $1 } ') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment