-
Notifications
You must be signed in to change notification settings - Fork 39.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
Improve APIService auto-registration for HA/upgrade scenarios #51921
Conversation
a3dd9ba
to
80cef8d
Compare
cmd/kube-apiserver/app/aggregator.go
Outdated
go crdRegistrationController.Run(5, context.StopCh) | ||
go func() { | ||
// let the CRD controller register APIServices for existing CRDs before starting the autoregistration controller |
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 is it doing", not "why is it doing it". I can tell its waiting on priming for something, but its not obvious why that matters. Particularly since this won't gate a health check.
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.
clarified
func (c *autoRegisterController) checkAPIService(name string) error { | ||
// checkAPIService syncs the current APIService against a list of desired APIService objects | ||
// | ||
// Current: \ Desired: | A. not found | B. sync on start | C. sync always |
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 must be misunderstanding this table. I expected to see current \ desired
in the first column, but nothing has a backslash and most don't have two conditions. Is this column just "observed state"?
// 1. error | error | error | error | ||
// 2. not found | - | create once | create | ||
// 3. no sync | - | - | - | ||
// 4. sync on start, not present at start | - | - | - |
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 "not present at start" desired or actual state? I think its desired, but that wouldn't match the table header.
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.
x column was desired, y column was current. fixed the headers to clarify.
case apierrors.IsNotFound(err) && desired != nil: | ||
_, err := c.apiServiceClient.APIServices().Create(desired) | ||
return err | ||
|
||
// we aren't trying to manage this APIService. If the user removes the label, he's taken over management himself | ||
case curr.Labels[AutoRegisterManagedLabel] != "true": |
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 worked out nicely. Old controllers just stop messing with them.
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.
exactly. I'll still pick this back to 1.7, but this at least makes upgrades from 1.7 servers with this issue leave the new servers in a good state.
80cef8d
to
60170da
Compare
cmd/kube-apiserver/app/aggregator.go
Outdated
if allAvailable.Load().(bool) { | ||
return nil | ||
} | ||
|
||
items, err := aggregatorServer.APIRegistrationInformers.Apiregistration().InternalVersion().APIServices().Lister().List(labels.Everything()) |
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 only want to wait until everything has been observed at least once, right? Seems like that requires a watch from a listed resource version, not a lister since this lister is vulnerable to a create, then delete.
This pull makes it much less likely if you want to fix it later.
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.
switched to a watch
60170da
to
8ca6d99
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: deads2k, liggitt Associated issue: 51912 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
flake on #50695 |
/retest Review the full test history for this PR. |
1 similar comment
/retest Review the full test history for this PR. |
Automatic merge from submit-queue |
…1-upstream-release-1.7-1504632714 Automatic merge from submit-queue Automated cherry pick of #51921 Cherry pick of #51921 on release-1.7. Fixes #51912 Picking to 1.7.x due to impact on HA upgrades. /assign @deads2k cc @kubernetes/sig-api-machinery-bugs ```release-note Fixes an issue with APIService auto-registration affecting rolling HA apiserver restarts that add or remove API groups being served. ```
/assign @cheftako |
…1-upstream-release-1.7-1504632714 Automatic merge from submit-queue Automated cherry pick of #51921 Cherry pick of kubernetes/kubernetes#51921 on release-1.7. Fixes #51912 Picking to 1.7.x due to impact on HA upgrades. /assign @deads2k cc @kubernetes/sig-api-machinery-bugs ```release-note Fixes an issue with APIService auto-registration affecting rolling HA apiserver restarts that add or remove API groups being served. ``` Kubernetes-commit: f20e19779c9ef97c930ec1be080c78c1b33345f7
…1-upstream-release-1.7-1504632714 Automatic merge from submit-queue Automated cherry pick of #51921 Cherry pick of kubernetes/kubernetes#51921 on release-1.7. Fixes #51912 Picking to 1.7.x due to impact on HA upgrades. /assign @deads2k cc @kubernetes/sig-api-machinery-bugs ```release-note Fixes an issue with APIService auto-registration affecting rolling HA apiserver restarts that add or remove API groups being served. ``` Kubernetes-commit: f20e19779c9ef97c930ec1be080c78c1b33345f7
…1-upstream-release-1.7-1504632714 Automatic merge from submit-queue Automated cherry pick of #51921 Cherry pick of kubernetes/kubernetes#51921 on release-1.7. Fixes #51912 Picking to 1.7.x due to impact on HA upgrades. /assign @deads2k cc @kubernetes/sig-api-machinery-bugs ```release-note Fixes an issue with APIService auto-registration affecting rolling HA apiserver restarts that add or remove API groups being served. ``` Kubernetes-commit: f20e19779c9ef97c930ec1be080c78c1b33345f7
…1-upstream-release-1.7-1504632714 Automatic merge from submit-queue Automated cherry pick of #51921 Cherry pick of kubernetes/kubernetes#51921 on release-1.7. Fixes #51912 Picking to 1.7.x due to impact on HA upgrades. /assign @deads2k cc @kubernetes/sig-api-machinery-bugs ```release-note Fixes an issue with APIService auto-registration affecting rolling HA apiserver restarts that add or remove API groups being served. ``` Kubernetes-commit: f20e19779c9ef97c930ec1be080c78c1b33345f7
…1-upstream-release-1.7-1504632714 Automatic merge from submit-queue Automated cherry pick of #51921 Cherry pick of kubernetes/kubernetes#51921 on release-1.7. Fixes #51912 Picking to 1.7.x due to impact on HA upgrades. /assign @deads2k cc @kubernetes/sig-api-machinery-bugs ```release-note Fixes an issue with APIService auto-registration affecting rolling HA apiserver restarts that add or remove API groups being served. ``` Kubernetes-commit: f20e19779c9ef97c930ec1be080c78c1b33345f7
Fixes #51912
Required for 1.8 due to impact on HA upgrades.
/assign @deads2k
cc @kubernetes/sig-api-machinery-bugs