Created
January 31, 2023 18:41
-
-
Save jengo/9a2d6478088ac2bf67ba7a7dfd791b1b to your computer and use it in GitHub Desktop.
Export all ArgoCD applications stripping Kubernetes metadata
This file contains hidden or 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
#!/bin/bash | |
# Export all ArgoCD applications stripping out all Kubernetes internal fields | |
# Requires yq | |
# Written by Jolene Engo <[email protected]> | |
NAMESPACE="argocd" | |
for app in `kubectl -n ${NAMESPACE} get applications -o name --no-headers -o custom-columns=":metadata.name"`; do | |
kubectl -n ${NAMESPACE} get application $app -o yaml | yq eval 'del(.metadata.managedFields,.status,.metadata.creationTimestamp,.metadata.generation,.metadata.resourceVersion,.metadata.selfLink,.metadata.uid)' - > $app.yaml | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment