Skip to content

Commit df9ff8c

Browse files
committed
add global options to healthcheck command
Signed-off-by: Arjun Raja Yogidas <arjunry@amazon.com>
1 parent 804a8cd commit df9ff8c

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

pkg/healthcheck/healthcheck_manager_linux.go

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,47 @@ func CreateTimer(ctx context.Context, container containerd.Container, cfg *confi
6262
return fmt.Errorf("could not determine nerdctl executable path: %v", err)
6363
}
6464

65-
cmdOpts = append(cmdOpts, nerdctlPath, "container", "healthcheck", containerID)
65+
cmdOpts = append(
66+
cmdOpts, nerdctlPath,
67+
"--namespace", cfg.Namespace,
68+
"--address", cfg.Address,
69+
"--data-root", cfg.DataRoot,
70+
"--cni-path", cfg.CNIPath,
71+
"--cni-netconfpath", cfg.CNINetConfPath,
72+
"--cgroup-manager", cfg.CgroupManager,
73+
"--host-gateway-ip", cfg.HostGatewayIP,
74+
)
75+
76+
// Add boolean flags
77+
if cfg.InsecureRegistry {
78+
cmdOpts = append(cmdOpts, "--insecure-registry")
79+
}
80+
if cfg.Experimental {
81+
cmdOpts = append(cmdOpts, "--experimental")
82+
}
83+
if cfg.DebugFull {
84+
cmdOpts = append(cmdOpts, "--debug-full")
85+
}
86+
87+
// Add array flags
88+
for _, dir := range cfg.HostsDir {
89+
cmdOpts = append(cmdOpts, "--hosts-dir", dir)
90+
}
91+
for _, dir := range cfg.CDISpecDirs {
92+
cmdOpts = append(cmdOpts, "--cdi-spec-dirs", dir)
93+
}
94+
95+
// Add userns-remap if set
96+
if cfg.UsernsRemap != "" {
97+
cmdOpts = append(cmdOpts, "--userns-remap", cfg.UsernsRemap)
98+
}
99+
100+
cmdOpts = append(cmdOpts, "container", "healthcheck", containerID)
101+
102+
if log.G(ctx).Logger.IsLevelEnabled(log.DebugLevel) {
103+
cmdOpts = append(cmdOpts, "--debug")
104+
}
105+
66106
if log.G(ctx).Logger.IsLevelEnabled(log.DebugLevel) {
67107
cmdOpts = append(cmdOpts, "--debug")
68108
}

0 commit comments

Comments
 (0)