fix: apply kubezero module first, fix hooks

This commit is contained in:
Stefan Reimer 2025-03-18 16:18:20 +00:00
parent af29836a27
commit ab744494e6
4 changed files with 13 additions and 10 deletions

View File

@ -328,10 +328,14 @@ apply_module() {
done done
for t in $MODULES; do for t in $MODULES; do
#_helm apply $t # apply/replace app of apps directly
if [ $t == "kubezero" ]; then
# During 1.31 we change the ArgoCD tracking so replace kubectl replace -f $WORKDIR/kubezero/templates $(field_manager $ARGOCD)
_helm replace $t else
#_helm apply $t
# During 1.31 we change the ArgoCD tracking so replace
_helm replace $t
fi
done done
echo "Applied KubeZero modules: $MODULES" echo "Applied KubeZero modules: $MODULES"

View File

@ -202,6 +202,8 @@ function _helm() {
yq eval '.spec.source.helm.valuesObject' $WORKDIR/kubezero/templates/${module}.yaml > $WORKDIR/values.yaml yq eval '.spec.source.helm.valuesObject' $WORKDIR/kubezero/templates/${module}.yaml > $WORKDIR/values.yaml
# extract remote chart or copy local to access hooks # extract remote chart or copy local to access hooks
rm -rf $WORKDIR/$chart $WORKDIR/${chart}*.tgz
if [ -z "$LOCAL_DEV" ]; then if [ -z "$LOCAL_DEV" ]; then
helm pull $(chart_location $chart) --untar -d $WORKDIR helm pull $(chart_location $chart) --untar -d $WORKDIR
else else
@ -210,7 +212,7 @@ function _helm() {
if [ $action == "crds" ]; then if [ $action == "crds" ]; then
# Pre-crd hook # Pre-crd hook
[ -x $WORKDIR/$chart/hooks.d/pre-crds.sh ] && (cd $WORKDIR; ./$chart/hooks.d/pre-crds.sh) [ -f $WORKDIR/$chart/hooks.d/pre-crds.sh ] && (cd $WORKDIR; bash ./$chart/hooks.d/pre-crds.sh)
crds crds
@ -222,7 +224,7 @@ function _helm() {
create_ns $namespace create_ns $namespace
# Optional pre hook # Optional pre hook
[ -x $WORKDIR/$chart/hooks.d/pre-install.sh ] && (cd $WORKDIR; ./$chart/hooks.d/pre-install.sh) [ -f $WORKDIR/$chart/hooks.d/pre-install.sh ] && (cd $WORKDIR; bash ./$chart/hooks.d/pre-install.sh)
render render
[ $action == "replace" ] && kubectl replace -f $WORKDIR/helm.yaml $(field_manager $ARGOCD) && rc=$? || rc=$? [ $action == "replace" ] && kubectl replace -f $WORKDIR/helm.yaml $(field_manager $ARGOCD) && rc=$? || rc=$?
@ -231,7 +233,7 @@ function _helm() {
[ $action == "apply" -o $rc -ne 0 ] && kubectl apply -f $WORKDIR/helm.yaml --server-side --force-conflicts $(field_manager $ARGOCD) && rc=$? || rc=$? [ $action == "apply" -o $rc -ne 0 ] && kubectl apply -f $WORKDIR/helm.yaml --server-side --force-conflicts $(field_manager $ARGOCD) && rc=$? || rc=$?
# Optional post hook # Optional post hook
[ -x $WORKDIR/$chart/hooks.d/post-install.sh ] && (cd $WORKDIR; ./$chart/hooks.d/post-install.sh) [ -f $WORKDIR/$chart/hooks.d/post-install.sh ] && (cd $WORKDIR; bash ./$chart/hooks.d/post-install.sh)
elif [ $action == "delete" ]; then elif [ $action == "delete" ]; then
render render

View File

@ -24,7 +24,4 @@
README.md.gotmpl README.md.gotmpl
dashboards.yaml dashboards.yaml
*.patch
*.sh
*.py
jsonnet jsonnet

0
charts/kubezero-argo/hooks.d/pre-install.sh Executable file → Normal file
View File