Skip to content

Latest commit

 

History

History
109 lines (85 loc) · 3.63 KB

File metadata and controls

109 lines (85 loc) · 3.63 KB
title Native Helm
tags
Kubernetes
cast
file title
/casts/examples/helm/lifecycle.cast
atmos native helm lifecycle

Native Helm Component Example

A minimal, credential-free example of a native Helm component. The chart lives in components/helm/demo and is configured by stacks/deploy/dev.yaml.

Try It

Run the local chart workflow end to end:

atmos validate stacks
atmos helm template demo -s dev --dependency-update
atmos emulator up kubernetes -s dev
atmos helm diff demo -s dev --identity local-k3s
atmos helm apply demo -s dev --identity local-k3s --dry-run
atmos helm apply demo -s dev --identity local-k3s --on-failure=uninstall --wait=watcher --timeout=2m
atmos emulator exec kubernetes -s dev -- kubectl -n demo get deployment demo
atmos emulator exec kubernetes -s dev -- kubectl -n demo get service demo
atmos helm delete demo -s dev --identity local-k3s --dry-run --wait=watcher --timeout=2m
atmos helm delete demo -s dev --identity local-k3s
atmos emulator down kubernetes -s dev

The atmos test custom command remains available as the CI smoke wrapper for this same lifecycle.

Render (no cluster, no credentials)

atmos helm template demo -s dev --dependency-update

# Render the same chart through a declarative Helm repository.
HELM_DEMO_REPO_URL=http://127.0.0.1:8080 atmos helm template demo-repo -s dev

Diff

atmos helm diff (alias plan) shows a real unified diff (via the embedded helm-diff library — no plugin to install). Secret values are redacted.

# Offline: capture a baseline render, change a value, then diff against the baseline.
atmos helm template demo -s dev --output=baseline.yaml
# (edit stacks/deploy/dev.yaml, e.g. set replicaCount: 3)
atmos helm diff demo -s dev --from-manifest=baseline.yaml

# Against the deployed release (requires a reachable cluster):
atmos helm diff demo -s dev

# Against a GitOps deployment repository configured under `provision`:
atmos helm diff demo -s dev --against=target

Apply

# Install/upgrade the release on the current kubecontext.
atmos helm apply demo -s dev

# Or deploy directly to the local K3s emulator used by the CI smoke test.
atmos emulator up kubernetes -s dev
atmos helm apply demo -s dev --identity local-k3s

The stack sets release.wait.strategy: watcher, release.timeout: 4m, release.history.max: 10, and release.install.crds: skip as native Helm type defaults. The demo component overrides the wait strategy to legacy, uses install uninstall-on-failure, and enables upgrade rollback with independent failed-upgrade cleanup. The atmos test workflow covers non-mutating apply and delete dry runs, ordinary Job waiting, chart-hook suppression, CRD skipping, weighted hook ordering, retained hook resources, install and upgrade rollback, failed-upgrade cleanup, timeout handling, and dependency-gated Helm releases. Rendering also verifies opt-in acquisition of a missing file:// library dependency, hook manifests, and a Helm tpl expression preserved in stack values. The intentionally slow resources are observed with bounded Kubernetes readiness checks rather than fixed-delay assertions.

Helm Repositories

The demo-repo component shows the declarative Helm repository path:

components:
  helm:
    demo-repo:
      repositories:
        - name: local
          url: !env HELM_DEMO_REPO_URL
      chart: local/demo

Use atmos helm repo list to inspect chart repository associations:

atmos helm repo list demo-repo -s dev

See the atmos helm docs for the full command and flag reference.