roboll / helmfile

Deploy Kubernetes Helm Charts
MIT License
4.04k stars 566 forks source link

Q: Download multiple .yaml manifests #2136

Closed locomoco28 closed 2 years ago

locomoco28 commented 2 years ago

I've seen that you can specify remote URLs for Helm charts, but I couldn't find a way to download .yaml files directly which would be useful to install CRDs. Did I miss something in the documentation about it, or is there currently no way of doing this without creating a chart custom chart using Helm hooks to wget the files like in Gitlab's cluster management template?

mumoshu commented 2 years ago

@locomoco28 Hey. You should be able to use go-getter URL in the `chart field like https://github.com/roboll/helmfile/issues/2106

locomoco28 commented 2 years ago

@mumoshu Thanks for your quick response. How would that look like e.g. for the kube-prometheus-stack I have to install multiple YAML files

mumoshu commented 2 years ago

You'd need to repeat release within helmfile.yaml for each remote YAML file.

locomoco28 commented 2 years ago

So a little bit like this?

Prometheus CRDs helmfile.yaml ```yaml releases: - name: prometheus-crds-alertmanagerconfigs namespace: monitoring chart: https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.55.0/example/prometheus-operator-crd/monitoring.coreos.com_alertmanagerconfigs.yaml version: v1.0.0 installed: true - name: prometheus-crds-alertmanagers namespace: monitoring chart: https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.55.0/example/prometheus-operator-crd/monitoring.coreos.com_alertmanagers.yaml version: v1.0.0 installed: true - name: prometheus-crds-podmonitors namespace: monitoring chart: https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.55.0/example/prometheus-operator-crd/monitoring.coreos.com_podmonitors.yaml version: v1.0.0 installed: true - name: prometheus-crds-probes namespace: monitoring chart: https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.55.0/example/prometheus-operator-crd/monitoring.coreos.com_probes.yaml version: v1.0.0 installed: true - name: prometheus-crds-prometheuses namespace: monitoring chart: https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.55.0/example/prometheus-operator-crd/monitoring.coreos.com_prometheuses.yaml version: v1.0.0 installed: true - name: prometheus-crds-prometheusrules namespace: monitoring chart: https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.55.0/example/prometheus-operator-crd/monitoring.coreos.com_prometheusrules.yaml version: v1.0.0 installed: true - name: prometheus-crds-servicemonitors namespace: monitoring chart: https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.55.0/example/prometheus-operator-crd/monitoring.coreos.com_servicemonitors.yaml version: v1.0.0 installed: true - name: prometheus-crds-thanosrulers namespace: monitoring chart: https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.55.0/example/prometheus-operator-crd/monitoring.coreos.com_thanosrulers.yaml version: v1.0.0 installed: true ```

I wish there was an option to specify an array of charts. Maybe something similar to this would be feasible to implement?

releases:
  - name: prometheus-crds
    namespace: monitoring
    charts:
      # Release names like <releases[i].name>-<releases[i].chart[j].name or filename>

      # examples:

        # Release name: prometheus-crds-alertmanagerconfigs
      - name: alertmanagerconfigs
        chart: https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.55.0/example/prometheus-operator-crd/monitoring.coreos.com_alertmanagerconfigs.yaml

        # Release name: prometheus-crds-monitoring-coreos-com-alertmanagers-yaml
      - chart: https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.55.0/example/prometheus-operator-crd/monitoring.coreos.com_alertmanagers.yaml
      # ...
    version: v1.0.0
    installed: true
mumoshu commented 2 years ago

Yeah it should work. If you really need to make it DRY, use go templates within the helmfile.yaml.

locomoco28 commented 2 years ago

Ooh that's a good idea, I didn't think of using go templates for the helmfiles. Thank you :)

locomoco28 commented 2 years ago

hmm entering urls to yaml files doesn't seem to work for me tho. It expects a gzipped archive :/

toVersus commented 2 years ago

@locomoco28 JFYI, I had similar use case and ended up adopting the following way referring to this example:

releases:
- name: prometheus-operator-crds
  chart: git::https://github.com/prometheus-operator/prometheus-operator.git@example/prometheus-operator-crd?ref=v0.55.0
mumoshu commented 2 years ago

Ah good catch, yep that might be the limitation due to helmfile uses thedirectory mode of go-getter. I hope it isn't a deal breaker but if it is, a feature request to add support for specifying a single remote yaml file to chart by leveraging go-getter's file mode would definitely be valid.