fix: ProviderConfig reconciler to filter usages by namespace#936
Conversation
aac6fe7 to
f27f023
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR scopes ProviderConfigUsage listing to the reconciled ProviderConfig's namespace when present, and records the ProviderConfig namespace in the reconciler's logging context. It prevents cross-namespace ProviderConfigUsage interference during deletion checks. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…rossplane/crossplane#7154) Signed-off-by: Sai Kruthi Wusirika <kruthi@multiscale.ai> Signed-off-by: Kruthi Wusirika <kruthiwusirika@gmail.com>
f27f023 to
2ddf578
Compare
|
Hi @jbw976 — this PR is ready for review when you have time. Summary: Fixes crossplane/crossplane#7154. When a ProviderConfig is namespaced, the reconciler now scopes the ProviderConfigUsage List to that namespace ( Changes: Scoped List for namespaced ProviderConfig, added namespace to reconciler log context, and two unit tests (namespaced → List with InNamespace, cluster-scoped → List without InNamespace).
|
|
Hi @phisco This PR is ready for review, kindly review it Summary: Fixes crossplane/crossplane#7154. When a ProviderConfig is namespaced, the reconciler now scopes the ProviderConfigUsage List to that namespace (InNamespace(pc.GetNamespace())), so a namespaced ProviderConfig is no longer blocked from deletion by usages in other namespaces. Cluster-scoped ProviderConfigs are unchanged. Changes: Scoped List for namespaced ProviderConfig, added namespace to reconciler log context, and two unit tests (namespaced → List with InNamespace, cluster-scoped → List without InNamespace). go test ./pkg/reconciler/providerconfig/... passes. CodeRabbit’s pre-merge checks passed (it hit rate limit before posting a full review). Happy to address any feedback. |
phisco
left a comment
There was a problem hiding this comment.
Thanks @kruthiwusirika5! LGTM, except for the linting issues, let me know when you manage to fix them 🙏
The MockList callbacks declared ctx and list parameters that are not used in the test bodies. Rename them to _ to satisfy revive's unused-parameter rule. Signed-off-by: Kruthi Wusirika <kruthiwusirika@gmail.com>
|
Two quick notes to help unblock this: 1. The CodeRabbit "Breaking Changes" pre-merge flag is a false positive. The full diff (both files) does not convert any exported type between
So the 2. The actual merge blocker looks like a stale approval, not a code issue. @phisco your approval from 2026-03-30 was against All checks (DCO, CodeRabbit walkthrough) are green on the new HEAD. Thanks! |
|
Gentle nudge @phisco — your approval was on the original commit; the only push since was a lint-only rename of two unused MockList parameters to satisfy revive. Branch protection is treating that as a stale approval and the PR is sitting at |
Fixes crossplane/crossplane#7154
What happened
When a ProviderConfig is namespaced, the reconciler listed ProviderConfigUsages by label only and did not scope the List to the ProviderConfig’s namespace. As a result, usages from other namespaces (e.g. a same-named ProviderConfig in another namespace) were counted, so a namespaced ProviderConfig could show
users: 1and be blocked from deletion even when all usages were in a different namespace.Changes
pc.GetNamespace() != "", addclient.InNamespace(pc.GetNamespace())to the list options so only ProviderConfigUsages in that namespace are considered. Cluster-scoped ProviderConfigs are unchanged (noInNamespaceoption)."namespace", pc.GetNamespace()in the reconciler’s structured log context to make per-namespace debugging easier when multiple same-named ProviderConfigs exist.ListUsagesScopedToNamespaceWhenNamespaced: asserts that when the ProviderConfig has a namespace,Listis called withInNamespaceset to that namespace.ListUsagesNotScopedToNamespaceWhenClusterScoped: asserts that when the ProviderConfig is cluster-scoped (empty namespace),Listis called without anInNamespaceoption.Testing
go test ./pkg/reconciler/providerconfig/...passes, including the new cases.