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

cmd/contour: optional CRDs #5080

Merged
merged 1 commit into from
Mar 3, 2023
Merged

Conversation

nsimons
Copy link
Member

@nsimons nsimons commented Feb 10, 2023

Allow disabling certain informers for CRDs by passing a command line flag to the serve command. This makes the corresponding CRD effectively optional.

I'd like some feedback on the terminology. Would the audience of the documents necessarily know what an informer is? Also feature is quite generic, but I tried to explain the intended meaning in this context. I'm open to other suggestions.

I tried to look for a good place to write some tests, but I didn't find much related to the flags. I have tested manually with the CRDs present/missing in my cluster.

Fixes #4684

Signed-off-by: Niklas Simons niklas.simons@est.tech

@nsimons nsimons requested a review from a team as a code owner February 10, 2023 15:04
@nsimons nsimons requested review from tsaarni and stevesloka and removed request for a team February 10, 2023 15:04
nsimons pushed a commit to Nordix/contour that referenced this pull request Feb 10, 2023
Allow disabling certain informers for CRDs by passing a
command line flag to the serve command. This makes the
corresponding CRD effectively optional.

Fixes projectcontour#4684

Signed-off-by: Niklas Simons <niklas.simons@est.tech>
@github-actions
Copy link

Hi @nsimons! Welcome to our community and thank you for opening your first Pull Request. Someone will review it soon. Thank you for committing to making Contour better. You can also join us on our mailing list and in our channel in the Kubernetes Slack Workspace

@tsaarni tsaarni added the release-note/minor A minor change that needs about a paragraph of explanation in the release notes. label Feb 10, 2023
@codecov
Copy link

codecov bot commented Feb 10, 2023

Codecov Report

Merging #5080 (ee16813) into main (b461e76) will decrease coverage by 0.03%.
The diff coverage is 10.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5080      +/-   ##
==========================================
- Coverage   78.01%   77.99%   -0.03%     
==========================================
  Files         138      138              
  Lines       17509    17516       +7     
==========================================
+ Hits        13660    13661       +1     
- Misses       3583     3589       +6     
  Partials      266      266              
Impacted Files Coverage Δ
cmd/contour/servecontext.go 80.83% <ø> (ø)
cmd/contour/serve.go 22.16% <10.00%> (-0.08%) ⬇️

Copy link
Member

@tsaarni tsaarni left a comment

Choose a reason for hiding this comment

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

This looks good to me 👍

Regarding terminology: "informer" to me is terminology from client-go, while "watch" could be more of an API level term used in this context?

In theory, disabled feature could be something else than CRD as well, like in Kubernetes --feature-gates option which could be seen conceptually similar to this feature. However, the ask here is of course for optional CRDs specifically (for the capability of skipping install of the CRDs), and the only features that can be disabled now are CRDs.

Some reasoning about potentially disabled features: I was commenting previously #4684 (comment) that the features included in this PR seem to me the only ones that make sense to be disabled currently because

  • ContourDeployement CRD needs to be installed only if executing contour gateway-provisioner. Executing it without the CRD does not make much sense either, so users make their choice by executing the provisioner.
  • The Gateway API CRDs (multiple CRDs) need to be installed only if Gateway API is configured. Optionality exists there via the config. So, no need for e.g. --disable-feature=gatewayapi

Reasoning to add a new command line option (like done by this PR), instead of having it in config, could be that this information is needed before ContourConfig CR is looked up.

There might be one small corner case now, if user would add both -disable-feature=contourconfigurations and --contour-config-name=myconfig where the latter would trigger initial lookup for the CR (code here) but user then asked for ignore updates to the CR.

Leaving for others to comment!

nsimons pushed a commit to Nordix/contour that referenced this pull request Feb 16, 2023
Allow disabling certain informers for CRDs by passing a
command line flag to the serve command. This makes the
corresponding CRD effectively optional.

Fixes projectcontour#4684

Signed-off-by: Niklas Simons <niklas.simons@est.tech>
@nsimons
Copy link
Member Author

nsimons commented Feb 16, 2023

Thanks for the feedback @tsaarni!

"watch" could be better, it's a more familiar term since that is also used e.g. with kubectl when watching for changes in objects. I'll leave this one open for now, if there are other opinions.

Nice catch with the corner case, disabling the feature while trying to use it would not make sense. Validation added.

Copy link
Member

@tsaarni tsaarni left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@nsimons
Copy link
Member Author

nsimons commented Feb 28, 2023

@skriss as you were involved in the original issue, would you like to review this as well?

Copy link
Member

@skriss skriss left a comment

Choose a reason for hiding this comment

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

I have just removed the ContourConfiguration informer entirely in #5133, since the informer wasn't being used and we don't have plans to use it any time soon. So, ContourConfiguration should now be optional in that if you don't use the --contour-config-name flag, then the CRD is not required to be present. I think because of that we can drop the special handling for that resource.

Even though this will now just apply to ExtensionService, I think it is reasonable to have a way to not require alpha resources to be installed, so still 👍 for going ahead with this.

cmd/contour/serve.go Outdated Show resolved Hide resolved
cmd/contour/serve.go Outdated Show resolved Hide resolved
site/content/docs/main/deploy-options.md Outdated Show resolved Hide resolved
site/content/docs/main/configuration.md Outdated Show resolved Hide resolved
changelogs/unreleased/5080-nsimons-minor.md Show resolved Hide resolved
Allow disabling certain informers for CRDs by passing a
command line flag to the serve command. This makes the
corresponding CRD effectively optional.

Fixes projectcontour#4684

Signed-off-by: Niklas Simons <niklas.simons@est.tech>
@nsimons nsimons requested review from skriss and removed request for stevesloka March 2, 2023 10:07
@nsimons
Copy link
Member Author

nsimons commented Mar 2, 2023

Thanks @skriss. Fixed the comments, I also double-checked that ContourConfiguration is now indeed optional by default.

Copy link
Member

@tsaarni tsaarni left a comment

Choose a reason for hiding this comment

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

Thank you @nsimons! Ignoring coverage targets for this one due to the nature of the change and merging since requested changes were made.

@tsaarni tsaarni merged commit 3cefa51 into projectcontour:main Mar 3, 2023
tsaarni pushed a commit to Nordix/contour that referenced this pull request Mar 7, 2023
Allow disabling certain informers for CRDs by passing a
command line flag to the serve command. This makes the
corresponding CRD effectively optional.

Fixes projectcontour#4684

Signed-off-by: Niklas Simons <niklas.simons@est.tech>
tsaarni pushed a commit to Nordix/contour that referenced this pull request Mar 7, 2023
Allow disabling certain informers for CRDs by passing a
command line flag to the serve command. This makes the
corresponding CRD effectively optional.

Fixes projectcontour#4684

Signed-off-by: Niklas Simons <niklas.simons@est.tech>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/minor A minor change that needs about a paragraph of explanation in the release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Optional CRD-s
3 participants