-
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
Add "server-feature-gates" flag. #18279
Conversation
/cc @ahrtr @serathius |
server/features/etcd_features.go
Outdated
// Every feature gate should add method here following this template: | ||
// | ||
// // owner: @username | ||
// // kep: https://kep.k8s.io/NNN (or issue: https://github.com/etcd-io/etcd/issues/NNN) | ||
// // alpha: v3.X | ||
// MyFeature featuregate.Feature = "MyFeature" | ||
// | ||
// Feature gates should be listed in alphabetical, case-sensitive | ||
// (upper before any lower case character) order. This reduces the risk | ||
// of code conflicts because changes are more likely to be scattered | ||
// across the file. | ||
|
||
// DistributedTracing enables experimental distributed tracing using OpenTelemetry Tracing. | ||
// alpha: v3.5 | ||
// issue: https://github.com/etcd-io/etcd/issues/12460 |
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.
How does Kubernetes manage this?
https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/
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.
what do you mean by "manage this"? The docs are created manually and enforced as part of release process.
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.
How can you make sure the comments, source code and user-facing doc are in sync? You don't have to do it in this PR, but please think about it.
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 comments in the source code will have to be manually reviewed. For the user facing doc, I have a POC in k8s to auto generate the feature list with lifecycles with static analysis. We can add similar scripts to do that
server/embed/config.go
Outdated
@@ -108,6 +110,8 @@ const ( | |||
maxElectionMs = 50000 | |||
// backend freelist map type | |||
freelistArrayType = "array" | |||
|
|||
ServerFeatureGateFlagName = "server-feature-gates" |
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.
ServerFeatureGateFlagName = "server-feature-gates" |
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.
Please see #18279 (comment)
8f81134
to
d0bfa58
Compare
AddFlag(fs *pflag.FlagSet) | ||
AddFlag(fs *flag.FlagSet, flagName string) |
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.
Is there a particular reason why you replaced pflag
with flag
?
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.
all the other flags in server/embed/config.go
uses flag
instead of pflag
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.
That is good to know. Thanks for your answer. I would think that using pflag
is better as it is POSIX-compliant, but I do see that across the project, we're using flag
for flagsets. We still parse flags using Cobra, which makes them POSIX-compliant.
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 #18279 +/- ##
=======================================
Coverage 68.90% 68.90%
=======================================
Files 417 418 +1
Lines 35338 35350 +12
=======================================
+ Hits 24348 24359 +11
- Misses 9566 9573 +7
+ Partials 1424 1418 -6 Continue to review full report in Codecov by Sentry.
|
/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 @siyuanfoundation - Overall this is looking good to me. Two minor items below.
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.
LGTM - Many thanks for the effort @siyuanfoundation
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.
LGTM. Thanks for addresing my comments, @siyuanfoundation. Great job 😀
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.
LGTM
server/etcdmain/help.go
Outdated
@@ -103,6 +105,8 @@ Member: | |||
Read timeout set on each rafthttp connection | |||
--raft-write-timeout '` + rafthttp.DefaultConnWriteTimeout.String() + `' | |||
Write timeout set on each rafthttp connection | |||
--feature-gates '' | |||
A set of key=value pairs that describe server level feature gates for alpha/experimental features. Options are:'` + strings.Join(features.NewDefaultServerFeatureGate("", nil).KnownFeatures(), ",") + `' |
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.
This is what I got. Please format the output, print each feature in a separate line.
--feature-gates ''
A set of key=value pairs that describe server level feature gates for alpha/experimental features. Options are:'AllAlpha=true|false (ALPHA - default=false),AllBeta=true|false (BETA - default=false),DistributedTracing=true|false (ALPHA - default=false),StopGRPCServiceOnDefrag=true|false (ALPHA - default=false)'
Please let me know if you want to fix it in this PR or a separate PR.
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.
updated
Signed-off-by: Siyuan Zhang <[email protected]>
/retest |
DistributedTracing: {Default: false, PreRelease: featuregate.Alpha}, | ||
StopGRPCServiceOnDefrag: {Default: false, PreRelease: featuregate.Alpha}, |
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.
You just added these two features, but they are still controlled by the legacy flags, are you going to migrate them to feature gate in a followup PR?
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.
Yes. They will be migrated in the next few followup PRs.
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.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ahrtr, fuweid, ivanvc, jmhbnz, serathius, siyuanfoundation 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 |
part of #18023
Please read https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#contribution-flow.