Skip to content

Introducing Sleep Action for PreStop Hook#119026

Merged
k8s-ci-robot merged 5 commits into
kubernetes:masterfrom
AxeZhan:sleepAction
Oct 16, 2023
Merged

Introducing Sleep Action for PreStop Hook#119026
k8s-ci-robot merged 5 commits into
kubernetes:masterfrom
AxeZhan:sleepAction

Conversation

@AxeZhan

@AxeZhan AxeZhan commented Jul 3, 2023

Copy link
Copy Markdown
Member

What type of PR is this?

/kind feature

What this PR does / why we need it:

This is the implementation for kubernetes/enhancements#3960

Which issue(s) this PR fixes:

Fixes #114465

Special notes for your reviewer:

Does this PR introduce a user-facing change?

A new sleep action for the PreStop lifecycle hook is added, allowing containers to pause for a specified duration before termination.

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

detailed KEP: https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/3960-pod-lifecycle-sleep-action/README.md

@k8s-ci-robot k8s-ci-robot added 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/feature Categorizes issue or PR as related to a new feature. 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 Jul 3, 2023
@k8s-ci-robot k8s-ci-robot added area/code-generation area/kubelet area/test kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API 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. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jul 3, 2023
Comment thread pkg/apis/core/validation/validation.go Outdated
Comment thread test/e2e/common/node/lifecycle_hook.go Outdated
@AxeZhan

AxeZhan commented Jul 3, 2023

Copy link
Copy Markdown
Member Author

/cc @thockin for review and help first🙏

@k8s-triage-robot

Copy link
Copy Markdown

This PR may require API review.

If so, when the changes are ready, complete the pre-review checklist and request an API review.

Status of requested reviews is tracked in the API Review project.

@jiahuif

jiahuif commented Jul 6, 2023

Copy link
Copy Markdown
Contributor

/assign @thockin
For approval
/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jul 6, 2023
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jul 11, 2023
@k8s-ci-robot k8s-ci-robot requested a review from thockin October 8, 2023 10:08
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 13, 2023

@thockin thockin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Close!

Comment thread pkg/kubelet/lifecycle/handlers.go Outdated
Comment thread test/e2e/common/node/lifecycle_hook.go Outdated
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 15, 2023
@AxeZhan

AxeZhan commented Oct 15, 2023

Copy link
Copy Markdown
Member Author

fixed and rebased

@thockin thockin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

/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 Oct 15, 2023
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: ec6af00916adc78a0e7207e01c3860b413e25be1

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 15, 2023
@thockin

thockin commented Oct 15, 2023

Copy link
Copy Markdown
Member

Verify failure looks real.

@k8s-ci-robot k8s-ci-robot removed the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 16, 2023
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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 commented Oct 16, 2023

Copy link
Copy Markdown
Contributor

@AxeZhan: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kubernetes-linter-hints 5c0618b link false /test pull-kubernetes-linter-hints

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.

Details

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.

@AxeZhan

AxeZhan commented Oct 16, 2023

Copy link
Copy Markdown
Member Author

@thockin Need a new lgtm after generated codes are pushed.

@pacoxu

pacoxu commented Oct 16, 2023

Copy link
Copy Markdown
Member

/lgtm

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: 221a418cd4244e50d74a82ca0393807daddcf8ba

@pacoxu

pacoxu commented Oct 16, 2023

Copy link
Copy Markdown
Member

/skip

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hi, Axe. Sorry to leave comment on your PR. I have a quick question would to ask for about how to generate this core/v1/generated.pb.go from go struct definition on K8S resource.

We have a use case that we define a CRD defined in go struct, and we need to generate the proto related methods for marshal/unmarshal. But we could not successfully generate them.

We are trying to use protoc-gen-gogo and go-to-protobuf, but could not make fully work.

Do you mind share what's the commands should be used to auto gen "core/v1/generated.proto" and "core/v1/generated.pb.go" files based on types.go file?

Really appreciate your help and answers.

Thanks

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Hmmm, not sure how CRD codes are generated, but you can refer to https://github.com/kubernetes/kubernetes/blob/master/hack/update-codegen.sh In tree structs use this to generate.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for your immediate answer. This code pointer is very useful and very promising. Let me take a look. Thanks

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

One more question, when you update k8s native resource, what script do you run to update the generated proto and pb.go? Did you just need to run "kubernetes/blob/master/hack/update-all.sh" script, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yes:)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks

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. area/code-generation area/kubelet area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. 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. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Projects

Archived in project
Archived in project

Development

Successfully merging this pull request may close these issues.

pod LifecycleHandler should support a sleep option