Export container healthcheck as LivenessProbe in generate kube#28664
Export container healthcheck as LivenessProbe in generate kube#28664givensuman wants to merge 1 commit into
Conversation
|
@givensuman (not a review) rebase on main to get past Mac OS arm64 issue. |
|
also, please consider squashing your commits and and running |
ae7241a to
b99948c
Compare
b99948c to
c821c01
Compare
| "--health-interval", "10s", | ||
| "--health-timeout", "5s", | ||
| "--health-retries", "3", | ||
| "--health-start-period", "2s", |
There was a problem hiding this comment.
This won't be generated, so do we need to include it?
There was a problem hiding this comment.
No, but now the tests are combined it makes sense to include for both.
c821c01 to
409d5c8
Compare
…kube Co-authored-by: givensuman <givensuman@duck.com> Signed-off-by: Devesh B <98201065+DeveshB-1@users.noreply.github.com> Signed-off-by: givensuman <givensuman@duck.com>
409d5c8 to
b7e885a
Compare
Honny1
left a comment
There was a problem hiding this comment.
I have some comments. Also, don't forget to add a release note and Fixes: to commit msg.
| probe := pod.Spec.Containers[0].LivenessProbe | ||
| Expect(probe).ToNot(BeNil(), "LivenessProbe should be set when container has a healthcheck") | ||
| Expect(probe.Exec).ToNot(BeNil()) | ||
| Expect(probe.Exec.Command).To(ContainElement(ctr.healthCmdExpect)) |
There was a problem hiding this comment.
| Expect(probe.Exec.Command).To(ContainElement(ctr.healthCmdExpect)) | |
| Expect(probe.Exec.Command).To(Equal([]string{"/bin/sh", "-c", "/bin/true"})) |
| testCases := []struct { | ||
| name string | ||
| healthCmd string | ||
| healthCmdExpect string |
There was a problem hiding this comment.
The healthCmdExpect should be []string. See my suggestion of assert. (It is not correct.)
| FailureThreshold: int32(hc.Retries), | ||
| } | ||
|
|
||
| if hc.Test[0] == define.HealthConfigTestCmdShell { |
There was a problem hiding this comment.
I would use switch something like this:
switch hc.Test[0] {
case define.HealthConfigTestCmd:
cmd = hc.Test[1:]
case define.HealthConfigTestCmdShell:
cmd = append([]string{"/bin/sh", "-c"}, hc.Test[1:]...)
default:
return nil
}
Checklist
Ensure you have completed the following checklist for your pull request to be reviewed:
commits. (
git commit -s). (If needed, usegit commit -s --amend). The author email must matchthe sign-off email address. See CONTRIBUTING.md
for more information.
Fixes: #00000in commit message (if applicable)make validatepr(format/lint checks)Noneif no user-facing changes)Does this PR introduce a user-facing change?
This PR aims to supersede stale PR #28415 and close #22095, implementing maintainer comments.
If approved I plan to squash down the commits and add myself as co-signer.