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

Improve APIService auto-registration for HA/upgrade scenarios #51921

Merged
merged 4 commits into from
Sep 6, 2017

Conversation

liggitt
Copy link
Member

@liggitt liggitt commented Sep 5, 2017

Fixes #51912

Required for 1.8 due to impact on HA upgrades.

/assign @deads2k

cc @kubernetes/sig-api-machinery-bugs

Fixes an issue with APIService auto-registration affecting rolling HA apiserver restarts that add or remove API groups being served.

@k8s-ci-robot k8s-ci-robot added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. kind/bug Categorizes issue or PR as related to a bug. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Sep 5, 2017
@k8s-github-robot k8s-github-robot added the do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. label Sep 5, 2017
@liggitt liggitt force-pushed the local-apiservice branch 3 times, most recently from a3dd9ba to 80cef8d Compare September 5, 2017 03:49
go crdRegistrationController.Run(5, context.StopCh)
go func() {
// let the CRD controller register APIServices for existing CRDs before starting the autoregistration controller
Copy link
Contributor

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.

Copy link
Member Author

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

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

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.

Copy link
Member Author

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":
Copy link
Contributor

@deads2k deads2k Sep 5, 2017

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.

Copy link
Member Author

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.

@liggitt liggitt added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Sep 5, 2017
@liggitt liggitt added this to the v1.8 milestone Sep 5, 2017
@liggitt liggitt added priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. cherrypick-candidate labels Sep 5, 2017
if allAvailable.Load().(bool) {
return nil
}

items, err := aggregatorServer.APIRegistrationInformers.Apiregistration().InternalVersion().APIServices().Lister().List(labels.Everything())
Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

switched to a watch

@deads2k
Copy link
Contributor

deads2k commented Sep 5, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 5, 2017
@k8s-github-robot
Copy link

[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 /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 5, 2017
@liggitt
Copy link
Member Author

liggitt commented Sep 5, 2017

flake on #50695
/test pull-kubernetes-e2e-gce-etcd3

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to @fejta).

Review the full test history for this PR.

1 similar comment
@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to @fejta).

Review the full test history for this PR.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit bd4aaf4 into kubernetes:master Sep 6, 2017
@liggitt liggitt deleted the local-apiservice branch September 6, 2017 13:09
k8s-github-robot pushed a commit that referenced this pull request Sep 7, 2017
…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.
```
@lavalamp
Copy link
Member

lavalamp commented Sep 7, 2017

/assign @cheftako

sttts pushed a commit to sttts/kube-aggregator that referenced this pull request Sep 22, 2017
…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
sttts pushed a commit to sttts/kube-aggregator that referenced this pull request Oct 14, 2017
…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
sttts pushed a commit to sttts/kube-aggregator that referenced this pull request Oct 16, 2017
…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
@jpbetz jpbetz added cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. and removed cherrypick-candidate labels Oct 25, 2017
sttts pushed a commit to sttts/kube-aggregator that referenced this pull request Jan 9, 2018
…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
k8s-publishing-bot added a commit to kubernetes/kube-aggregator that referenced this pull request Jan 11, 2018
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants