fix: ProviderConfig reconciler to filter usages by namespace#936
fix: ProviderConfig reconciler to filter usages by namespace#936kruthiwusirika5 wants to merge 1 commit intocrossplane:mainfrom
Conversation
aac6fe7 to
f27f023
Compare
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📝 WalkthroughWalkthroughThis PR fixes a bug where ProviderConfig deletion was incorrectly blocked when a same-named ProviderConfig existed in a different namespace. The reconciler now scopes ProviderConfigUsage queries to the specific namespace of the ProviderConfig being reconciled, preventing cross-namespace interference. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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
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.