#helmfile - July 2023

Marcus Ramberg
Marcus Rambergover 3 years ago
So far we’ve been using helmfile.lock in our workflow, but we’ve started using Renovate and adding versions to the helmfile.yaml - however this makes the for some problems in our workflow because the lock isn’t updated by renovate. Is there any reason we need the lockfiles at all when we pin the versions in the helmfile.yaml ?
Pablo Silveira
Pablo Silveiraover 3 years ago
Hi everybody, I wonder how can CRDS dependencies be managed with helmfile. For example in the same run I am deploying the prometheus op CRDs and the k8s cluster autoscaler (in which values I have a service monitor resource(crd)) . my pipeline make first a helmfile diff and this fail as expected, because that resource does not exist
Pablo Silveira
Pablo Silveiraover 3 years ago
is there any way to avoid this control ?
Ihor Urazov
Ihor Urazovover 3 years ago(edited)
I have helmfile.yaml.gotmpl with following simplified content:
---
environments:
  core-01:
    values:
    - envType: prod
      region: <ref+vault://secret/core/service/{{> .Values.envType }}/{{ .Environment.Name }}/s3#/region

---
releases:
- name: some-release
  namespace: some-namespace
  chart: some/chart
  version: 5.0.0
  values:
  - storage:
      backend: s3
      s3:
        endpoint: s3.{{ .Values.region | fetchSecretValue }}.<http://amazonaws.com|amazonaws.com>
        region: {{ .Values.region | fetchSecretValue }}
        bucket_name: <ref+vault://secret/core/service/{{> .Values.envType }}/{{ .Environment.Name }}/s3#/storage

with HELMFILE_V0MODE=true this works fine, but with with HELMFILE_V1MODE=true produces in ./helmfile.yaml.gotmpl: error during helmfile.yaml.gotmpl.part.0 parsing: template: stringTemplate:6:54: executing "stringTemplate" at <.Values.envType>: map has no entry for key "envType". It seems v1 doesn't allow to reuse env values in other env values. Is this right? What would be refactoring approach to keep things mostly dry?
Pablo Silveira
Pablo Silveiraover 3 years ago(edited)
Hello everybody, i am trying to apply a nested state implementation, I have read the docs and I think I am applying it well. this is my scheme:
**********
Remote repo:
sre-tools-helm-centralized
├── helmfiles
│ └── monitoring
│ └── global
│ ├── kube-prometheus-stack.yaml
│ └── loki-stack.yaml
└── values
├── kube-prometheus-stack
│ └── global
│ ├── kube-prometheus-stack-alertmanager.yaml
│ ├── kube-prometheus-stack-alertmanager.yaml.gotmpl
│ ├── kube-prometheus-stack-grafana.yaml.gotmpl
│ ├── kube-prometheus-stack-prometheus.yaml.gotmpl
**************
And I am working in this folder:
01_monitoring
├── helmfile.d
│ └── helmfile-v3.yaml
└── values
└── kube-prometheus-stack
└── kube-prometheus-stack-alertmanager.yaml
*******************
this is helmfile-v3.yaml content:
helmBinary: helm3
missingFileHandler: Error
namespace: {{ requiredEnv "NAMESPACE" }}
helmfiles:
- path: "git::<ssh://git@gitlab.xxxx.com/sre-prod/sre-tools/sre-tools-helm-centralized@/helmfiles/monitoring/global/kube-prometheus-stack.yaml?ref=v1.1.1>"
selectors:
- name=kube-prometheus-stack
values:
- ../values/kube-prometheus-stack/kube-prometheus-stack-alertmanager.yaml
********
this is global/kube-prometheus-stack.yaml:
---
helmBinary: helm3
namespace: monitoring

repositories:
- name: prometheus-community
url: https://prometheus-community.github.io/helm-charts
releases:
- name: kube-prometheus-stack
chart: prometheus-community/kube-prometheus-stack
version: 41.7.3
values:
- ../../../values/kube-prometheus-stack/global/kube-prometheus-stack-alertmanager.yaml
- ../../../values/kube-prometheus-stack/global/kube-prometheus-stack-alertmanager.yaml.gotmpl
- ../../../values/kube-prometheus-stack/global/kube-prometheus-stack-grafana.yaml.gotmpl
- ../../../values/kube-prometheus-stack/global/kube-prometheus-stack-prometheus.yaml.gotmpl
***************
I don't understand why values file in "helmfiles:" section is not beeing applied?