We are using helmfile in atmos and we are doing it...
# atmos
p
We are using helmfile in atmos and we are doing it this way :
Copy code
---
repositories:
  - name: prometheus
    url: https://prometheus-community.github.io/helm-charts

releases:
  - name: prometheus
    chart: prometheus/prometheus
    version: 27.39.0
    namespace: monitoring
    createNamespace: true
    force: false
    values:
      - mgmt-wus3-prometheus.helmfile.vars.yaml
But we want to avoid passing the filename
mgmt-wus3-prometheus.helmfile.vars.yaml
or if we have to have a way to templetarize the name so it can be environment agnostic, we tries many things from the helmfile docs and they just do not work, is there any magic in atmos that helps resolve this? at the end of the day is atmos creating
mgmt-wus3-prometheus.helmfile.vars.yaml
file.
@Girish Maddineni
a
Copy code
In Helmfile, variable precedence (from lowest to highest priority) works as follows:

Values defined in the Helm chart itself (values.yaml)

Values specified in the Helmfile release definition (e.g.,

releases:
  - name: myapp
    values:
      - values.yaml
      - custom.yaml


or inline YAML under releases.values)

Values provided via --state-values-file flag

Values provided via --set or --set-file flags on the command line

✅ Priority rule:
Values from --state-values-file override any values defined in the Helmfile configuration.

That means if the same key exists in both a Helmfile values: section and a file passed via --state-values-file, the one from --state-values-file wins.
Atmos generates the varfile and uses
--state-values-file
to provide it to helmfile
Copy code
helmfile apply --state-values-file=mgmt-wus3-prometheus.helmfile.vars.yaml
you don't need to provide values in
values
(which will make your helmfile config generic)
you can manage helmfile config using helmfile values or environments, or using Atmos, or combination of these approaches - this is what Atmos is for
p
if we delete the
Copy code
values:
mgmt-wus3-prometheus.helmfile.vars.yaml
◦ no values are passes to helmfile
and it tries to update the service and remove the values that we applied manually
the run looks like this:
Copy code
atmos helmfile apply grafana -s mgmt-wus3 --logs-level Debug                                                       ✔  5907  17:34:40 
DEBU Set logs-level=debug logs-file=/dev/stderr
DEBU Found config ENV ATMOS_CLI_CONFIG_PATH=./config
DEBU Found ENV variable ATMOS_BASE_PATH=./
DEBU Found ENV variable ATMOS_COMPONENTS_HELMFILE_KUBECONFIG_PATH=/Users/pepe/.kube/config
DEBU Found config ENV ATMOS_CLI_CONFIG_PATH=./config
DEBU Found ENV variable ATMOS_BASE_PATH=./
DEBU Found ENV variable ATMOS_COMPONENTS_HELMFILE_KUBECONFIG_PATH=/Users/pepe/.kube/config
DEBU Found config ENV ATMOS_CLI_CONFIG_PATH=./config
DEBU Found ENV variable ATMOS_BASE_PATH=./
DEBU Found ENV variable ATMOS_COMPONENTS_HELMFILE_KUBECONFIG_PATH=/Users/pepe/.kube/config
DEBU Found component 'grafana' in the stack 'mgmt-wus3' in the stack manifest 'myapp/management/wus3/helm'
DEBU ProcessTmplWithDatasources template=templates-all-atmos-sections
DEBU ProcessTmplWithDatasources template=templates-all-atmos-sections evaluation=1
DEBU ProcessTmplWithDatasources: processed template=templates-all-atmos-sections
DEBU Resolved component path type=helmfile component=grafana resolved_path=/Users/pepe/Documents/ORG/pepe-iac/components/helmfile/grafana base_path=/Users/pepe/Documents/ORG/pepe-iac/components/helmfile env_override=false
DEBU Resolved component path type=helmfile component=grafana resolved_path=/Users/pepe/Documents/ORG/pepe-iac/components/helmfile/grafana base_path=/Users/pepe/Documents/ORG/pepe-iac/components/helmfile env_override=false
DEBU Variables for component in stack component=grafana stack=mgmt-wus3 variables="map[autoscaling:map[enabled:true] environment:wus3 namespace:mgmt tolerations:[map[effect:NoSchedule key:CriticalAddonsOnly operator:Equal value:true]]]"
DEBU Resolved component path type=helmfile component=grafana resolved_path=/Users/pepe/Documents/ORG/pepe-iac/components/helmfile/grafana base_path=/Users/pepe/Documents/ORG/pepe-iac/components/helmfile env_override=false
DEBU Writing the variables to file: file=/Users/pepe/Documents/ORG/pepe-iac/components/helmfile/grafana/mgmt-wus3-grafana.helmfile.vars.yaml
DEBU 
Command info:
DEBU Helmfile binary: helmfile
DEBU Helmfile command: apply
DEBU Global options=[]
DEBU Arguments and flags additional=[]
DEBU Component: grafana
DEBU Stack: mgmt-wus3
DEBU Resolved component path type=helmfile component=grafana resolved_path=/Users/pepe/Documents/ORG/pepe-iac/components/helmfile/grafana base_path=/Users/pepe/Documents/ORG/pepe-iac/components/helmfile env_override=false
DEBU Using working dir=/Users/pepe/Documents/ORG/pepe-iac/components/helmfile/grafana
DEBU Using ENV vars:
DEBU STACK=mgmt-wus3
DEBU NAMESPACE=mgmt
DEBU TENANT=
DEBU ENVIRONMENT=wus3
DEBU STAGE=
DEBU REGION=
DEBU KUBECONFIG=/Users/pepe/.kube/config
DEBU ATMOS_CLI_CONFIG_PATH=/Users/pepe/Documents/ORG/pepe-iac/config
DEBU ATMOS_BASE_PATH=/Users/pepe/Documents/ORG/pepe-iac
DEBU Executing command="/opt/homebrew/bin/helmfile --state-values-file mgmt-wus3-grafana.helmfile.vars.yaml apply"
Adding repo grafana https://grafana.github.io/helm-charts
"grafana" has been added to your repositories

