-
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
Return nil health when inspecting containers without healthchecks #21388
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ashley-cui 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 |
Fixes: #18792 |
Cockpit tests failed for commit 14e979d86e24f6db7e41a8100694fea51b2b6932. @martinpitt, @jelly, @mvollmer please check. |
14e979d
to
2a936bc
Compare
Cockpit tests failed for commit 2a936bc73f635776c48118339887f920b2eacd18. @martinpitt, @jelly, @mvollmer please check. |
2a936bc
to
29e4694
Compare
Cockpit tests failed for commit 29e46941c6de791138e1a2aaee1b54b806633e01. @martinpitt, @jelly, @mvollmer please check. |
@ashley-cui looks like you might have upset other tests. |
29e4694
to
5ab50ce
Compare
9390d56
to
8e8f3fc
Compare
Cockpit tests failed for commit 5ab50cee094e23f23e2bf89761ca27bc2534e7f7. @martinpitt, @jelly, @mvollmer please check. |
Cockpit tests failed for commit 9390d566dff9154e6ace0a9ccc2bdf2e8dc8c9bc. @martinpitt, @jelly, @mvollmer please check. |
Cockpit tests failed for commit 5ab50cee094e23f23e2bf89761ca27bc2534e7f7. @martinpitt, @jelly, @mvollmer please check. |
Cockpit tests failed for commit 8e8f3fcd1fdb976ea7716bd4445db3fe3164a03b. @martinpitt, @jelly, @mvollmer please check. |
Cockpit tests failed for commit 9390d566dff9154e6ace0a9ccc2bdf2e8dc8c9bc. @martinpitt, @jelly, @mvollmer please check. |
Cockpit tests failed for commit 8e8f3fcd1fdb976ea7716bd4445db3fe3164a03b. @martinpitt, @jelly, @mvollmer please check. |
Cockpit tests failed for commit 5ab50cee094e23f23e2bf89761ca27bc2534e7f7. @martinpitt, @jelly, @mvollmer please check. |
Cockpit tests failed for commit 9390d566dff9154e6ace0a9ccc2bdf2e8dc8c9bc. @martinpitt, @jelly, @mvollmer please check. |
Cockpit tests failed for commit 8e8f3fcd1fdb976ea7716bd4445db3fe3164a03b. @martinpitt, @jelly, @mvollmer please check. |
libpod/container_inspect.go
Outdated
if reflect.DeepEqual(healthCheckState, define.HealthCheckResults{}) { | ||
data.State.Health = &healthCheckState | ||
} | ||
data.State.Health = nil |
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.
This looks wrong, you set it and then unset it. Should this be in a else statement?
8e8f3fc
to
1546f27
Compare
Cockpit tests failed for commit 1546f27104e2a9ea47cffd2638ba63145f51adae. @martinpitt, @jelly, @mvollmer please check. |
containers/podman#21388 drops the `State.Health` field for containers without health checks. This causes an `undefined` crash in the container sort function.
containers/podman#21388 drops the `State.Health` field for containers without health checks. This causes an `undefined` crash in the container sort function.
LGTM |
@containers/podman-maintainers PTAL |
|
||
for _, item := range log { | ||
res := &types.HealthcheckResult{} | ||
s, _ := time.Parse(time.RFC3339Nano, item.Start) |
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.
if you are comfy with ignoring this error, i would appreciate a comment here ... also ignored on the next line
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.
Fixed, the error is now handled. Thanks!
one nit, lets wait for @martinpitt before merging ... else, LGTM |
The cockpit PR landed, can you please retry (or force-push)? Thanks!
|
libpod/container_inspect.go
Outdated
@@ -196,7 +197,11 @@ func (c *Container) getContainerInspectData(size bool, driverData *define.Driver | |||
// An error here is not considered fatal; no health state will be displayed | |||
logrus.Error(err) | |||
} else { | |||
data.State.Health = healthCheckState | |||
if reflect.DeepEqual(healthCheckState, define.HealthCheckResults{}) { |
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.
why are we using DeepEqual here? first it slow but second we already are checking if there is healthcheck with
c.config.HealthCheckConfig != nil
so we should just assign the struct here.
The health key should only be missing if there is no healthcheck but not when the log is just empty (like it is doing here)
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.
Nice catch, thanks!
14d5626
to
4ce2a10
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.
LGTM
LGTM |
/lgtm |
Tests are angry |
On the surface, the changes LGTM, but tests are angry and this looks like it might be a real test issue:
|
When inspecting a container that does not define any health check, the health field should return nil. This matches docker behavior. Signed-off-by: Ashley Cui <[email protected]>
4ce2a10
to
a1c47f0
Compare
Cockpit tests failed for commit a1c47f0. @martinpitt, @jelly, @mvollmer please check. |
Wrt. the rawhide failure, the test instaled the wrong cockpit-podman version again (from rawhide, instead of from our main-builds COPR). I'll investigate today, please disregard this ATM. I filed cockpit-project/cockpit-podman#1543 to fix this. |
@ashley-cui the rawhide cockpit-revdeps should go green now, I landed a fix/hack. I can't retry it myself, but you should be able to on https://github.com/containers/podman/pull/21388/checks?check_run_id=21048234276 |
/lgtm |
1698fa0
into
containers:main
When inspecting a container that does not define any health check, the health field should return nil. This matches docker behavior.
Does this PR introduce a user-facing change?