Skip to content

Make pod eviction trigger graceful deletion to match deletion via API #72730

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

Merged
merged 1 commit into from
Jan 29, 2019

Conversation

liggitt
Copy link
Member

@liggitt liggitt commented Jan 9, 2019

What type of PR is this?
/kind bug

What this PR does / why we need it:
Makes pod eviction with no DeleteOptions match direct pod deletion with no DeleteOptions w.r.t. graceful deletion behavior

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

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Pod eviction now honors graceful deletion by default if no delete options are provided in the eviction request

/sig apps

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

liggitt commented Jan 11, 2019

/retest

1 similar comment
@liggitt
Copy link
Member Author

liggitt commented Jan 12, 2019

/retest

@liggitt liggitt force-pushed the eviction-graceful-deletion branch from 7dfa408 to ee67364 Compare January 13, 2019 06:49
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jan 13, 2019
@liggitt
Copy link
Member Author

liggitt commented Jan 14, 2019

@kubernetes/sig-apps-pr-reviews @kubernetes/sig-scheduling-pr-reviews

@k8s-ci-robot k8s-ci-robot added the sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. label Jan 14, 2019
deletionOptions := eviction.DeleteOptions
if deletionOptions == nil {
// default to non-nil to trigger graceful deletion
deletionOptions = &metav1.DeleteOptions{}
Copy link
Contributor

Choose a reason for hiding this comment

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

if deletionOpt is nil, we're going to use default grace period?

Copy link
Member Author

Choose a reason for hiding this comment

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

eviction without delete options would behave like delete without delete options

This is a behavior change. We need to decide if eviction (which is intended to allow safe deletion of pods according to pod disruption budget) essentially force deleting pods by default is a problem worth fixing.

Notably, kubectl drain never passes nil delete options, which is good. https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/cmd/drain/drain.go#L526)

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 a behavior change.

Yes; but it seems a "correction" instead of "change" considering "delete without options" :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes; but it seems a "correction" instead of "change" considering "delete without options" :)

I don't disagree, but would like an ack from @kubernetes/api-approvers

Copy link
Member

Choose a reason for hiding this comment

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

I agree.

@liggitt
Copy link
Member Author

liggitt commented Jan 15, 2019

cc @kubernetes/api-reviewers

@liggitt
Copy link
Member Author

liggitt commented Jan 15, 2019

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 15, 2019
@liggitt
Copy link
Member Author

liggitt commented Jan 24, 2019

/assign @thockin

what's your take on changing pod eviction to behave like pod deletion w.r.t. honoring graceful deletion by default? currently if you submit a pod eviction without delete options, it force deletes the pod, which seems at odds with the intent of pod eviction as a safe way to remove pods

@liggitt
Copy link
Member Author

liggitt commented Jan 24, 2019

/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 Jan 24, 2019
@thockin
Copy link
Member

thockin commented Jan 26, 2019

Do we have no test coverage for this?

Unverified

The committer email address is not verified.
@liggitt
Copy link
Member Author

liggitt commented Jan 26, 2019

Do we have no test coverage for this?

only incidentally as part of the node authorizer integration test, apparently.

kubectl drain always passed delete options, so this change did not affect it either way.

added unit test coverage

@liggitt liggitt force-pushed the eviction-graceful-deletion branch from ee67364 to cdfb5d3 Compare January 26, 2019 04:36
Copy link
Member

@thockin thockin left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: liggitt, thockin

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

@liggitt
Copy link
Member Author

liggitt commented Jan 29, 2019

/retest

@k8s-ci-robot k8s-ci-robot merged commit 44d1859 into kubernetes:master Jan 29, 2019
@k8s-ci-robot
Copy link
Contributor

@liggitt: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-e2e-kops-aws cdfb5d3 link /test pull-kubernetes-e2e-kops-aws

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

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. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Eviction API ignoring preStop hook and terminationGracePeriodSeconds when DeleteOptions are not present
4 participants