Comparing release=grafana, chart=grafana/grafana, namespace=monitoring
monitoring, grafana, Deployment (apps) has changed:
  # Source: grafana/templates/deployment.yaml
  apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: grafana
    namespace: monitoring
    labels:
      helm.sh/chart: grafana-10.0.0
      app.kubernetes.io/name: grafana
      app.kubernetes.io/instance: grafana
      app.kubernetes.io/version: "12.1.1"
  spec:
+   replicas: 1
    revisionHistoryLimit: 10
    selector:
      matchLabels:
        app.kubernetes.io/name: grafana
        app.kubernetes.io/instance: grafana
    strategy:
      type: RollingUpdate
    template:
      metadata:
        labels:
          helm.sh/chart: grafana-10.0.0
          app.kubernetes.io/name: grafana
          app.kubernetes.io/instance: grafana
          app.kubernetes.io/version: "12.1.1"
        annotations:
          checksum/config: 0e9cbd043253452345234523453425234523452345234
          checksum/sc-dashboard-provider-config: e70bf6a32452345234523452345234523452345
-         checksum/secret: 15ae5b58732432452345324523452345234523452345
+         checksum/secret: 4d6cc534523452345234523452345234523453452345
          kubectl.kubernetes.io/default-container: grafana
      spec:
        
        serviceAccountName: grafana
        automountServiceAccountToken: true
        shareProcessNamespace: false
        securityContext:
          fsGroup: 472
          runAsGroup: 472
          runAsNonRoot: true
          runAsUser: 472
        enableServiceLinks: true
        containers:
          - name: grafana
            image: "docker.io/grafana/grafana:12.1.1"
            imagePullPolicy: IfNotPresent
            securityContext:
              allowPrivilegeEscalation: false
              capabilities:
                drop:
                - ALL
              seccompProfile:
                type: RuntimeDefault
            volumeMounts:
              - name: config
                mountPath: "/etc/grafana/grafana.ini"
                subPath: grafana.ini
              - name: storage
                mountPath: "/var/lib/grafana"
            ports:
              - name: grafana
                containerPort: 3000
                protocol: TCP
              - name: gossip-tcp
                containerPort: 9094
                protocol: TCP
              - name: gossip-udp
                containerPort: 9094
                protocol: UDP
              - name: profiling
                containerPort: 6060
                protocol: TCP
            env:
              - name: POD_IP
                valueFrom:
                  fieldRef:
                    fieldPath: status.podIP
              - name: GF_SECURITY_ADMIN_USER
                valueFrom:
                  secretKeyRef:
                    name: grafana
                    key: admin-user
              - name: GF_SECURITY_ADMIN_PASSWORD
                valueFrom:
                  secretKeyRef:
                    name: grafana
                    key: admin-password
              - name: GF_PATHS_DATA
                value: /var/lib/grafana/
              - name: GF_PATHS_LOGS
                value: /var/log/grafana
              - name: GF_PATHS_PLUGINS
                value: /var/lib/grafana/plugins
              - name: GF_PATHS_PROVISIONING
                value: /etc/grafana/provisioning
            livenessProbe:
              failureThreshold: 10
              httpGet:
                path: /api/health
                port: 3000
              initialDelaySeconds: 60
              timeoutSeconds: 30
            readinessProbe:
              httpGet:
                path: /api/health
                port: 3000
