ansible-collections / community.kubernetes

Kubernetes Collection for Ansible
https://galaxy.ansible.com/community/kubernetes
GNU General Public License v3.0
265 stars 104 forks source link

release_namespace is required even when chart already has a default namespace #272

Closed memelet closed 3 years ago

memelet commented 4 years ago

I'm deploying the rancher-monitoring (https://github.com/rancher/charts/tree/main/charts/rancher-monitoring). It by default will use the namespace cattle-monitoring-system, which I am happy with. The chart supports overriding the namespace with the value namespaceOverride

But I must provide the release_namespace as it's required. To ensure that I keep the namespace consistent I am doing

- name: Install rancher-monitoring
  vars:
    namespace: cattle-monitoring-system
  helm:
    chart_ref: prometheus-community/kube-prometheus-stack
    chart_version: "{{ kafka_strimzi_version }}"
    release_name: rancher-monitoring
    release_namespace: "{{ namespace }}"
    release_values:
      namespaceOverride: "{{ namespace }}"

Seems a bit smelly that I must provide release_namespace given that charts can behave this way.

geerlingguy commented 4 years ago

@memelet - It's not the norm, though, that a Chart will have namespace-based variables, whereas it's important to be able to deploy any chart into a specific namespace (unless I'm mistaken, and all or almost all charts have variables similar to namespaceOverride?).

And in that case, while it may be annoying to have to put the namespace in twice in those instances, I don't see any easier way to avoid that.

goneri commented 3 years ago

Thank you for issue report @memelet. I close it per @geerlingguy comment. Feel free to reopen if you think we've misunderstood something.