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

Add "server-feature-gates" flag. #18279

Merged
merged 1 commit into from
Jul 23, 2024
Merged

Conversation

siyuanfoundation
Copy link
Contributor

@siyuanfoundation
Copy link
Contributor Author

/cc @ahrtr @serathius

Comment on lines 26 to 41
// 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
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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 Show resolved Hide resolved
@@ -108,6 +110,8 @@ const (
maxElectionMs = 50000
// backend freelist map type
freelistArrayType = "array"

ServerFeatureGateFlagName = "server-feature-gates"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ServerFeatureGateFlagName = "server-feature-gates"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please see #18279 (comment)

Comment on lines -101 to +102
AddFlag(fs *pflag.FlagSet)
AddFlag(fs *flag.FlagSet, flagName string)
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Member

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-commenter
Copy link

codecov-commenter commented Jul 12, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 69.23077% with 4 lines in your changes missing coverage. Please review.

Project coverage is 68.90%. Comparing base (e7f5729) to head (bfad3ff).
Report is 324 commits behind head on main.

Current head bfad3ff differs from pull request most recent head 7b35514

Please upload reports for the commit 7b35514 to get more accurate results.

Files with missing lines Patch % Lines
pkg/featuregate/feature_gate.go 60.00% 1 Missing and 1 partial ⚠️
server/features/etcd_features.go 60.00% 1 Missing and 1 partial ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
Files with missing lines Coverage Δ
server/embed/config.go 79.02% <100.00%> (+0.07%) ⬆️
server/embed/etcd.go 75.86% <100.00%> (+0.04%) ⬆️
pkg/featuregate/feature_gate.go 84.41% <60.00%> (-0.92%) ⬇️
server/features/etcd_features.go 60.00% <60.00%> (ø)

... 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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e7f5729...7b35514. Read the comment docs.

@jmhbnz
Copy link
Member

jmhbnz commented Jul 16, 2024

/retest

Copy link
Member

@jmhbnz jmhbnz left a 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.

server/etcdmain/help.go Show resolved Hide resolved
server/etcdmain/config_test.go Show resolved Hide resolved
Copy link
Member

@jmhbnz jmhbnz left a 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

Copy link
Member

@ivanvc ivanvc left a 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 😀

Copy link
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -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(), ",") + `'
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

server/etcdmain/help.go Outdated Show resolved Hide resolved
@siyuanfoundation
Copy link
Contributor Author

/retest

Comment on lines +52 to +53
DistributedTracing: {Default: false, PreRelease: featuregate.Alpha},
StopGRPCServiceOnDefrag: {Default: false, PreRelease: featuregate.Alpha},
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

@ahrtr ahrtr left a comment

Choose a reason for hiding this comment

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

Overall looks good to me with a question.

Thanks @siyuanfoundation

cc @serathius

@k8s-ci-robot
Copy link

[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:
  • OWNERS [ahrtr,jmhbnz,serathius]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@serathius serathius merged commit 3b4e2f4 into etcd-io:main Jul 23, 2024
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

8 participants