Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(gwapi): setup controllers dynamically when required CRDs get installed #3996

Merged
merged 4 commits into from
May 16, 2023

Conversation

czeslavo
Copy link
Contributor

@czeslavo czeslavo commented May 12, 2023

What this PR does / why we need it:

Adds a crds.DynamicController that ensures that RequiredCRDs are installed in the cluster and only then sets up all of its Controllers that depend on them. In case the CRDs are not installed at start-up time, DynamicController will set up a watch for CustomResourceDefinition and will dynamically set up its Controllers once it detects that all RequiredCRDs are already in place.

It's used for both the beta and alpha parts of the Gateway API.

Which issue this PR fixes:

Part of #3029.

Special notes for your reviewer:

PR Readiness Checklist:

Complete these before marking the PR as ready to review:

  • the CHANGELOG.md release notes have been updated to reflect any significant (and particularly user-facing) changes introduced by this PR

@czeslavo czeslavo self-assigned this May 12, 2023
@czeslavo czeslavo added area/feature New feature or request area/gateway-api Relating to upstream Kubernetes SIG Networking Gateway API labels May 12, 2023
@czeslavo czeslavo force-pushed the feat/dynamic-crd-controller branch from 6331f3b to 96ec1d0 Compare May 12, 2023 11:26
@codecov
Copy link

codecov bot commented May 12, 2023

Codecov Report

Patch coverage: 70.6% and project coverage change: -0.5 ⚠️

Comparison is base (8ce0421) 59.9% compared to head (2978bc1) 59.4%.

Additional details and impacted files
@@           Coverage Diff           @@
##            main   #3996     +/-   ##
=======================================
- Coverage   59.9%   59.4%   -0.5%     
=======================================
  Files        148     149      +1     
  Lines      16290   16399    +109     
=======================================
- Hits        9759    9753      -6     
- Misses      5898    6009    +111     
- Partials     633     637      +4     
Impacted Files Coverage Δ
internal/manager/scheme/scheme.go 22.5% <0.0%> (-2.5%) ⬇️
internal/controllers/crds/dynamic_controller.go 17.4% <17.4%> (ø)
internal/controllers/gateway/gateway_controller.go 12.6% <87.5%> (+1.2%) ⬆️
...ternal/controllers/gateway/httproute_controller.go 48.3% <90.0%> (-9.0%) ⬇️
internal/manager/controllerdef.go 98.8% <100.0%> (+<0.1%) ⬆️

... and 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@czeslavo czeslavo force-pushed the feat/dynamic-crd-controller branch from 96ec1d0 to 2d937be Compare May 12, 2023 16:33
@czeslavo czeslavo marked this pull request as ready for review May 12, 2023 17:17
@czeslavo czeslavo requested a review from a team as a code owner May 12, 2023 17:17
@czeslavo czeslavo requested a review from pmalek May 15, 2023 14:54
@czeslavo czeslavo requested a review from pmalek May 15, 2023 17:46
Copy link
Member

@pmalek pmalek left a comment

Choose a reason for hiding this comment

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

I believe we should add a changelog entry for this. WDYT @czeslavo ?

internal/controllers/gateway/gateway_controller.go Outdated Show resolved Hide resolved
@czeslavo czeslavo force-pushed the feat/dynamic-crd-controller branch from bc0b313 to 2978bc1 Compare May 16, 2023 10:56
@czeslavo czeslavo requested a review from pmalek May 16, 2023 11:02
Copy link
Member

@pmalek pmalek left a comment

Choose a reason for hiding this comment

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

👍 🚢

@czeslavo czeslavo enabled auto-merge (squash) May 16, 2023 11:54
@czeslavo czeslavo merged commit 4fa7cf0 into main May 16, 2023
25 checks passed
@czeslavo czeslavo deleted the feat/dynamic-crd-controller branch May 16, 2023 12:27
czeslavo added a commit to Kong/charts that referenced this pull request May 16, 2023
Adds watch and list permissions for 
apiextensions.k8s.io.customresourcedefinitions to controller's ClusterRole to
enable watching CRDs and start reconcilers dynamically once they get installed
implemented in Kong/kubernetes-ingress-controller#3996.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/feature New feature or request area/gateway-api Relating to upstream Kubernetes SIG Networking Gateway API size/XXL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants