-
Notifications
You must be signed in to change notification settings - Fork 894
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
introduce flag --feature-gates to karmadactl register #5970
base: master
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest |
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #5970 +/- ##
==========================================
- Coverage 48.23% 48.22% -0.02%
==========================================
Files 664 664
Lines 54749 54760 +11
==========================================
- Hits 26410 26406 -4
- Misses 26624 26638 +14
- Partials 1715 1716 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
/hold for more verification |
/hold cancel |
Signed-off-by: zhzhuang-zju <m17799853869@163.com>
c78b501
to
50be683
Compare
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.
/assign
flags.StringVar(&opts.FeatureGates, "feature-gates", "", ""+ | ||
"A set of key=value pairs that describe feature gates for alpha/experimental features. "+ | ||
"Options are:\n"+strings.Join(features.FeatureGate.KnownFeatures(), "\n")) |
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.
flags.StringVar(&opts.FeatureGates, "feature-gates", "", ""+ | |
"A set of key=value pairs that describe feature gates for alpha/experimental features. "+ | |
"Options are:\n"+strings.Join(features.FeatureGate.KnownFeatures(), "\n")) | |
features.FeatureGate.AddFlag(flags) |
Can we do that this way, which is the way we did at all the other components, like
features.FeatureGate.AddFlag(flags) |
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.
I've tried this way, but ran into an issue where I couldn't get the string value of the feature gates when injecting them into the agent's manifest.
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.
why?
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 worth noting that, you don't need to introduce an additional field into CommandRegisterOption
anymore.
FeatureGates 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.
why?
karmada/vendor/k8s.io/component-base/featuregate/feature_gate.go
Lines 122 to 153 in 7112723
// MutableFeatureGate parses and stores flag gates for known features from | |
// a string like feature1=true,feature2=false,... | |
type MutableFeatureGate interface { | |
FeatureGate | |
// AddFlag adds a flag for setting global feature gates to the specified FlagSet. | |
AddFlag(fs *pflag.FlagSet) | |
// Close sets closed to true, and prevents subsequent calls to Add | |
Close() | |
// Set parses and stores flag gates for known features | |
// from a string like feature1=true,feature2=false,... | |
Set(value string) error | |
// SetFromMap stores flag gates for known features from a map[string]bool or returns an error | |
SetFromMap(m map[string]bool) error | |
// Add adds features to the featureGate. | |
Add(features map[Feature]FeatureSpec) error | |
// GetAll returns a copy of the map of known feature names to feature specs. | |
GetAll() map[Feature]FeatureSpec | |
// AddMetrics adds feature enablement metrics | |
AddMetrics() | |
// OverrideDefault sets a local override for the registered default value of a named | |
// feature. If the feature has not been previously registered (e.g. by a call to Add), has a | |
// locked default, or if the gate has already registered itself with a FlagSet, a non-nil | |
// error is returned. | |
// | |
// When two or more components consume a common feature, one component can override its | |
// default at runtime in order to adopt new defaults before or after the other | |
// components. For example, a new feature can be evaluated with a limited blast radius by | |
// overriding its default to true for a limited number of components without simultaneously | |
// changing its default for all consuming components. | |
OverrideDefault(name Feature, override bool) error | |
} |
features.FeatureGate.AddFlag(flags)
has no method to get the string value of the feature gate. Hard to complete fmt.Sprintf(‘--feature-gates=%s’, o.FeatureGates)
.
I have a question: does it need to verify whether the user-defined featuregate is valid? The method
So, using the v1.13 version of karmadactl to execute the |
What type of PR is this?
/kind feature
What this PR does / why we need it:
introduce flag
--feature-gates
tokarmadactl register
to describe feature gates for alpha/experimental features ofkarmada-agent
.Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: