This commit is contained in:
James Andariese 2023-04-23 18:56:07 -05:00
parent 86141aaa92
commit 2d86d40877
2 changed files with 50 additions and 4 deletions

View File

@ -1,15 +1,58 @@
#!/bin/bash #!/bin/bash
cd "$(dirname "$0")" 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 set -e
eval "$(yq -o json . Chart.yaml | jq -r '.dependencies[0] | @sh "CHART=\(.name)\nVERSION=\(.version)\nREPO=\(.repository)"')" eval "$(dependency_chart_info)"
helm template argocd-crds "$CHART" --repo "$REPO" --version "$VERSION" | yq 'select(.kind == "CustomResourceDefinition")' | kubectl apply -f - set -x
helm template argocd-crds --include-crds "$CHART" --repo "$REPO" --version "$VERSION" | yq 'select(.kind == "CustomResourceDefinition")' | kubectl apply -f -
) )
RC=$? RC=$?
if [ $RC -ne 0 ];then if [ $RC -ne 0 ];then
1>&2 echo "exiting due to error" 1>&2 echo "exiting due to error creating ArgoCD CRDs"
exit $RC
fi
for f in templates/*.yaml
(
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 apply -f -
)
RC=$?
if [ $RC -ne 0 ];then
1>&2 echo "exiting due to error creating Sealed Secrets CRDs"
exit $RC exit $RC
fi fi

View File

@ -11,6 +11,9 @@ spec:
targetRevision: 2.7.4 targetRevision: 2.7.4
helm: helm:
releaseName: sealed-secrets releaseName: sealed-secrets
values: |
commonAnnotations:
argocd.argoproj.io/sync-wave: "-3"
destination: destination:
server: "https://kubernetes.default.svc" server: "https://kubernetes.default.svc"
namespace: kube-system namespace: kube-system