#helmfile (2024-05)
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
@yxxhero Would I be able to collaborate with you here on my pull request to Helmfile rather than posting comments into the PR itself?
The pull request in question is https://github.com/helmfile/helmfile/pull/1494
Add a --show-only
parameter to the helmfile template
command to pass on to the helm template
command.
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.
Do I just add something like this to the TestTemplate
function in pkg/app/app_template_test.go
OR am I supposed to do something in test/e2e/template/helmfile/tmpl_test.go
instead? (or as well?)
OR am I supposed to do something under test/integration/test-cases/
?
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?
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?
I will help you. Waiting for my commit. Study with each other. Thanks so much.
Thanks.
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?
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?
I’ve installed golangci-lint on my system and fixed the lint error as well now.
Hmm. The integration tests failed whereas last time they passed fine. Seems more like a pipeline issue this time rather than my change?
I’ve pushed the change adding the other test that you asked for.
2024-05-08
2024-05-09
2024-05-10
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?
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.
We usually use things in the built-in object to determine the namespace
And have environments define the namespace
This is pretty much exactly what I was thinking. Thank you for the input!
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.
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
2024-05-18
Hi, for the most part, all releases exist in all environments. Super simple. However, one cluster, call it x, has 10+ releases specific to the x environment. Is there a way to have all the x releases in a separate file and have it invoked when running helmfile -e x?
I’m just listing all releases in a single file which is a little verbose and using installedTemplate: {{ eq .Environment.Name "x" }}
to specify which releases would go to x
Maybe conditionally add a helmfile for that release?
{{ if eq .Environment.Name "x" }}
helmfiles:
- nested/{{ .Environment.Name }}.yaml.gotmpl
{{ endif }}
Then inside of x.yaml.gotmpl
releases:
# Releases specific to environment 'x'
- name: x-release-1
namespace: x-namespace
chart: x/chart-1
- name: x-release-2
namespace: x-namespace
chart: x/chart-2
# ... 10+ releases
Awesome. I forget it’s just go templating. Had a laugh at the 1.0 release notes covering that. Thank you!