-       tolerations:
-         - effect: NoSchedule
-           key: CriticalAddonsOnly
-           operator: Equal
-           value: "true"
        volumes:
          - name: config
            configMap:
              name: grafana
          - name: storage
            emptyDir: {}
monitoring, grafana, Secret (v1) has changed:
  # Source: grafana/templates/secret.yaml
  apiVersion: v1
  kind: Secret
  metadata:
    labels:
      app.kubernetes.io/instance: grafana
      app.kubernetes.io/name: grafana
      app.kubernetes.io/version: 12.1.1
      helm.sh/chart: grafana-10.0.0
    name: grafana
    namespace: monitoring
  data:
-   admin-password: '-------- # (40 bytes)'
+   admin-password: '++++++++ # (40 bytes)'
    admin-user: 'REDACTED # (5 bytes)'
    ldap-toml: 'REDACTED # (0 bytes)'
  type: Opaque

monitoring, grafana, HorizontalPodAutoscaler (autoscaling) has been removed:
- # Source: grafana/templates/hpa.yaml
- apiVersion: autoscaling/v2
- kind: HorizontalPodAutoscaler
- metadata:
-   name: grafana
-   namespace: monitoring
-   labels:
-     app.kubernetes.io/name: grafana
-     helm.sh/chart: grafana-10.0.0
-     app.kubernetes.io/instance: grafana
- spec:
-   scaleTargetRef:
-     apiVersion: apps/v1
-     kind: Deployment
-     name: grafana
-   minReplicas: 1
-   maxReplicas: 5
-   metrics:
-     - type: Resource
-       resource:
-         name: cpu
-         target:
-           type: Utilization
-           averageUtilization: 60
+ 

Upgrading release=grafana, chart=grafana/grafana, namespace=monitoring
Release "grafana" has been upgraded. Happy Helming!
NAME: grafana
LAST DEPLOYED: Wed Oct  8 17:35:55 2025
NAMESPACE: monitoring
STATUS: deployed
REVISION: 4
NOTES:
1. Get your 'admin' user password by running:

   kubectl get secret --namespace monitoring grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo


2. The Grafana server can be accessed via port 80 on the following DNS name from within your cluster:

   grafana.monitoring.svc.cluster.local

   Get the Grafana URL to visit by running these commands in the same shell:
     export POD_NAME=$(kubectl get pods --namespace monitoring -l "app.kubernetes.io/name=grafana,app.kubernetes.io/instance=grafana" -o jsonpath="{.items[0].metadata.name}")
     kubectl --namespace monitoring port-forward $POD_NAME 3000

3. Login with the password from step 1 and the username: admin
#################################################################################
######   WARNING: Persistence is disabled!!! You will lose your data when   #####
######            the Grafana pod is terminated.                            #####
#################################################################################

Listing releases matching ^grafana$
grafana monitoring      4               2025-10-08 17:35:55.707175 -0700 PDT    deployed        grafana-10.0.0  12.1.1     


