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

Allow to override global variables per-subchart #2076

Closed
sheerun opened this issue Mar 7, 2017 · 6 comments
Closed

Allow to override global variables per-subchart #2076

sheerun opened this issue Mar 7, 2017 · 6 comments

Comments

@sheerun
Copy link
Contributor

sheerun commented Mar 7, 2017

In my usecase I'd like to enable persistence for all subcharts, except redis. Ideally I'd be able to write:

title: "My Awesome App"

global:
  persistence: true # received by all subcharts

redis:
  global:
    persistence: false # override global.persistence of redis subchart
  port: 9090

what do you think? sorry if it's already possible, I cannot find documentation..

@technosophos
Copy link
Member

I know that the Kolla Kubernetes team solved this problem with a template function. I think @kfox1111 might be able to explain.

I'm not sure if there is an existing pattern for Kubernetes Charts charts. Perhaps @prydonius knows.

@kfox1111
Copy link

kfox1111 commented Mar 8, 2017

Yeah, kolla-kubernetes solves this case in our shared library. Documentation is here:
https://raw.githubusercontent.com/openstack/kolla-kubernetes/master/helm/kolla-common/templates/_common_val_get.rst
The code is here:
https://github.com/openstack/kolla-kubernetes/blob/master/helm/kolla-common/templates/_common_val_get.yaml

It might be nice to merge some of is functionality into a common helm shared library of helpers? There really isn't anything kolla-kubernetes specific in the code.

@technosophos
Copy link
Member

@kfox1111 I am trying to make it much easier to do this in Helm 2.3.0. I added a few new Sprig functions that might help:

  • pluck
  • first
  • coalesce

I think that what you are doing above might in the future be handled by pluck "mykey" .Values .Values.globals | first. If you have a second to sanity check my thinking, here are the new docs:

https://github.com/Masterminds/sprig#lists-functions

Unit tests for pluck: https://github.com/Masterminds/sprig/blob/master/functions_test.go#L683-L696

@kfox1111
Copy link

kfox1111 commented Mar 9, 2017

Ah. interesting. Yeah, I think those constructs could make it much easier to implement the stuff kolla-kubernetes is doing.

If there is a canary build, it should be possible to replace the three macro's here:
https://github.com/openstack/kolla-kubernetes/blob/master/helm/kolla-common/templates/_common_val_get.yaml
with implementations that use those new functions and a ps to test in the kolla-kubernetes gate to see if it works.

Should be pretty easy I think to try.

@jascott1
Copy link
Contributor

@sheerun Im closing this due to inactivity but please re-open if you need further assistance.

@tculp
Copy link

tculp commented Jun 3, 2020

I believe this behavior would be intuitive and still have use even with the newer sprig functions. Especially with regards to boolean values, since issues like that described in Masterminds/sprig#111 still exist

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

6 participants