@@ -872,20 +872,23 @@ test.charts.golden.update:
872872
873873.PHONY : test.charts.ct.install
874874test.charts.ct.install :
875- # NOTE: We add ko-crds.keep=false below because allowing the chart to manage CRDs
875+ # NOTE: We add ko-crds.enabled=false below to handle CRD management outside of ct.
876+ # This is to work around the flaky CRD uninstall behavior of ct.
877+ # Without this, CRDs created by one test helm release installation
878+ # would sometimes not get removed upon uninstalling the release,
876879# and keep them around after helm uninstall would yield ownership issues.
877880# Error: INSTALLATION FAILED: Unable to continue with install: CustomResourceDefinition "aigateways.gateway-operator.konghq.com" in namespace ""
878881# exists and cannot be imported into the current release: invalid ownership metadata; annotation validation error: key "meta.helm.sh/release-name"
879882# must equal "kong-operator-h39gau9scc": current value is "kong-operator-tiptva339m"
880883#
881- # NOTE: We add the --wait below to ensure that we wait for all objects to get removed
882- # for each release. Without this, some objects like CRDs can still be around
883- # when another test helm release is being installed and the above mentioned
884- # ownership error will be returned.
884+ # This could potentially be solved by setting the --cascade foreground option
885+ # to helm uninstall command in ct, but ct does not currently support passing
886+ # extra args to helm uninstall.
887+ # There's an open PR for this: https://github.com/helm/chart-testing/pull/806
885888
886889 ct install --target-branch main \
887890 --debug \
888- --helm-extra-set-args "--set=ko-crds.keep =false" \
891+ --helm-extra-set-args "--set=ko-crds.enabled =false" \
889892 --helm-extra-args "--wait" \
890893 --helm-extra-args "--timeout=3m" \
891894 --charts charts/$(CHART_NAME) \
@@ -1071,6 +1074,10 @@ uninstall.helm.cert-manager: download.helm
10711074# Install CRDs into the K8s cluster specified in ~/.kube/config.
10721075.PHONY : install
10731076install : install.helm.cert-manager manifests kustomize install.gateway-api-crds
1077+ $(MAKE ) install.crds
1078+
1079+ .PHONY : install.crds
1080+ install.crds : kustomize
10741081 $(KUSTOMIZE ) build config/crd | kubectl apply --server-side -f -
10751082
10761083# Install RBACs from config/rbac into the K8s cluster specified in ~/.kube/config.
@@ -1087,8 +1094,11 @@ install.all: install.helm.cert-manager manifests kustomize install.gateway-api-c
10871094# Call with ignore-not-found=true to ignore resource not found errors during deletion.
10881095.PHONY : uninstall
10891096uninstall : manifests kustomize uninstall.gateway-api-crds uninstall.helm.cert-manager
1090- $(KUSTOMIZE ) build config/crd | kubectl delete --ignore-not-found= $( ignore-not-found ) -f -
1097+ $(MAKE ) uninstall.crds
10911098
1099+ .PHONY : uninstall.crds
1100+ uninstall.crds : kustomize
1101+ $(KUSTOMIZE ) build config/crd | kubectl delete --ignore-not-found=$(ignore-not-found ) -f -
10921102
10931103# Uninstall standard and experimental CRDs from the K8s cluster specified in ~/.kube/config.
10941104# Call with ignore-not-found=true to ignore resource not found errors during deletion.
0 commit comments