UPDATED RELEASES:
NAME      NAMESPACE    CHART             VERSION   DURATION
grafana   monitoring   grafana/grafana   10.0.0          7s

DEBU Found config ENV ATMOS_CLI_CONFIG_PATH=./config
DEBU Found ENV variable ATMOS_BASE_PATH=./
DEBU Found ENV variable ATMOS_COMPONENTS_HELMFILE_KUBECONFIG_PATH=/Users/pepe/.kube/config
DEBU Found config ENV ATMOS_CLI_CONFIG_PATH=./config
DEBU Found ENV variable ATMOS_BASE_PATH=./
DEBU Found ENV variable ATMOS_COMPONENTS_HELMFILE_KUBECONFIG_PATH=/Users/pepe/.kube/config
DEBU Telemetry event enqueued
stack file:
Copy code
---
vars:
  namespace: "mgmt"
  environment: "wus3"

components:
  helmfile:
    grafana:
      vars:
        autoscaling:
          enabled: true
        tolerations:
          - key: "CriticalAddonsOnly"
            operator: "Equal"
            value: "true"
            effect: "NoSchedule"
a
this looks like the variables from the component in the stack (that Atmos uses to generate the varfile) don't correspond to the variables that the Helm Chart expects
look at the
variables.yaml
for the Helm Chart, then reproduce the same structure in the Atmos component
vars
and
tolerations
as well
so for this to work, you need to have
Copy code
components:
  helmfile:
    grafana:
      vars:
        global:
          autoscaling:
            enabled: true
          tolerations:
            - key: "CriticalAddonsOnly"
              operator: "Equal"
              value: "true"
              effect: "NoSchedule"
same structure as the variables that the chart expects
this chart happens to tollerate any variable sent to it, so if you just add
autoscaling
and
tolerations
not under
global
, it will accept it and silently ignore (opposite to the Azure chart you deployed a week ago which had a strict schema config and it did not allow providing variables that are not in the defined schema)
always start with
variables.yaml
for the chart and configure exactly the same structure in Atmos. In fact, you can just copy the whole file https://github.com/grafana/helm-charts/blob/main/charts/grafana/values.yaml into the
vars
section for the component and it will work b/c both the Chart and the Atmos
vars
section are YAML. The chart will deep merge the values from
variables.yaml
with the values provided on the command line (from Atmos -> Helmfile), so if you don't provide some values in the stack config, they will be taken from
variables.yaml
(that's why you don't have to copy the entire content of
variables.yaml
into the
vars
section). you can consider variables.yaml similar to the default values in Atmos (base component)
p
Ohhhhh I see what you are saying, the yaml structure is off...
I will test that out a bit later
I checked this and global, autoscaling and tolerations are all at the root level
one thing to note is : when atmos created the
mgmt-wus3-prometheus.helmfile.vars.yaml
and you pass it to helmfile in the
values:
section this works, so it means that the structure from the stack is correct
otherwise we will se nothing on the diff
a
I checked this and global, autoscaling and tolerations are all at the root level
what chart are you using?
and this is the helmfile.yaml for graphana
Copy code
---
repositories:
  - name: grafana
    url: https://grafana.github.io/helm-charts

releases:
  - name: grafana
    chart: grafana/grafana
    version: 10.0.0
    namespace: monitoring
    createNamespace: true
    force: false
    values:
      - mgmt-wus3-grafana.helmfile.vars.yaml
a
i see that in that particular chart,
tolerations
is at the root (which is diff from the other grafana chart)
Copy code
## Tolerations for pod assignment
## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
##
tolerations: []
p
yes
a
we need to check helmfile, maybe if you use
releases
, it does not accept the varfile from
--state-values-file
a
it should be correct (that's why I mentioned this approach at the beginning of this thread). But I'm not sure w/o actually running it (the test don't test the actual output). If it's not correct, then something is with helmfile when using releases
we need to actually test it. @Gabriela Campana (Cloud Posse) please create a task to test https://github.com/cloudposse/atmos/tree/main/examples/demo-helmfile and the variables provided in
--state-values-file
by Atmos
✅ 1