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
remove global variable dependency from admission plugins #84813
remove global variable dependency from admission plugins #84813
Conversation
cmd/kube-apiserver/app/aggregator.go
Outdated
@@ -73,6 +74,7 @@ func createAggregatorConfig( | |||
&genericConfig, | |||
externalInformers, | |||
genericConfig.LoopbackClientConfig, | |||
feature.DefaultMutableFeatureGate, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pass in feature.DefaultFeatureGate
, not the mutable one? (comment applies everywhere)
@@ -65,6 +68,7 @@ func NewRecommendedOptions(prefix string, codec runtime.Codec, processInfo *Proc | |||
Audit: NewAuditOptions(), | |||
Features: NewFeatureOptions(), | |||
CoreAPI: NewCoreAPIOptions(), | |||
FeatureGate: featuregate.NewFeatureGate(), // empty default features |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying to think what the implications of this are... having multiple feature gate instances floating around seems bad. Are we overriding this with our existing util featureGate buckets anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying to think what the implications of this are... having multiple feature gate instances floating around seems bad. Are we overriding this with our existing util featureGate buckets anywhere?
kube-apiserver does. I could choose to reference the on in the apiserver package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixing the feature gate impl to error if an unregistered feature is interrogated seems like a good path forward. #84865
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is a little strange that the default here will not have the generic apiserver features registered
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is a little strange that the default here will not have the generic apiserver features registered
to my knowledge, our recommend options don't include featuregates
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kubernetes/staging/src/k8s.io/apiserver/pkg/features/kube_features.go
Lines 157 to 167 in 62f66ea
APIResponseCompression: {Default: true, PreRelease: featuregate.Beta}, | |
APIListChunking: {Default: true, PreRelease: featuregate.Beta}, | |
DryRun: {Default: true, PreRelease: featuregate.Beta}, | |
RemainingItemCount: {Default: true, PreRelease: featuregate.Beta}, | |
ServerSideApply: {Default: true, PreRelease: featuregate.Beta}, | |
StorageVersionHash: {Default: true, PreRelease: featuregate.Beta}, | |
WinOverlay: {Default: false, PreRelease: featuregate.Alpha}, | |
WinDSR: {Default: false, PreRelease: featuregate.Alpha}, | |
WatchBookmark: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, | |
RequestManagement: {Default: false, PreRelease: featuregate.Alpha}, | |
RemoveSelfLink: {Default: false, PreRelease: featuregate.Alpha}, |
those?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have them defined, but we don't actually expose a way to wire them to options in the genericapiserver. Or at least I don't remember them in recommendedoptions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they're not wired to flags, but the API server still checks them in handlers, etc, so if they're not registered, I'm pretty sure the API server wouldn't run
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
asdf
aa596d9
to
08eca7f
Compare
Updated to use the featuregate defined in apiserver that is abused by so many others because it sits high in the stack. Left a comment for future developers to ponder their choices. |
/approve one unit test failure, lgtm otherwise |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: deads2k, liggitt The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
08eca7f
to
03a14f4
Compare
/lgtm |
03a14f4
to
01ac0cc
Compare
/lgtm |
/retest Review the full test history for this PR. Silence the bot with an |
01ac0cc
to
131512c
Compare
New changes are detected. LGTM label has been removed. |
updated per comment, retagging. |
/retest |
|
131512c
to
83f6f27
Compare
New changes are detected. LGTM label has been removed. |
@deads2k: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Adds an admission plugin initializer that passes a set of FeatureGates to the admission plugins during initialization that can then be used to set bool values and avoid coupling global variables together.
/kind cleanup
/priority important-soon
@kubernetes/sig-api-machinery-pr-reviews
@ravisantoshgudimetla this is how to remove the global dep from admission plugins