Skip to content

fix: pass ProviderConfigUsage cleaner to managed reconcilers - #482

Open
fernandezcuesta wants to merge 2 commits into
chore/bump-up-crossplane-runtime-to-v25from
pcu-cleaner-sql
Open

fernandezcuesta wants to merge 2 commits into
chore/bump-up-crossplane-runtime-to-v25from
pcu-cleaner-sql

Conversation

@fernandezcuesta

@fernandezcuesta fernandezcuesta commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Description of your changes

Since crossplane/crossplane-runtime#1113, the managed reconciler only protects ProviderConfigUsages when the scheme registers exactly one usage type per scope. provider-sql registers three per scope (mssql, mysql, postgresql), so every reconciler would silently get a no-op cleaner. This PR passes each reconciler's existing tracker through managed.WithProviderConfigUsageCleaner(t) in all 24 controllers.

This is stacked on #463, which brings in the runtime version with #1113. The new option does not exist before that version. Merge #463 first; this PR's base will then switch to master.

Fixes #481

I have:

  • Read and followed Crossplane's contribution process.
  • Run make reviewable to ensure this PR is ready for review.

How has this code been tested

go build ./..., go vet ./pkg/controller/... and go test ./pkg/controller/... pass. Not yet checked on a cluster that the usage finalizer is added and that ProviderConfig deletion waits for the managed resource.

@fernandezcuesta
fernandezcuesta added this pull request to stack #483 October 8, 2026 20:52
@fernandezcuesta
fernandezcuesta marked this pull request as ready for review October 8, 2026 20:52
@fernandezcuesta fernandezcuesta added this to the 0.17 milestone Oct 8, 2026
The scheme registers three ProviderConfigUsage types per scope, so
crossplane-runtime cannot pick one and falls back to a no-op cleaner,
leaving ProviderConfig deletion protection disabled. Pass each
reconciler's own tracker explicitly.

Fixes #481

Signed-off-by: Jesús Fernández <7312236+fernandezcuesta@users.noreply.github.com>
Signed-off-by: Jesús Fernández <7312236+fernandezcuesta@users.noreply.github.com>
@qlimenoque

qlimenoque commented Nov 5, 2026 •

Copy link
Copy Markdown

Tested this on a local cluster against v0.15.0, using the namespace-deletion case from #481 / crossplane/crossplane#4661.

Setup: k3s v1.35 (colima), Postgres 17 in-cluster, namespaced Schema with a ClusterProviderConfig. The provider ran out of cluster from source with --poll=15s: v0.15.0 vs this PR (#482) at 8b2737a, with each version's CRDs.

Scenario v0.15.0 #482
PCU after the Schema becomes Ready no finalizer finalizer.providerconfigusage.crossplane.io
Delete the namespace with a Ready Schema (3 runs on v0.15.0, 2 on #482) 3/3 stuck: connect failed: cannot track ProviderConfig usage: ... cannot create object ... unable to create new content in namespace 2/2 namespace gone in ~31s, schema dropped
Schema holds a table (RESTRICT drop fails with 2BP01), delete the Schema, then the namespace PCU swept, MR stuck on cannot create object PCU kept (deleting, finalizer held); MR keeps reporting the real 2BP01 error
Same, then patch dropBehavior: CASCADE still stuck, schema left in the DB namespace gone 6s after the patch, schema dropped, PCU released

No panics or errors in the provider log on #482. Looks good from our side.

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.

ProviderConfig deletion protection is a no-op because the scheme registers several ProviderConfigUsage types

2 participants