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
sched: ensure feature gate is honored when instantiating scheduler #105915
sched: ensure feature gate is honored when instantiating scheduler #105915
Conversation
@Huang-Wei: This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The 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. |
/priority critical-urgent |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Huang-Wei 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 |
/retest |
fs.BoolVar(&o.EnableContentionProfiling, "contention-profiling", false, "DEPRECATED: enable lock contention profiling, if profiling is enabled. This parameter is ignored if a config file is specified in --config.") | ||
fs.StringVar(&o.Kubeconfig, "kubeconfig", "", "DEPRECATED: path to kubeconfig file with authorization and master location information. This parameter is ignored if a config file is specified in --config.") | ||
fs.StringVar(&o.ContentType, "kube-api-content-type", "", "DEPRECATED: content type of requests sent to apiserver. This parameter is ignored if a config file is specified in --config.") | ||
fs.Float32Var(&o.QPS, "kube-api-qps", 0, "DEPRECATED: QPS to use while talking with kubernetes apiserver. This parameter is ignored if a config file is specified in --config.") |
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 default value is not part of the output when doing --help
?
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.
Fair point. Updated the code to include default values.
I wonder if we need a more targeted fix that we can more easily backport. And leave this PR just for 1.23 |
also, I think we should remove all deprecated flags. |
Can we remove them in 1.23? If so, I can come up with a followup PR. This one should still be needed, as 1.22 have those deprecated options. |
dd11c3a
to
f3c7cc7
Compare
The bug lay in 1.22 is that leader elect and deprecated options are not honored. A "targeted" fix would be also non-trivial IMO, so I'm not sure it is worth the extra efforts. |
Just checking IIUC: the reason for the regression is that the feature gates are not loaded by the time we create the component config, correct? |
can we first revert #105712 in master (as it's urgent) and then have this PR (to be bakported) have the 2 commits? I think it would be useful to review the overall delta. |
Yes.
Do you mean to submit a separate PR to revert #105712, so it resolves the urgent CI failure (#105789). And then update this PR to resolve the leader election issue (#105704) thoroughly? |
f3c7cc7
to
93e3c19
Compare
Yes, that's what I mean. Wdyt?
…On Tue., Oct. 26, 2021, 6:17 p.m. Wei Huang, ***@***.***> wrote:
Just checking IIUC: the reason for the regression is that the feature
gates are not loaded by the time we create the component config, correct?
Yes.
can we first revert #105712
<#105712> in master (as it's
urgent) and then have this PR (to be bakported) have the 2 commits?
Do you mean to submit a separate PR to revert #105712
<#105712>, so it resolves
the urgent CI failure (#105789
<#105789>). And then
update this PR to resolve the leader election issue (#105704
<#105704>) thoroughly?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#105915 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJ5E6BTU6ZZZJCHB4PNCWDUI4SGXANCNFSM5GYKIWFQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Make sense to me. |
/retest |
I think we can, they have been in deprecated status for a long time. We already removed a bunch earlier this cycle. |
93e3c19
to
3070c71
Compare
SG, I will raise a follow-up PR. @alculquicondor The reverting PR has been merged. This PR will act as a pure fix and backporting candidate. |
// mapped into componentconfig.KubeSchedulerConfiguration. | ||
componentbaseconfig.DebuggingConfiguration | ||
componentbaseconfig.ClientConnectionConfiguration | ||
componentbaseconfig.LeaderElectionConfiguration |
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.
So some leader election flags don't take precedence, right?
Can you add a comment?
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's a bit tricky here. Two deprecated flags (--lock-object-name and --lock-object-namespace) overlapped with the regular non-deprecated options, so here LeaderElectionConfiguration only populates the deprecated ones.
Will add a comment here.
o := &Options{ | ||
SecureServing: apiserveroptions.NewSecureServingOptions().WithLoopback(), | ||
Authentication: apiserveroptions.NewDelegatingAuthenticationOptions(), | ||
Authorization: apiserveroptions.NewDelegatingAuthorizationOptions(), | ||
Deprecated: &DeprecatedOptions{}, | ||
Metrics: metrics.NewOptions(), | ||
Logs: logs.NewOptions(), | ||
LeaderElection: &componentbaseconfig.LeaderElectionConfiguration{ |
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.
doesn't componentbaseconfig offer a defaulting function? let's use that.
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 thought of it. There are a couple of shortcomings:
- componentbaseconfigv1alpha1 (not componentbaseconfig) offers a defaulting function to build a versioned obj. We use unversioned obj here, so need extra code to do the conversion bits.
- the defaulting logic in componentbaseconfigv1alpha1 still uses "endpoints" as the default lock name, however, it should be "leases" in latest k8s versions.
WDYT?
"k8s.io/kubernetes/pkg/scheduler/apis/config/validation" | ||
netutils "k8s.io/utils/net" | ||
) | ||
|
||
// Options has all the params needed to run a Scheduler | ||
type Options struct { | ||
// The default values. | ||
ComponentConfig kubeschedulerconfig.KubeSchedulerConfiguration | ||
ComponentConfig *kubeschedulerconfig.KubeSchedulerConfiguration |
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.
was this change absolutely necessary?
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 better have this as a defaulting CC obj is no longer offered in the very beginning, and hence if needed (like in some tests so far), we can use if cc == nil
to compose it. On the other hand, it's aligned with other structs in Options
.
cmd/kube-scheduler/app/server.go
Outdated
@@ -96,15 +89,17 @@ for more information about scheduling and the kube-scheduler component.`, | |||
}, | |||
} | |||
|
|||
opts.InitFlags() |
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.
Can we just call this as part of New?
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.
yup, good suggestion.
3070c71
to
16362c8
Compare
Comments addressed. PTAL. |
/lgtm |
/label tide/merge-method-squash |
Oops, the unit tests in the reverted weren't added in this PR. I will raise a PR to add those UTs back. |
What type of PR is this?
/kind regression
/sig scheduling
What this PR does / why we need it:
The logic of binding CLI args to CC fields brings maintenance burden due to the following limitations:
--config
is specified; otherwise default values are adoptedThis has caused bugs (#103440, #105704) and now regressions (#105789). So this PR tries to fix the problem thoroughly by breaking the binding from CLI args to CC field.
Which issue(s) this PR fixes:
Fixes #105704
Special notes for your reviewer:
This PR should be back-ported to 1.22.
Does this PR introduce a user-facing change?