Skip to content

Commit b707ffb

Browse files
committed
support rootless healthchecks
Signed-off-by: Arjun Raja Yogidas <[email protected]>
1 parent 66f3f5e commit b707ffb

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

pkg/healthcheck/healthcheck_manager_linux.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ func CreateTimer(ctx context.Context, container containerd.Container) error {
5050
log.G(ctx).Debugf("Creating healthcheck timer unit: %s", hcName)
5151

5252
cmd := []string{}
53+
if rootlessutil.IsRootless() {
54+
cmd = append(cmd, "--user")
55+
}
56+
5357
if path := os.Getenv("PATH"); path != "" {
5458
cmd = append(cmd, "--setenv=PATH="+path)
5559
}
@@ -300,10 +304,10 @@ func shouldSkipHealthCheckSystemd(hc *Healthcheck) bool {
300304
return true
301305
}
302306

303-
// Skip healthchecks in rootless environments to avoid systemd DBUS permission issues
304-
if rootlessutil.IsRootless() {
305-
return true
306-
}
307+
// // Skip healthchecks in rootless environments to avoid systemd DBUS permission issues
308+
// if rootlessutil.IsRootless() {
309+
// return true
310+
// }
307311

308312
// Don't proceed if health check is nil, empty, explicitly NONE or interval is 0.
309313
if hc == nil || len(hc.Test) == 0 || hc.Test[0] == "NONE" || hc.Interval == 0 {

0 commit comments

Comments
 (0)