From 92d261fc1e64a87b3b0fee5a87c5d010f86cb1fb Mon Sep 17 00:00:00 2001 From: Aleksei Sviridkin Date: Wed, 18 Feb 2026 00:25:06 +0300 Subject: [PATCH] fix: address review findings in operator and tests - Remove duplicate "Starting controller manager" log before install phases, keep only the one before mgr.Start() - Rename misleading test "document without kind returns error" to "decoder rejects document without kind" to match actual behavior - Document Helm uninstall CRD behavior in deployment template comment - Use --health-probe-bind-address=0 consistently with metrics-bind - Exclude all dotfiles in verify-crds diff, not just .gitattributes Co-Authored-By: Claude Signed-off-by: Aleksei Sviridkin --- Makefile | 2 +- cmd/cozystack-operator/main.go | 3 +-- internal/manifestutil/parse_test.go | 2 +- packages/core/installer/templates/cozystack-operator.yaml | 7 ++++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 9707ade4..73bd0bea 100644 --- a/Makefile +++ b/Makefile @@ -81,7 +81,7 @@ test: make -C packages/core/testing test verify-crds: - @diff --recursive packages/core/installer/crds/ internal/crdinstall/manifests/ --exclude=.gitattributes \ + @diff --recursive packages/core/installer/crds/ internal/crdinstall/manifests/ --exclude='.*' \ || (echo "ERROR: CRD manifests out of sync. Run 'make generate' to fix." && exit 1) unit-tests: helm-unit-tests verify-crds diff --git a/cmd/cozystack-operator/main.go b/cmd/cozystack-operator/main.go index a0efdd84..d3c40f7e 100644 --- a/cmd/cozystack-operator/main.go +++ b/cmd/cozystack-operator/main.go @@ -137,8 +137,7 @@ func main() { os.Exit(1) } - // Start the controller manager - setupLog.Info("Starting controller manager") + // Initialize the controller manager mgr, err := ctrl.NewManager(config, ctrl.Options{ Scheme: scheme, Cache: cache.Options{ diff --git a/internal/manifestutil/parse_test.go b/internal/manifestutil/parse_test.go index 30bf7030..860405c7 100644 --- a/internal/manifestutil/parse_test.go +++ b/internal/manifestutil/parse_test.go @@ -59,7 +59,7 @@ metadata: wantCount: 0, }, { - name: "document without kind returns error", + name: "decoder rejects document without kind", input: `apiVersion: v1 metadata: name: test diff --git a/packages/core/installer/templates/cozystack-operator.yaml b/packages/core/installer/templates/cozystack-operator.yaml index 1153ec4d..5cd471cf 100644 --- a/packages/core/installer/templates/cozystack-operator.yaml +++ b/packages/core/installer/templates/cozystack-operator.yaml @@ -54,11 +54,12 @@ spec: - --leader-elect=true - --install-flux=true # CRDs are also in crds/ for initial helm install, but Helm never updates - # them on upgrade. The operator applies embedded CRDs via server-side apply - # on every startup, ensuring they stay up to date. + # them on upgrade and never deletes them on uninstall. The operator applies + # embedded CRDs via server-side apply on every startup, ensuring they stay + # up to date. To fully remove CRDs, delete them manually after helm uninstall. - --install-crds=true - --metrics-bind-address=0 - - --health-probe-bind-address= + - --health-probe-bind-address=0 {{- if .Values.cozystackOperator.disableTelemetry }} - --disable-telemetry {{- end }}