Skip to content

Conversation

@coderbirju
Copy link
Contributor

Currently the global flags passed to nerdclt is not passed to the healthcheck command, this results in container not found errors while running healthchecks in a namespaced environement

This PR passes the global options to the healthcheck command as well

@coderbirju coderbirju force-pushed the add-namespace-option branch from 61bf0a1 to df9ff8c Compare October 31, 2025 22:41
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pattern used in Compose should be followed:

nerdctlCmd, nerdctlArgs := helpers.GlobalFlags(cmd)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @AkihiroSuda for the suggestion, I have made chages as requested. We now pass down the options from the CLI during health-check creation.
Most changed files are for passing these new values to the function

PTAL
Can we also add this to v2.2.0

Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coderbirju coderbirju force-pushed the add-namespace-option branch from df9ff8c to 27318a4 Compare November 3, 2025 18:46
cmdOpts = append(cmdOpts, "container", "healthcheck", containerID)

log.G(ctx).Debugf("creating healthcheck timer with: systemd-run %s", strings.Join(cmdOpts, " "))
log.G(ctx).Infof("creating healthcheck timer with: systemd-run %s", strings.Join(cmdOpts, " "))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

@coderbirju coderbirju force-pushed the add-namespace-option branch from 654a56b to e1b158d Compare November 4, 2025 11:48
@AkihiroSuda AkihiroSuda added this to the v2.2.0 milestone Nov 4, 2025
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

// 1. It was explicitly changed via CLI (highest priority), OR
// 2. It has a non-default value (from TOML config)
// This ensures both CLI flags and TOML config values are propagated
if f.Changed || (val != f.DefValue && val != "") {
Copy link
Contributor

@Shubhranshu153 Shubhranshu153 Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition i think should not be there, the function seems to return all global flags, irrespective of changed or not changed. Not sure if this condition is required.

@AkihiroSuda Do you happen to know why we have the condition for compose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants