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

Ensure invalid cluster-scoped children do not block cleanup of valid namespaced children #98068

Merged
merged 2 commits into from Jan 15, 2021

Conversation

liggitt
Copy link
Member

@liggitt liggitt commented Jan 14, 2021

What type of PR is this?

/kind bug

Which issue(s) this PR fixes:
Fixes #98040

  • First commit:
    • adds a unit test exercising both scenario orders (bad child -> good child, and good child -> bad child)
    • unit tests assert an expected steady state, which fails in the bad child -> good child order
  • Second commit:
    • fixes the bug
    • adjusts the unit test for the bad scenario to add new intermediate steps (but leaves the end steady state assertion as-is)
    • adds a new unit test for the same scenario with a late-observed parent (as opposed to a missing parent) to verify a good child is not deleted incorrectly

Does this PR introduce a user-facing change?:

Fixed an issue with garbage collection failing to clean up namespaced children of an object also referenced incorrectly by cluster-scoped children

/cc @enj
/sig api-machinery

@k8s-ci-robot k8s-ci-robot requested a review from enj January 14, 2021 15:44
@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. kind/bug Categorizes issue or PR as related to a bug. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. 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. sig/apps Categorizes an issue or PR as relevant to SIG Apps. labels Jan 14, 2021
@liggitt liggitt changed the title WIP - Ensure invalid cluster-scoped children do not block cleanup of valid namespaced children Ensure invalid cluster-scoped children do not block cleanup of valid namespaced children Jan 14, 2021
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 14, 2021
@liggitt
Copy link
Member Author

liggitt commented Jan 14, 2021

/priority important-soon
/triage accepted

@k8s-ci-robot k8s-ci-robot 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. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jan 14, 2021
@enj
Copy link
Member

enj commented Jan 14, 2021

LGTM but needs a review from someone more familiar with the GC controller.

@liggitt
Copy link
Member Author

liggitt commented Jan 14, 2021

/retest

/cc @jpbetz

},
{
// https://github.com/kubernetes/kubernetes/issues/98040
name: "namespaced good child, cluster-scoped bad child, missing parent",
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, this is like "cluster-scoped bad child, namespaced good child, missing parent" except the order the children are observed/processed is swapped. I didn't realize when first reading the test names that ordering was important.

assertState(state{
clientActions: []string{
"get /v1, Resource=pods ns=ns1 name=podname2", // get good child, returns 200
"get /v1, Resource=pods ns=ns1 name=podname1", // get missing parent, returns 404
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these gets informational or are they required for the test? I'm curious because we don't check the response codes.

Copy link
Contributor

@jpbetz jpbetz left a comment

Choose a reason for hiding this comment

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

This all looks right to me. I spent most of my time reviewing the tests to convince myself they cover the cases described in #98040.

Added two comments, which are non-blocking and primarily for my understanding.

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jpbetz, 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

@k8s-ci-robot k8s-ci-robot merged commit a9e2e18 into kubernetes:master Jan 15, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.21 milestone Jan 15, 2021
@liggitt liggitt deleted the gc-owner branch January 20, 2021 18:30
k8s-ci-robot added a commit that referenced this pull request Jan 29, 2021
…8-upstream-release-1.20

Automated cherry pick of #98068: Ensure invalid cluster-scoped children do not block cleanup of valid namespaced children
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.

Inconsistent garbage collection behavior when any ownerReference is unresolvable and the parent is deleted
4 participants