55 lines
1.1 KiB
Bash
55 lines
1.1 KiB
Bash
#!/bin/bash
|
|
|
|
MAINDIR="$(dirname "$0")"
|
|
cd "$MAINDIR"
|
|
|
|
application_chart_info() {
|
|
F="$1"
|
|
yq -o json . "$F" | jq -r '
|
|
.spec.source
|
|
| (
|
|
@sh "CHART=\(.chart)",
|
|
@sh "VERSION=\(.targetRevision)",
|
|
@sh "REPO=\(.repoURL)"
|
|
)
|
|
'
|
|
}
|
|
|
|
dependency_chart_info() {
|
|
F="${1:-"$MAINDIR"/Chart.yaml}"
|
|
DEP="${2:-0}"
|
|
|
|
yq -o json . "$F" | jq -r --argjson d "$DEP" '
|
|
.dependencies[$d]
|
|
| (
|
|
@sh "CHART=\(.name)",
|
|
@sh "VERSION=\(.version)",
|
|
@sh "REPO=\(.repository)"
|
|
)
|
|
'
|
|
}
|
|
|
|
(
|
|
set -e
|
|
eval "$(dependency_chart_info)"
|
|
set -x
|
|
helm template argocd-crds --include-crds "$CHART" --repo "$REPO" --version "$VERSION" | yq 'select(.kind == "CustomResourceDefinition")' | kubectl delete -f -
|
|
)
|
|
|
|
RC=$?
|
|
if [ $RC -ne 0 ];then
|
|
1>&2 echo "error deleting ArgoCD CRDs"
|
|
fi
|
|
|
|
(
|
|
set -e
|
|
eval "$(application_chart_info templates/sealed-secrets.yaml)"
|
|
set -x
|
|
helm template sealed-secrets-crds --include-crds "$CHART" --repo "$REPO" --version "$VERSION" | yq 'select(.kind == "CustomResourceDefinition")' | kubectl delete -f -
|
|
)
|
|
|
|
RC=$?
|
|
if [ $RC -ne 0 ];then
|
|
1>&2 echo "error deleting Sealed Secrets CRDs"
|
|
fi
|