Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE]: Template helm values files #5739

Open
salotz opened this issue Feb 16, 2024 · 2 comments
Open

[FEATURE]: Template helm values files #5739

salotz opened this issue Feb 16, 2024 · 2 comments

Comments

@salotz
Copy link

salotz commented Feb 16, 2024

Feature Request

Background / Motivation

I was trying to template values.yaml files for helm with garden template expansion. This doesn't seem to work.

What should the user be able to do?

Same as manifests the valueFiles should also support garden templates.

Why do they want to do this? What problem does it solve?

The workaround is to use the values section but as mentioned in some other issues (#5738 ) this is severely limited once you have more than 2 different cases/environments.

Also the values section can get very large and overtakes the rest of the config.

Suggested Implementation(s)

N/A

How important is this feature for you/your team?

🌵 Not having this feature makes using Garden painful

@thsig
Copy link
Collaborator

thsig commented Feb 16, 2024

Thanks for writing this up!

I wonder if a similar approach to patchResources could be taken here, i.e. something like:

kind: Deploy
type: helm
name: some-service
spec:
  mergeValues: true # <----
  values:
    some:
      deeply:
        nested:
          value: ${var.someOverride}

The mergeValues option could be implemented as follows:

  • Resolve the values in the action config
  • Read the values file
  • Merge in the paths/values from values
  • Write the resulting values to a file and pass that to helm
    That way, you wouldn't have to duplicate your whole values file, and could just override the parts you're interested in.

Does that sound like a reasonable flow?

@salotz
Copy link
Author

salotz commented Feb 16, 2024

I don't think that is much different than what is currently exists. I don't so much want to override the values files (at least in the scope of the problem I'm currently having), but rather have a way to have specify values for more than 2 cases/environments.

Currently the templates are good at changing the value of a single key-value (like in your example), but if I want to have a more complex nested object I need to use $if: $else templates.

For instance ingresses:

  values:

    $if: ${environment.name == 'local'}
    $then:
      ingress:
        enabled: true
        ingressClassName: nginx 
        tls:
          - hosts:
              - ${var.subdomains["jupyterhub"]}.${var.domain}
            secretName: ingress-tls
       
        hosts:
          - ${var.subdomains["jupyterhub"]}.${var.domain}

    $else:
      ingress:
        enabled: true
        hosts:
          - ${var.subdomains["jupyterhub"]}.${var.domain}
        annotations:
          networking.gke.io/managed-certificates: ${var.helm_release_names["jupyterhub"]}-ingress-cert
          networking.gke.io/v1beta1.FrontendConfig: ${var.helm_release_names["jupyterhub"]}-ingress-frontend
          kubernetes.io/ingress.global-static-ip-name: ${var.static_ips["jupyterhub-staging"]}
          

If instead I can use multiple different values files I can have that structure written out and use the garden templates to fill in the specific values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants