-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Better support for Kubernetes health probes #19173
Better support for Kubernetes health probes #19173
Conversation
e7a7f43
to
733d154
Compare
733d154
to
5d97385
Compare
0d2b9a9
to
09198d5
Compare
09198d5
to
30e66b4
Compare
@umohnani8 @ygalblum @baude PTAL |
You need to add tests or add [NO NEW TESTS NEEDED] flag to the PR. |
if err != nil { | ||
return nil, err | ||
} | ||
commandString = fmt.Sprintf("curl -f %s://%s:%d%s || %s", uriScheme, host, portNum, path, failureCmd) |
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 know this is old code, but I don't believe curl is native to Mac. If not, should we break this out into Linux, Mac, and Windows code streams? Beyond which, I'm always leery about making a curl call from code, but that seems to be water under the bridge at this point.
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.
Note that this command is being run inside the container, not the host. Although, this is also not desirable.
I guess the ideal solution would be either for podman itself to do the probes inside code, or to have a separate container (probably like or extending the pause container) running the probes.
30e66b4
to
ed99c18
Compare
Closes containers#18645 Signed-off-by: Hedayat Vatankhah <[email protected]>
Signed-off-by: Hedayat Vatankhah <[email protected]>
ed99c18
to
600de05
Compare
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 think @umohnani8 started looking into this issue as well. Let's wait for her to have a look.
This is a bit different than the issue I am looking at. What I am looking at is the probe fails with a curl command because the container doesn't have a shell or curl installed as the podman code currently runs the probe commands inside the container created. We need to figure out a way to handle http commands outside of the container to check for healthy status and will be a bigger rework. I think this PR can go it as it is addressing another issue around ports with probes and there is no need to block it on the future rework. Changes LGTM |
That's #18318, and its also the case for TCP probes which is also done by running
Thanks a lot for the review! |
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´d love to see a test or two being added (or extended) in https://github.com/containers/podman/blob/main/test/e2e/play_kube_test.go.
@@ -569,6 +569,7 @@ func probeToHealthConfig(probe *v1.Probe, containerPorts []v1.ContainerPort) (*m | |||
var commandString string | |||
failureCmd := "exit 1" | |||
probeHandler := probe.Handler | |||
host := "localhost" // Kubernetes default is host IP, but with Podman currently we run inside the container |
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.
Any chance we can add a test for it?
LGTM for the code. But, I agree with @vrothberg about the need for tests |
Thanks for the review. I added a number of tests covering new fixes |
Signed-off-by: Hedayat Vatankhah <[email protected]>
5568306
to
a8d8c94
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: hedayat 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 |
/lgtm |
Closes #18645
Does this PR introduce a user-facing change?