-
Notifications
You must be signed in to change notification settings - Fork 2.9k
fix: skip execution of probes when initialDelaySeconds is not elapsed #27708
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
base: main
Are you sure you want to change the base?
Conversation
According to the [Kubernetes docs](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#configure-probes) the probes should be executed after the `initialDelaySeconds`. So to be consistent with the kubernetes specs, skip the execution of the probes until the `initialDelaySeconds` is elapsed. Closes containers#27678 Signed-off-by: Vasileios Anagnostopoulos <anagnwstopoulos@hotmail.com>
|
is there any possible way you can add a test to re-enforce the behavior ? |
I am not certain that there is a "visible effect" using only the podman API. Already the podman API was not reporting the results of the health check until the initialDelaySeconds was elapsed. Is there a way of retrieving the results of the healtcheck that I have missed ? If not, then the only alternative is to use some "special" container as it was described in the issue. Is that something that can be implemented using |
Honny1
left a comment
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 LGTM. I suggest you try implementing a test using bats and an issue reproducer.
The test requires a simple container that, on startup, writes a start timestamp to a log file. The health check should also add a health check timestamp to this file. These two timestamps should be different by at least a few seconds.
I think you can reuse what is described in the issue. It will be challenging to check this without creating a flaky test.
|
I think it'd be easier to write a healthcheck command that created a sentinel file in the container filesystem (something like |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: anagno, mheon 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 |
87cb558 to
88e2c12
Compare
|
[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore. |
I went with this approach :) |
|
And I discover a small mistake... Give some minutes and I will fix it and then make the PR again ready :) update: fixed |
|
And I do not think that my changes are causing the failure ... Is there a way of re-triggering the test ? |
Add a test to ensure the liveness probe is not executed until the initialDelaySeconds period has elapsed Signed-off-by: Vasileios Anagnostopoulos <anagnwstopoulos@hotmail.com>
|
LGTM |
Luap99
left a comment
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.
one blocker as the test var is wrong
And also please squash the commits into one, we want fix and test as one commit.
| args: | ||
| - /bin/sh | ||
| - -c | ||
| - touch /tmp/healthy && sleep 100 |
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.
we never do anything with touch /tmp/healthy so this could just be dropped
| ts=$(date +"%Y-%m-%d %H:%M:%S"); | ||
| echo "Healthcheck at $ts" | tee -a /tmp/healthcheck.log; | ||
| # Real check: just always succeed | ||
| true |
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.
nit: any reason to overcomplicate this compared to touch /tmp/healthcheck.log, we never do anything with the date
| # THEN the execution of the liveness probe should be skipped because initialDelaySeconds has not yet elapsed | ||
| run_podman 1 exec $ctrName test -e /tmp/healthcheck.log | ||
|
|
||
| run_podman '?' stop -t0 $ctrNam |
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.
That seems wrong. We should not ignore the exit code of stop but also the car name is broken, it needs to be $ctrName
According to the Kubernetes docs the probes should be executed after the
initialDelaySeconds. So to be consistent with the kubernetes specs, skip the execution of the probes until theinitialDelaySecondsis elapsed.Closes #27678
Executing the same test mentioned in the issue we get:
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?