-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
podman play kube support container startup probe #16794
Conversation
/kind feature |
6d8caed
to
da5cc61
Compare
agent does not respond, rerun the test. |
* podman kube play support startup probe * make probe use json string array instead of CMD-SHELL Signed-off-by: Liang Chu-Xuan <[email protected]>
Thanks for opening the PR. I will take a close look early next week. In general, I recommend to open an issue before opening a PR. This gives us a chance to discuss how to best implement the feature. @mheon PTAL |
Code seems OK here, but someone more familiar with K8S should review. @umohnani8 PTAL |
// configure healthcheck on the basis of Handler Actions. | ||
switch { | ||
case probeHandler.Exec != nil: | ||
cmd, err := json.Marshal(probeHandler.Exec.Command) |
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.
it's not immediately obvious to me why this works. do you have a go doc reference or code you based this off that could explain why/how it works?
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.
podman/pkg/specgen/generate/kube/kube.go
Lines 562 to 580 in 02b7866
func makeHealthCheck(inCmd string, interval int32, retries int32, timeout int32, startPeriod int32) (*manifest.Schema2HealthConfig, error) { | |
// Every healthcheck requires a command | |
if len(inCmd) == 0 { | |
return nil, errors.New("must define a healthcheck command for all healthchecks") | |
} | |
// first try to parse option value as JSON array of strings... | |
cmd := []string{} | |
if inCmd == "none" { | |
cmd = []string{define.HealthConfigTestNone} | |
} else { | |
err := json.Unmarshal([]byte(inCmd), &cmd) | |
if err != nil { | |
// ...otherwise pass it to "/bin/sh -c" inside the container | |
cmd = []string{define.HealthConfigTestCmdShell} | |
cmd = append(cmd, strings.Split(inCmd, " ")...) | |
} | |
} |
the function makeHealthCheck
supports input string as a json array :D
one request for an additional comment, but in general LGTM. the json.Marshal trick is slick |
I am sorry for that :( |
* also, change makeHealthCheck to the standard test command structure Signed-off-by: Liang Chu-Xuan <[email protected]>
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: karta0807913, rhatdan 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 |
Does this mean startup probes are supported in kube play? |
Yes care to open a PR? |
Actually the code looks like they are blocked.
|
@umohnani8 Please investigate. |
I made two changes in this PR.
First, I add the kube startup probe support. Since the container startup probe has already been merged (#13909), I think we can make
kube play
also support this feature.Second, I change the implementation of the "command probe".
The current command probe implementation doesn't have the same behavior with k8s; for example:
You will get the following error:
You can use the following yml to reproduce this problem.
That's because the code concat it simply.
podman/pkg/specgen/generate/kube/kube.go
Lines 527 to 531 in 02b7866
Signed-off-by: Liang Chu-Xuan [email protected]
Does this PR introduce a user-facing change?
Yes