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

Fix duplicate GC event handlers getting added if discovery flutters #117992

Merged
merged 3 commits into from
Aug 15, 2023

Conversation

liggitt
Copy link
Member

@liggitt liggitt commented May 13, 2023

What type of PR is this?

/kind bug

What this PR does / why we need it:

The GC controller regularly (every 30 seconds) rediscovers available API types. Discovery can partially fail, resulting in a partial view of resource types available.

The GC controller then registers new event handlers for newly visible resource types, and forgets about event handlers for no-longer-visible resource types. This forgetting is problematic in multiple ways:

This PR keeps existing already-synced event handlers in place as long as discovery is failing to resolve their group/version.

In the resource quota controller, we already preserved previously seen resources in discovery error cases for similar reasons, this PR narrows that retention to just group/versions with discovery resolution errors and adds test coverage for it.

Does this PR introduce a user-facing change?

Fixes an issue with the garbagecollection controller registering duplicate event handlers if discovery requests fail.

/assign @munnerz @deads2k

@k8s-ci-robot k8s-ci-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label May 13, 2023
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. kind/bug Categorizes issue or PR as related to a bug. labels May 13, 2023
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels May 13, 2023
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/apps Categorizes an issue or PR as relevant to SIG Apps. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels May 13, 2023
@liggitt
Copy link
Member Author

liggitt commented May 13, 2023

/retest

1 similar comment
@liggitt
Copy link
Member Author

liggitt commented May 15, 2023

/retest

@liggitt liggitt added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. triage/accepted Indicates an issue or PR is ready to be actively worked on. labels May 15, 2023
@k8s-ci-robot k8s-ci-robot removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels May 15, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: liggitt

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

@munnerz
Copy link
Member

munnerz commented May 17, 2023

/lgtm
/hold for @deads2k

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm "Looks good to me", indicates that a PR is ready to be merged. labels May 17, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 9b1d6acc781717f842b0c3f9bdaef4957e704e2a

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 7, 2023
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 12, 2023
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 12, 2023
@liggitt
Copy link
Member Author

liggitt commented Aug 1, 2023

/retest

func GroupDiscoveryFailedErrorGroups(err error) (map[schema.GroupVersion]error, bool) {
var groupDiscoveryError *ErrGroupDiscoveryFailed
if err != nil && goerrors.As(err, &groupDiscoveryError) {
return groupDiscoveryError.Groups, true
Copy link
Contributor

Choose a reason for hiding this comment

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

Well, there's a inconveniently named field.

@deads2k
Copy link
Contributor

deads2k commented Aug 1, 2023

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 1, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 11a419fe1f14ee7105d168dcf9e2ec3bb6bee412

@liggitt
Copy link
Member Author

liggitt commented Aug 1, 2023

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 1, 2023
@liggitt
Copy link
Member Author

liggitt commented Aug 1, 2023

this is fine to merge for 1.29, I'll likely propose a backport after that

@liggitt liggitt added this to the v1.29 milestone Aug 10, 2023
@k8s-ci-robot k8s-ci-robot merged commit 7407f36 into kubernetes:master Aug 15, 2023
12 checks passed
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. 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/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. 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. sig/apps Categorizes an issue or PR as relevant to SIG Apps. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants