Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pkg/healthcheck/healthcheck_manager_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,20 @@ func CreateTimer(ctx context.Context, container containerd.Container, cfg *confi
containerID := container.ID()
log.G(ctx).Debugf("Creating healthcheck timer unit: %s", containerID)

// Set all environment variables so that they are available for the nerdctl commands run via the systemd service file
cmdOpts := []string{}
if path := os.Getenv("PATH"); path != "" {
cmdOpts = append(cmdOpts, "--setenv=PATH="+path)
}

if nerdctlToml := os.Getenv("NERDCTL_TOML"); nerdctlToml != "" {
cmdOpts = append(cmdOpts, "--setenv=NERDCTL_TOML="+nerdctlToml)
}

if buildKitHost := os.Getenv("BUILDKIT_HOST"); buildKitHost != "" {
cmdOpts = append(cmdOpts, "--setenv=BUILDKIT_HOST="+buildKitHost)
}

// Always use health-interval for timer frequency
cmdOpts = append(cmdOpts, "--unit", containerID, "--on-unit-inactive="+hc.Interval.String(), "--timer-property=AccuracySec=1s")

Expand Down
Loading