roboll / helmfile

Deploy Kubernetes Helm Charts
MIT License
4.05k stars 564 forks source link

Unable to manage several releases parameters #858

Open mdh69-github opened 5 years ago

mdh69-github commented 5 years ago

Hi,

Suppose I have 2 (or more) components named comp1 and comp2. Each of these components has a log-level parameter in their values.yaml

I want to use environment concept. For that, I create a file associated with each environment.

In the prod environment file, I want to set log-level parameter to info for comp1 and log-level parameter to debug for comp2.

It seems, it is not possible because the value are not organized by component.

Am I clear ? Am I wrong ?

mdh69-github commented 5 years ago

Just above an example to be clearest :

I use the following directory structure

helmfile.yaml
|--elastic
    |-- elastic.yaml

helmfile.yaml content

helmfiles:
  - path: "elastic/elastic.yaml"
    values:
    - name: mdh69

elastic.yaml content

repositories:
  # Official helm charts
  - name: "hardis"
    url: "https://chart.hg-as.io/"

releases:
- name: "elastic-{{ requiredEnv "NAME" }}"
  chart: "hardis/esoperator"
  version: 0.1.0
  wait: true
  hooks:
  - events: ["presync"]
    command: "/bin/sh"
    args: ["-c", "kubectl get crd elasticsearches.elasticsearch.k8s.elastic.co >/dev/null 2>&1 || \
           kubectl apply -f https://download.elastic.co/downloads/eck/0.9.0/all-in-one.yaml"]

==> The value of the variable name is not take into account

If I modify the elastic.yaml file by the following content :

repositories:
  # Official helm charts
  - name: "hardis"
    url: "https://chart.hg-as.io/"

releases:
- name: "elastic-{{ requiredEnv "NAME" }}"
  chart: "hardis/esoperator"
  version: 0.1.0
  wait: true
  hooks:
  - events: ["presync"]
    command: "/bin/sh"
    args: ["-c", "kubectl get crd elasticsearches.elasticsearch.k8s.elastic.co >/dev/null 2>&1 || \
           kubectl apply -f https://download.elastic.co/downloads/eck/0.9.0/all-in-one.yaml"]
  values:
  - name: mdh69

The value of name is taking account.

My objective is to propose to the OPS only ONE file to adapt even if the stack is composed of several components.

mumoshu commented 5 years ago

@mdh69-github Hey!

helmfile[].values and releases[].values has nothing to do with each other. They aren't propagated implicitly.

You'd need to update your elastic.yaml to something like the below. Look at the last two lines:

repositories:
  # Official helm charts
  - name: "hardis"
    url: "https://chart.hg-as.io/"

releases:
- name: "elastic-{{ requiredEnv "NAME" }}"
  chart: "hardis/esoperator"
  version: 0.1.0
  wait: true
  hooks:
  - events: ["presync"]
    command: "/bin/sh"
    args: ["-c", "kubectl get crd elasticsearches.elasticsearch.k8s.elastic.co >/dev/null 2>&1 || \
           kubectl apply -f https://download.elastic.co/downloads/eck/0.9.0/all-in-o
  values:
  - name: {{ .Values.name }}