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

Run vals against values files that contain the syntax #920

Merged
merged 1 commit into from
Oct 30, 2019

Conversation

tduffield
Copy link
Contributor

@tduffield tduffield commented Oct 30, 2019

If we specify ref+ syntax in a values file, run vals against that file. This should work for both .yaml and .yaml.gotmpl files, since it will evaluate the go-templating before proceeding to the ref evaluation.

I'm not sure the best way to test this. The initial implementation didn't have a test framework for me to leverage. I built locally and tested against my helmfile setup. It appears to work.

Example Usage

# helmfile.yaml
releases:
  - name: my-app
    chart: stable/foo
    values:
      - values.yaml
      - morevalues.yaml.gotmpl
# values.yaml
foo: ref+vault://127.0.0.1:8200/mykv/foo?proto=http#/mykey
bar:
  baz: ref+vault://127.0.0.1:8200/mykv/foo?proto=http#/mykey
# morevalues.yaml.gotmpl
boo: ref+vault://127.0.0.1:8200/{{ .Environment.Name }}/foo?proto=http#/{{ .Release.Name }}

Signed-off-by: Tom Duffield tom@chef.io

If we specify ref+ syntax in a values file, run vals against that file.

Signed-off-by: Tom Duffield <tom@chef.io>
Copy link
Collaborator

@mumoshu mumoshu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tduffield LGTM. Thanks a lot for your contribution ☺️

@mumoshu
Copy link
Collaborator

mumoshu commented Oct 30, 2019

The initial implementation didn't have a test framework for me to leverage. I built locally and tested against my helmfile setup. It appears to work.

Thanks! Yeah local testing would be enough for now. I'm still trying to figure out how we could easily test it.

@mumoshu mumoshu merged commit 464e6bc into roboll:master Oct 30, 2019
@tduffield
Copy link
Contributor Author

tduffield commented Oct 31, 2019

@mumoshu if it were me, I would add a special no-op syntax to vals, something like ref+test://myvalue or ref+echo://myvalue which just evaluates to myvalue. That way you can write tests that can execute vals without having to worry about interfaces or handling secrets management. All you really care about is that vals is getting called in the right places.

@tduffield tduffield deleted the ref-in-files branch October 31, 2019 04:38
@mumoshu
Copy link
Collaborator

mumoshu commented Oct 31, 2019

@tduffield Wow, that sounds great! I'll give it a try asap(Or even appreciate it if you could submit a pr to vals!

mumoshu added a commit to helmfile/vals that referenced this pull request Oct 31, 2019
@mumoshu
Copy link
Collaborator

mumoshu commented Oct 31, 2019

@tduffield JFYI, I've just added an impl for the echo provider in helmfile/vals@9d1714c. Hoping it works as advertised 😄

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

Successfully merging this pull request may close these issues.

2 participants