Add include-file flag for external files #8841
Conversation
Signed-off-by: Matheus Hunsche <matheus.hunsche@ifood.com.br>
92f7d62 to
7109462
Compare
Signed-off-by: Matheus Hunsche <matheus.hunsche@ifood.com.br>
05e69ea to
b642194
Compare
|
@mattfarina did the update with the master and corrected the changes, I would like feedback. |
|
Hello @vladfr, I would like to discuss these topics. About these two items:
I think it is the responsibility of the graphic developer to understand the overlap of the files, but if it is necessary to generate a warning or validation it is relatively simple. About this item:
I really like the idea of not failing, but a warning may be necessary. |
|
Hello, my feedback to the current questions:
No strong feeling here, it might make sense to allow files to be more specific that globs;
Initially i was thinking that failing is the better solution but on a second thought it might be better to not fail; If we think again about the grafana dashboards example, I also would like to deploy grafana with my CICD even if no dashboard matches the glob.
No strong feeling here either, I would argue that its up to the user to avoid the conflicts and not rely on an "_external" structure |
|
Hi, any updates on this please. I am eagerly waiting for this PR to be merged so that I can use it in my implementation. |
|
would be nice to have this soon |
|
From my view at the moment the uncertainty is around some of the open topics and a decision needs to be done; @hunsche, @mattfarina any advice on who can take a decision around those points? I had a quick look and code-wise any of the three mentioned points seem to be easy to solve. For what it's worth, I migrated a chart to use the forked branch and have this working correctly |
Have a look at the Contributing Guide, specifically the section on PR lifecycles. Anyone from the OWNERS file can review and approve this PR. At the moment, we've been focused and more concerned about the Helm 2 deprecation plan that was scheduled for last week. Now that milestone is behind us, we can re-focus on reviewing PRs like this one. Thanks for your patience. |
|
@bacongobbler thanks for the clarification, I checked the contributing guidelines, but it was not clear for me who can review. Let me know if i can help on this one. |
|
Any update on this please. Could someone please review and merge this PR so that we can use it. |
I believe we can follow, with these points as is, and collect feedback for improvements in new versions. |
|
I just spent 6 hours trying various workarounds, and then I found this which would solve all my problems 🥰 |
|
How do rollbacks work in this scenario? Say I do the following:
In step 3, Helm may attempt to re-render resources. Does it still have access to the content of |
|
Thank you @hunsche for this feature contribution. I've gone through the discussion in #3276 :) I typically handle this use case by
Would the included files be treated as values which happen to be rendered from Go templates, conceptually ? The reason I bring this up in the PR is that:
|
|
I'm sorry that we were not able to get to this prior to preparing to release v3.5.0. We are moving into the release candidate phase so this will need to be looked at for 3.6. |
|
I was just researching how to do this with helm - these flags look just what I need |
technosophos
left a comment
There was a problem hiding this comment.
I am pulling this off of 3.6.0 because no rollback solution was ever explained/implemented. I am adding a block on this PR so that commenters understand that this PR will not be merged until the rollback scenario is solved. Otherwise, rollback would be dangerous and unpredictable.
|
Is there an ETA when this will be done? It is painful currently having to rely on symlinks instead of this feature. |
|
I'm striving for the next version. |
|
Hey, just wanted to mention that our team is really looking forward for this feature. |
|
Just want to update that we talked about this feature at the Helm dev call, and decided that we need to write documentation and tests for the expected behaviour of these flags :) |
|
Usually helm charts are self documented (as in what can be config) by looking at the Anyway, updating I still think some use cases could be resolved without this PR by using |
|
@duyleekun In the case of my team, your suggestion couldn't solve our use case. We have a Helm chart for the application we're developing, and we provide the app's configurations with it. Then, when you install the chart, you install with the command: Hope it's clear :) |
|
I think you could use I still think this could create a lot of potentials to chart developer, I wouldn't mind if we can make this friendlier to user along the way |
|
@duyleekun I understand what you're suggesting, and we've thought about it for quite some time, but it's not as convenient because then we need to remember to update the configurations on each deployment, instead of just installing the chart. |
|
Btw, I've thought about it more, and I think this feature could be improved by a few simple additions that I'd like to discuss with you. What do you think about these additions? I'd be glad to hear your opinions on them :) |
I agree with your idea about
I thought this was implemented in the current release by putting files in the template folder, I could be wrong though. I guess your idea is to provide sensible default file embedded in the chart so user can replace whatever file they want later. IMO, this kind of make sense because I expect charts to be functional OOB and they usually do. I don't really have many use cases in mind yet for this suggestion yet, will certainly throw more idea later. |
|
@duyleekun I read the code in this PR and it seems that when you run |
|
Hi, any updates on this please.... looking forward to this feature... |
I know.. I wish I could still work on this, but unfortunately I can't continue working on this soon. |
what else needs to be done to get this completed? |
|
Can we get it shipped somehow? 😃 Badly needed for monorepo(s) 🙄 |
|
@technosophos My doubt is, why is this allowed: helm install --values /tmp/some-external-values.yaml myrelease somechartWhere externalConf: |-
totalExternalFile---
apiVersion: v1
kind: ConfigMap
metadata:
name: "RELEASE-NAME-"
date:
external.conf: |-
{{ .Values.externalConf }}And generate file: ---
# Source: configmap/templates/config-map.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: "RELEASE-NAME-"
date:
external.conf: |-
totalExternalFileAnd accessing another directory outside the chart is not allowed? The end result will be the same format as yaml The whole community waits for this. |
|
I agree. Let's get this done.
…On Mon, Oct 17, 2022, 22:42 Paulo Ferreira ***@***.***> wrote:
@technosophos <https://github.com/technosophos>
About rollback.
The end result is a yaml equal to the build if it's embedded in the values.
The implementation is not making a reference to a directory, it only
allows access to a directory outside the chart.
My doubt is, why is this allowed:
helm install --values /tmp/some-external-values.yaml myrelease somechart
Where /tmp/some-external-values.yaml is
externalConf: |- totalExternalFile
---apiVersion: v1kind: ConfigMapmetadata:
name: "RELEASE-NAME-"date:
external.conf: |-{{ .Values.externalConf }}
And generate file:
---# Source: configmap/templates/config-map.yamlapiVersion: v1kind: ConfigMapmetadata:
name: "RELEASE-NAME-"date:
external.conf: |- totalExternalFile
And accessing another directory outside the chart is not allowed?
The whole community waits for this.
Please stop blocking this functionality
—
Reply to this email directly, view it on GitHub
<#8841 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABGRU7E4XXGNSR6T33FZBCTWDYMC3ANCNFSM4SBIEYKA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
|
Since @hunsche hasn't been able to work on this for a very long time and @itaispiegel picked it back up with #10077, I'm closing this PR in favor of that one. |
This PR implements the
--include-fileand--include-dirflags for the install, upgrade and template commands.These flags load local files and make them available to the chart, so they can be used in templates with functions like
.Files.Getor.Files.Glob.This is my first PR here, and I would appreciate comments regarding style, code split (what goes where), and the amount and quality of tests that we need.
Thank you!
Parsing
Both flags are arrays and can have multiple values, either comma-separated, or by writing the flag multiple times.
Both flags require a key and a path. They will get parsed just like
--set*, and later values will overwrite previous ones. The paths are then added as if they are part of the chart; the keys represent the file names inside the chart.You can use both flags in the same command. Files are parsed first, then directories.
Single files
Dirs
The include-dir flag can include all the files from a local directory. It will not recurse in subdirectories.
Globs
The
--include-dirflag optionally supports a glob. It can recurse, but it will take everything it finds and add it under one folder, specified in the key.Closing
closes #3276
closes #8227
Feedback is welcomed! I know there has been a lot of interest for this issue, so I am looking forward for your input.
If you don't know where to start, here are the open issues with this PR:
_externaldir? Chart authors will need to append it to every lookup:{{ (.Files.Glob "_external/certs/") }}This PR is a continuation of the PR #8227 created by @vladfr
Still todo:
--include-dirto get all files in a dir; this could be enhanced with glob