Skip to content

Commit

Permalink
Add comment for jsonMarshal command
Browse files Browse the repository at this point in the history
* also, change makeHealthCheck to the standard test command structure

Signed-off-by: Liang Chu-Xuan <[email protected]>
  • Loading branch information
karta0807913 committed Dec 17, 2022
1 parent 7bd1dbb commit 070b692
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pkg/specgen/generate/kube/kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,7 @@ func probeToHealthConfig(probe *v1.Probe) (*manifest.Schema2HealthConfig, error)
// configure healthcheck on the basis of Handler Actions.
switch {
case probeHandler.Exec != nil:
// `makeHealthCheck` function can accept a json array as the command.
cmd, err := json.Marshal(probeHandler.Exec.Command)
if err != nil {
return nil, err
Expand Down Expand Up @@ -618,6 +619,8 @@ func makeHealthCheck(inCmd string, interval int32, retries int32, timeout int32,
// ...otherwise pass it to "/bin/sh -c" inside the container
cmd = []string{define.HealthConfigTestCmdShell}
cmd = append(cmd, strings.Split(inCmd, " ")...)
} else {
cmd = append([]string{define.HealthConfigTestCmd}, cmd...)
}
}
hc := manifest.Schema2HealthConfig{
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/play_kube_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1754,7 +1754,7 @@ var _ = Describe("Podman play kube", func() {
inspect.WaitWithDefaultTimeout()
healthcheckcmd := inspect.OutputToString()
// check if CMD-SHELL based equivalent health check is added to container
Expect(healthcheckcmd).To(ContainSubstring("[echo hello]"))
Expect(healthcheckcmd).To(ContainSubstring("[CMD echo hello]"))
})

It("podman play kube liveness probe should fail", func() {
Expand Down

0 comments on commit 070b692

Please sign in to comment.