Skip to main content

atmos.helmfile

The atmos.helmfile function runs atmos helmfile through the current Atmos executable. Use it to render, diff, sync, apply, and destroy Helm releases for a Helmfile component from automation.

Usage​

atmos.helmfile(
*positionals,
flags = {},
args = [],
working_directory = ...,
env = ...,
output = "stream",
check = True,
)

Also available as atmos.hf.

Subcommands​

Pass the subcommand, the component, and any other positional arguments as strings before the keyword arguments. The call atmos.helmfile("diff", "echo-server", flags = {"stack": "dev"}) runs atmos helmfile diff echo-server --stack=dev.

SubcommandPurpose
diffShow differences between the desired and actual state of Helm releases.
applyApply changes to align the actual state of Helm releases with the desired state.
syncSynchronize the state of Helm releases by reconciling the actual state with the desired state.
destroyDestroy the Helm releases for the specified stack.
templateRender Helm releases defined in a helmfile to Kubernetes manifests.
generate varfileGenerate a values file for a Helmfile component.
source pullVendor Helmfile component source from the source configuration.
source listList Helmfile components with source configuration.
source describeShow the source configuration for a Helmfile component.
source deleteRemove the vendored Helmfile source directory.
versionGet the Helmfile version.

See the atmos helmfile command reference for the complete list of subcommands and flags.

Arguments​

*positionals

(Optional) Strings placed on the command line right after helmfile, in order: the subcommand, then the component name. Every value must be a string.

flags

(Optional) A dictionary of command-line options; see flag translation. A bare key such as "stack" becomes --stack, and the registered shorthand "s" resolves to the same flag. The "ci" key becomes --ci, which turns on CI mode for supported Helmfile operations.

args

(Optional) A list or tuple of strings appended after the flags. Include the double-dash separator ("--") as the first element to hand the remaining values to the native helmfile binary.

working_directory, env, output, check

(Optional) See atmos.run for process options and defaults.

Options other than the positionals are keyword-only.

Returns​

A result with stdout, stderr, and exit_code. See atmos.run for output and error behavior.

Examples​

Diff a component before applying​

diff = atmos.helmfile("diff", "echo-server", flags = {"stack": "tenant1-ue2-dev"}, output = "capture")
print(diff.stdout)

This runs atmos helmfile diff echo-server --stack=tenant1-ue2-dev and keeps the diff output in the result.

Apply with CI summaries​

atmos.helmfile("apply", "echo-server", flags = {"stack": "tenant1-ue2-dev", "ci": True})

The ci flag asks Atmos to write a Helmfile job summary when running in a pipeline.

Pass native Helmfile options​

atmos.helmfile(
"sync",
"echo-server",
flags = {"stack": "tenant1-ue2-dev"},
args = ["--", "--concurrency=2"],
)

Everything after the double dash goes to the helmfile binary instead of Atmos.

Roll out several stacks​

for stack in ["tenant1-ue2-dev", "tenant1-ue2-staging"]:
atmos.helmfile("apply", "echo-server", flags = {"stack": stack})