-
Notifications
You must be signed in to change notification settings - Fork 38.9k
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
Execution retry and timeout of lifecycle hooks #46426
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: PengTaoWW Assign the PR to them by writing
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://github.com/kubernetes/kubernetes/wiki/CLA-FAQ to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
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. |
Hi @PengTaoWW. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with 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. |
417a48a
to
eb54b37
Compare
/assign @brendandburns |
@timstclair @brendandburns Is there anything else I need to solve? |
api/swagger-spec/apps_v1alpha1.json
Outdated
}, | ||
"retryUntilSuccess": { | ||
"$ref": "v1.Handler", | ||
"description": "PreStop is called immediately before a container is terminated. The container is terminated after the handler completes. The reason for termination is passed to the handler. Regardless of the outcome of the handler, the container is eventually terminated. Other management of the container blocks until the hook completes. More info: http://kubernetes.io/docs/user-guide/container-environment#hook-details" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/PreStop/RetryUntilSuccess
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my bad ,i will fixed this
defer close(done) | ||
defer utilruntime.HandleCrash() | ||
if msg, err := m.runner.Run(containerID, pod, containerSpec, containerSpec.Lifecycle.RetryUntilSuccess); err != nil { | ||
glog.Errorf("preStop hook for container %q failed: %v", containerSpec.Name, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/preStop/retryUntilSuccess
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i wil fixed this
} | ||
|
||
} | ||
}() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the hook never succeeds? The container will get stuck, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after some times, code line 505 will run .not get stuck
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code line 505 will run , never get stuck
}() | ||
|
||
select { | ||
case <-time.After(time.Duration(gracePeriod) * time.Second): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xiangpengzhao this line code will run in after long time . not stuck
} | ||
|
||
} | ||
}() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after some times, code line 505 will run .not get stuck
defer close(done) | ||
defer utilruntime.HandleCrash() | ||
if msg, err := m.runner.Run(containerID, pod, containerSpec, containerSpec.Lifecycle.RetryUntilSuccess); err != nil { | ||
glog.Errorf("preStop hook for container %q failed: %v", containerSpec.Name, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i wil fixed this
eb54b37
to
c08d48a
Compare
Hrm, |
(oops, didn't mean to close...) |
@brendandburns So you mean
like this ? |
c08d48a
to
4a564fd
Compare
@brendandburns i write a version code for add a boolean to enable this behavior for the existing pre-stop handler. |
@timstclair @brendandburns @xiangpengzhao Is this version all right? |
9332290
to
d3b10a0
Compare
d3b10a0
to
c3b09ae
Compare
@timstclair @xiangpengzhao @brendandburns sorry about I lost the version of my local clean code, and now I have only the version after the code is generated. What am I going to do? |
@timstclair @xiangpengzhao @brendandburns sorry about I lost the version of my local clean code, and now I have only the version after the code is generated. What am I going to do? |
1 similar comment
@timstclair @xiangpengzhao @brendandburns sorry about I lost the version of my local clean code, and now I have only the version after the code is generated. What am I going to do? |
c3b09ae
to
417d30f
Compare
5cb7fa1
to
e02fc71
Compare
/test pull-kubernetes-e2e-kops-aws |
866acae
to
c35be2d
Compare
c35be2d
to
0eb0bb4
Compare
@PengTaoWW: The following tests failed, say
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. |
@PengTaoWW PR needs rebase |
This PR hasn't been active in 90 days. Closing this PR. Please reopen if you would like to work towards merging this change, if/when the PR is ready for the next round of review. cc @PengTaoWW @brendandburns @timstclair You can add 'keep-open' label to prevent this from happening again, or add a comment to keep it open another 90 days |
What this PR does / why we need it:
I have an improvement on Kubernetes, in our production environment, run perstop hook when removing pod, but no matter how quickly the result of this pod is removed, my improvement is that when Perstop fails, it will retry until the execution s
ucceeds, or the timeout is removed. I have implemented a version of this feature myself. if there's a problem with my improvement, please let me know, thank you.
and this time i clear code .just my patch not auto-generated code
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #Special notes for your reviewer:
please help me ,this is my first submit code .
Release note: