Skip to main content

atmos.helm

The atmos.helm function runs atmos helm <command> <component> --stack=<stack> through the current Atmos executable, so scripts can render, diff, and deploy native Helm components without building command lines by hand.

Usage​

atmos.helm(
command,
component,
stack,
flags = {},
args = [],
working_directory = ...,
env = ...,
output = "stream",
check = True,
)

Subcommands​

The command argument takes a subcommand of atmos helm:

SubcommandPurpose
templateRender Helm chart manifests.
valuesShow resolved Helm values as formatted YAML.
planPreview changes an apply would make.
diffShow changes an apply would make.
applyInstall or upgrade a Helm release.
deployDeploy a Helm release.
deleteUninstall a Helm release.

The plugin and repo subcommands manage Helm plugins and repositories rather than a component, so call them with atmos.run, for example atmos.run(["helm", "repo", "list"]).

Arguments​

command
Required. The Helm subcommand, such as "template", "diff", or "deploy".
component
Required. The component name.
stack

Required. The stack name. Atmos passes it as --stack=<stack>, so do not also pass stack or s in flags.

flags

(Optional) A dictionary of command flags; see the shared flag translation rules.

args
(Optional) A list or tuple of strings appended after the flags.
working_directory, env, output, check

(Optional) The same process options as atmos.run.

The values of command, component, and stack must be non-empty and must not start with a dash.

Returns​

A result with stdout, stderr, and exit_code. See exec.run. Unlike atmos.terraform, no exit code is treated as a successful result: with check=True, any nonzero exit code raises.

Examples​

Render a chart​

rendered = atmos.helm("template", "ingress", "dev", output = "capture")
print(rendered.stdout)

Diff before deploying​

diff = atmos.helm("diff", "ingress", "dev", output = "capture")
print(diff.stdout)

Deploy to every stack in sequence​

for stack in ["dev", "staging", "prod"]:
ui.info("Deploying ingress to " + stack)
atmos.helm(
"deploy",
"ingress",
stack,
flags = {"namespace": "ingress", "set": ["image.tag=1.2.3"]},
)

In the first iteration, Atmos runs atmos helm deploy ingress --stack=dev --namespace=ingress --set=image.tag=1.2.3.