#helmfile (2024-05)

https://github.com/helmfile/helmfile

Questions and discussion around helmfile https://github.com/roboll/helmfile and https://github.com/cloudposse/helmfiles

Archive: https://archive.sweetops.com/helmfile/

2024-05-04

Jim avatar

@yxxhero Would I be able to collaborate with you here on my pull request to Helmfile rather than posting comments into the PR itself?

Jim avatar

The pull request in question is https://github.com/helmfile/helmfile/pull/1494

#1494 Add helmfile template --show-only

Add a --show-only parameter to the helmfile template command to pass on to the helm template command.

Jim avatar

You’ve asked me to write some tests. As stated in my early comment on the pull request, I am not a golang programmer. I’ve spend half of the day today (Sat) trying to learn enough go to be able to perform your request, but I still don’t have enough knowledge to know how to proceed.

Jim avatar

Do I just add something like this to the TestTemplate function in pkg/app/app_template_test.go

Jim avatar

OR am I supposed to do something in test/e2e/template/helmfile/tmpl_test.go instead? (or as well?)

Jim avatar

OR am I supposed to do something under test/integration/test-cases/ ?

Jim avatar

Also a question on my change itself. Did I need to add the showOnly stuff to the HelmSpec and ReleaseSpec structs in pkg/state/state.go? The HelmSpec struct is for the helmDefault values right? And the --show-only option for helmfile template wouldn’t be something you’d likely want to set in the helmDefault section I suspect. And the ReleaseSpec struct if for the release: section of helmfile.yaml right? So probably also an area where you wouldn’t set the new parameter. I suspect I should remove it from those places?

I also don’t know if the changes I did in pkg/app/app_test.go were necessary or not?

Jim avatar

And if I don’t need those vars in the structs, then I guess my change to pkg/state/helmx.go simply becomes the following instead?

yxxhero avatar
yxxhero

I will help you. Waiting for my commit. Study with each other. Thanks so much.

Jim avatar

Thanks.

Jim avatar

I’d like to attempt to work on this again tomorrow. To help me get started, can you please let me know where I should create my tests? I’m thinking it is in one of the following 3 locations? • In pkg/app/app_template_test.go ? • In test/e2e/template/helmfile/tmpl_test.go ? • Or in the test/integration/test-cases/ area?

Jim avatar

I’ve made changes to remove showOnly from the HelmSpec and ReleaseSpec structs in pkg/state/state.go that I had previously added as it doesn’t make sense to specify this flag against helmDefaults: nor releases: in helmfile.yaml. And likewise I’ve adjusted the change in pkg/state/helmx.go to cater for the above.

And I’ve added a test to pkg/app/app_template_test.go

Finally I rebased it against your upstream changes to the main branch, and squashed my changes together.

How’s that looking?

Jim avatar

I’ve installed golangci-lint on my system and fixed the lint error as well now.

Jim avatar

Hmm. The integration tests failed whereas last time they passed fine. Seems more like a pipeline issue this time rather than my change?

Jim avatar

I’ve pushed the change adding the other test that you asked for.

2024-05-08

2024-05-09

2024-05-10

William avatar
William

Is there a way to use the folder name that a helmfile is in as the namespace? Maybe using exec pwd or something in the helmfile?

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

It sounds like the directory might be being used the way environments are intended to be used. The exec could work, but I think it may be relative to the current working directory where helmfile is being executed and not the path of the helmfile. Also, since helmfiles can import other helmfiles, the knowing the path is a bit ambiguous.

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

We usually use things in the built-in object to determine the namespace

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

And have environments define the namespace

William avatar
William

This is pretty much exactly what I was thinking. Thank you for the input!

William avatar
William

The environment was what I was trying to use as the folder name. I have since looked at doing a helmfile per service as per the docs.

William avatar
William

Also, if I am trying to build a value template and I have a values.yml.gotmpl and a service1.yaml that will render the values based on the values template mentioned. The problem is that I cannot get it to use the service1.yaml as the .Values for the gotmpl. I have to put the service1.yaml into the environment default for it to work. Seems very strange I have to use the environment section at all.

2024-05-11

2024-05-12

    keyboard_arrow_up