-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
featuregate: adds EtcdServer.FeatureEnabled interface. #18062
Conversation
Hi @stackbaek. Thanks for your PR. I'm waiting for a etcd-io member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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-sigs/prow repository. |
/assign @siyuanfoundation |
per conversation with @siyuanfoundation - I imported |
@stackbaek Don't forget to signoff your commit with |
LGTM, Thanks @stackbaek! |
are we going to have issues with cyclic imports with k8s then?
|
neither apimachinery nor component-base depend on etcd. I don't see there is any cyclic dependency. |
Updated commit to copy component-base |
/ok-to-test |
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files
... and 21 files with indirect coverage changes @@ Coverage Diff @@
## main #18062 +/- ##
==========================================
- Coverage 68.99% 68.92% -0.07%
==========================================
Files 416 417 +1
Lines 35127 35303 +176
==========================================
+ Hits 24235 24333 +98
- Misses 9503 9552 +49
- Partials 1389 1418 +29 Continue to review full report in Codecov by Sentry.
|
LGTM. Can you fix the verify error? Thank you! |
The interface can be used throughout the etcd server binary to check if the feature is enabled or not. Note that this commit also copies necessary FeatureGate interface from k8s component-base. Signed-off-by: Baek <[email protected]>
We'll likely use most of the feature_gate package from component-base. Also this commit moves the pkg from server/internal/pkg to pkg/. Signed-off-by: Baek <[email protected]>
The removed packages are: * k8s.io/apimachinery/pkg/util/naming * k8s.io/klog/v2 Do note that removing naming package necessitates adding feature gate name argument to featuregate.New(). Signed-off-by: Baek <[email protected]>
/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.
Thanks for implementing the foundation for the server-level feature gate @stackbaek!
I will implement my 2 TODOs :)
/retest |
2 similar comments
/retest |
/retest |
/cc @ahrtr |
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.
Overall looks good with a couple minor comments.
Thanks.
// FeatureGate indicates whether a given feature is enabled or not | ||
type FeatureGate interface { |
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.
// FeatureGate indicates whether a given feature is enabled or not | |
type FeatureGate interface { | |
// FeaturesGate is an interface for managing all features. It provides functionality | |
// to query all known features and determine whether a specific feature is enabled. | |
type FeaturesGate interface { |
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.
Thanks for the review! While I do see FeaturesGate
captures what it actually does (gates all features), the name FeatureGate
is taken from k8s component-base and it seems to be used more widely (~177k match in github) than FeaturesGate
(~270). If you don't feel strongly for this name, I do want to keep the name as FeatureGate
. WDYT?
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.
the name
FeatureGate
is taken from k8s component-base and it seems to be used more widely (~177k match in github)
Yes, I know it's copied from k8s component-base. I guess the ~177K match
is jus because everyone (including this PR) just copied the name.
Feel free to keep it as it's since the naming has already been widely used & accepted.
@@ -207,6 +208,9 @@ type ServerConfig struct { | |||
|
|||
// ExperimentalLocalAddress is the local IP address to use when communicating with a peer. | |||
ExperimentalLocalAddress string `json:"experimental-local-address"` | |||
|
|||
// ServerFeatureGate is a server level feature gate | |||
ServerFeatureGate featuregate.FeatureGate |
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.
ServerFeatureGate featuregate.FeatureGate | |
ServerFeaturesGate featuregate.FeaturesGate |
The interface can be used throughout the etcd server binary to check if the feature is enabled or not.
Related task: #18047
Please read https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#contribution-flow.