diff --git a/admin/kubezero.sh b/admin/kubezero.sh index 1d4bf433..3c6ff074 100755 --- a/admin/kubezero.sh +++ b/admin/kubezero.sh @@ -328,10 +328,14 @@ apply_module() { done for t in $MODULES; do - #_helm apply $t - - # During 1.31 we change the ArgoCD tracking so replace - _helm replace $t + # apply/replace app of apps directly + if [ $t == "kubezero" ]; then + kubectl replace -f $WORKDIR/kubezero/templates $(field_manager $ARGOCD) + else + #_helm apply $t + # During 1.31 we change the ArgoCD tracking so replace + _helm replace $t + fi done echo "Applied KubeZero modules: $MODULES" diff --git a/admin/libhelm.sh b/admin/libhelm.sh index 0dadbd58..ae59dc9c 100644 --- a/admin/libhelm.sh +++ b/admin/libhelm.sh @@ -202,6 +202,8 @@ function _helm() { yq eval '.spec.source.helm.valuesObject' $WORKDIR/kubezero/templates/${module}.yaml > $WORKDIR/values.yaml # extract remote chart or copy local to access hooks + rm -rf $WORKDIR/$chart $WORKDIR/${chart}*.tgz + if [ -z "$LOCAL_DEV" ]; then helm pull $(chart_location $chart) --untar -d $WORKDIR else @@ -210,7 +212,7 @@ function _helm() { if [ $action == "crds" ]; then # 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 @@ -222,7 +224,7 @@ function _helm() { create_ns $namespace # 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 [ $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=$? # 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 render diff --git a/charts/kubezero-argo/.helmignore b/charts/kubezero-argo/.helmignore index fbda5b26..1e0b4ac7 100644 --- a/charts/kubezero-argo/.helmignore +++ b/charts/kubezero-argo/.helmignore @@ -24,7 +24,4 @@ README.md.gotmpl dashboards.yaml -*.patch -*.sh -*.py jsonnet diff --git a/charts/kubezero-argo/hooks.d/pre-install.sh b/charts/kubezero-argo/hooks.d/pre-install.sh old mode 100755 new mode 100644