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:
| Subcommand | Purpose |
|---|---|
template | Render Helm chart manifests. |
values | Show resolved Helm values as formatted YAML. |
plan | Preview changes an apply would make. |
diff | Show changes an apply would make. |
apply | Install or upgrade a Helm release. |
deploy | Deploy a Helm release. |
delete | Uninstall 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.
stackRequired. The stack name. Atmos passes it as
--stack=<stack>, so do not also passstackorsinflags.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.
Related
atmos.terraformruns Terraform and OpenTofu components.atmos.runruns any Atmos command from an argument list.- Atmos Automation Language and the script step