Skip to content

fix: reconciler bugs -- envtest failures, snapshot alias (session/3)#4

Merged
ontave merged 4 commits into
mainfrom
session/3-reconciler-bugs
May 2, 2026
Merged

fix: reconciler bugs -- envtest failures, snapshot alias (session/3)#4
ontave merged 4 commits into
mainfrom
session/3-reconciler-bugs

Conversation

@ontave
Copy link
Copy Markdown
Contributor

@ontave ontave commented Apr 19, 2026

Summary

  • Fix all guardian integration test failures (GUARDIAN-BL-ENVTEST-FAIL): three independent root causes resolved
  • Add management cluster snapshot alias (G-BL-SNAPSHOT-ALIAS): snapshot-management used for management cluster instead of snapshot-{cluster}
  • G-BL-CNPG-POOLER-AUTH confirmed pre-implemented; no changes needed

Changes

rbacpolicy_controller.go -- after AddFinalizer+Update, return Requeue:true instead of nil. GenerationChangedPredicate filters metadata-only Update events; Requeue bypasses the predicate and forces immediate re-reconcile. Without this fix, all RBACPolicy/Profile tests timed out waiting for the reconciler to re-enter after finalizer addition.

lineage_immutability_test.go -- add required spec.permissions field to the probe PermissionSet. CRD admission validation rejects a PermissionSet with an empty permissions list.

epg_reconciler_test.go -- set OperatorNamespace on the EPGReconciler in TestMain. Without it, snapshots were created in namespace "" while the test asserted against security-system.

epg_controller.go -- add ManagementClusterName field and snapshotNameForCluster helper. Returns snapshot-management when the target cluster matches ManagementClusterName, otherwise snapshot-{cluster}.

main.go -- wire MANAGEMENT_CLUSTER_NAME env var through to EPGReconciler.

epg_controller_conformance_test.go -- add TestEPGReconciler_ManagementClusterSnapshotAlias.

Test plan

  • KUBEBUILDER_ASSETS=/tmp/envtest-bins/k8s/1.35.0-linux-amd64 go test ./test/integration/... -- all pass
  • go test ./test/unit/... -- all pass
  • Confirm snapshot-management name used in lab after deploying with MANAGEMENT_CLUSTER_NAME=ccs-mgmt

ontave added 2 commits May 2, 2026 10:18
Three fixes:
1. RBACPolicyReconciler: return Requeue:true after adding finalizer so
   GenerationChangedPredicate does not filter the follow-up reconcile
2. EPG integration test: set OperatorNamespace=security-system on
   EPGReconciler so PermissionSnapshot is created in the correct namespace
3. Lineage integration test: add required spec.permissions entry to
   PermissionSet probe to satisfy CRD validation

Closes GUARDIAN-BL-ENVTEST-FAIL.
EPGReconciler now accepts ManagementClusterName. When the target cluster
matches this name and no existing snapshot exists, the snapshot is named
snapshot-management instead of snapshot-{cluster}. This aligns with the
SeamMembership controller reference and eliminates the redundant
snapshot-ccs-mgmt object.

Wired from MANAGEMENT_CLUSTER_NAME env var in main.go.
@ontave ontave force-pushed the session/3-reconciler-bugs branch from ff21929 to c63db76 Compare May 2, 2026 08:20
ontave added 2 commits May 2, 2026 10:26
EPGReconciler.Recorder is clientevents.EventRecorder (k8s.io/client-go/tools/events),
not record.EventRecorder. Fix test instantiation to match the controller's interface.
…tern

RBACPolicyReconciler now returns Requeue=true after adding the finalizer
(GenerationChangedPredicate filters metadata-only updates). Tests that
verify audit events emitted during validation must reconcile twice.
@ontave ontave merged commit 6f2f109 into main May 2, 2026
2 checks passed
@ontave ontave deleted the session/3-reconciler-bugs branch May 2, 2026 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant