helmfile icon indicating copy to clipboard operation
helmfile copied to clipboard

Need a very simple example of what is required for DRY sub-helmfiles

Open jimmythedog opened this issue 2 years ago • 1 comments

I'm almost certainly being rather stupid here, but I cannot for the life of me "get" it yet

I'm wanting to :

  1. Have a "root" helmfile.yaml that is simply a "launcher/wrapper" for a number of sub-helmfiles
  2. Allow each sub-helmfile to be run alone, if required
  3. Have "global" values in each environment values file

So, something like:

.
├── environments.yaml
├── helmfiles
│   └── cert-manager
│       ├── helmfile.yaml
│       ├── repositories.yaml
│       └── values.yaml.gotmpl
├── helmfile.yaml
├── production.yaml
└── staging.yaml

2 directories, 7 files

helmfile.yaml

bases:
  - environments.yaml

---

helmfiles:
  - path: helmfiles/cert-manager/helmfile.yaml
    values:
    - {{ toYaml .Values | nindent 6 }}

environments.yaml

environments:
  default:
    values:
      - staging.yaml
  production:
    values:
      - production.yaml

helmfiles/cert-manager/helmfile.yaml

bases:
  - ../../environments.yaml
  - repositories.yaml

---

releases:
- name: cert-manager
  namespace: "cert-manager"
  chart: jetstack/cert-manager
  version: 1.7.1
  installed: true
  values:
    - values.yaml.gotmpl

As it stands, if I invoke helmfile -e default lint from the top-level directory, I get an error:

in ./helmfile.yaml: in .helmfiles[0]: in helmfiles/cert-manager/helmfile.yaml: failed to read ../../environments.yaml: environment values file matching "staging.yaml" does not exist in "."

I'm guessing that the problem is due to - ../../environments.yaml in the helmfiles/cert-manager/helmfile.yaml file, but if I remove that line, I cannot then run it in isolation?

As I stated earlier, it's me not getting it, so I could dearly love it if some could point me to a very simple example that shows what I'm trying to achieve (I've looked at the official docs & examples, but I'm struggling)

TIA

jimmythedog avatar Feb 25 '22 12:02 jimmythedog

Just realised that I can invoke a single release by using -l name=[RELEASE_NAME] - perhaps that is my solution, but it doesn't "feel" right

jimmythedog avatar Feb 25 '22 14:02 jimmythedog