Skip to content

Decouple conversion webhook registration from leader election - #2122

Merged
sergenyalcin merged 2 commits into
crossplane-contrib:mainfrom
sergenyalcin:register-webhooks-seperately
Jun 23, 2026
Merged

Decouple conversion webhook registration from leader election#2122
sergenyalcin merged 2 commits into
crossplane-contrib:mainfrom
sergenyalcin:register-webhooks-seperately

Conversation

@sergenyalcin

@sergenyalcin sergenyalcin commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Description of your changes

Applies the upjet template fix for the conversion webhook / leader election bug (upjet#) to this provider.

  • hack/main.go.tmpl: removes StartWebhooks from both opts structs; adds an explicit startWebhooks block before the canSafeStart gate that calls SetupWebhookWithManager_<group> for both cluster-scoped and namespaced controllers. A comment at the call site explains why webhook registration must happen here rather than inside the gate.

  • config/templates/controller.go.tmpl: mirrors the upjet template change — adds SetupWebhookWithManager, removes the if o.StartWebhooks { ... } block from Setup.

  • Generated files: all zz_main.go, zz_controller.go, and zz_*_setup.go files regenerated from the updated templates.

Note: This PR uses the forked upjet dependency until the upjet PR is merged.

I have:

  • Read and followed Crossplane's contribution process.
  • Run make generate and committed the results (ideally in a separate commit).
  • Not made any manual changes to generated files, and verified this with make check-diff.

How has this code been tested

https://github.com/crossplane-contrib/provider-upjet-aws/actions/runs/27750948935

@sergenyalcin
sergenyalcin force-pushed the register-webhooks-seperately branch from 8c0d464 to ce26ef0 Compare June 18, 2026 08:02
@sergenyalcin

Copy link
Copy Markdown
Collaborator Author

/test-examples="examples/ec2/cluster/v1beta1/vpc.yaml"

@ulucinar ulucinar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @sergenyalcin for working debugging & fixing this issue.

Comment thread hack/main.go.tmpl
Signed-off-by: Sergen Yalçın <yalcinsergen97@gmail.com>
Signed-off-by: Sergen Yalçın <yalcinsergen97@gmail.com>
@sergenyalcin
sergenyalcin force-pushed the register-webhooks-seperately branch from 174e974 to 3b05311 Compare June 22, 2026 15:53
@sergenyalcin
sergenyalcin merged commit 1707df7 into crossplane-contrib:main Jun 23, 2026
8 checks passed
@sergenyalcin
sergenyalcin deleted the register-webhooks-seperately branch June 23, 2026 07:42
@sergenyalcin
sergenyalcin restored the register-webhooks-seperately branch June 23, 2026 07:43
@sergenyalcin
sergenyalcin deleted the register-webhooks-seperately branch June 23, 2026 07:43
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.

2 participants