Add include-file flag for external files [#3276]#8227
Add include-file flag for external files [#3276]#8227vladfr wants to merge 169 commits intohelm:masterfrom
Conversation
…nd makes it available to the templates Signed-off-by: Vlad Fratila <vfratila@adobe.com>
Signed-off-by: Vlad Fratila <vfratila@adobe.com>
Signed-off-by: Vlad Fratila <vfratila@adobe.com>
4b8131e to
fa670b9
Compare
Signed-off-by: Vlad Fratila <vfratila@adobe.com>
Signed-off-by: Vlad Fratila <vfratila@adobe.com>
00e5787 to
b3906f0
Compare
Signed-off-by: Vlad Fratila <vfratila@adobe.com>
|
@bacongobbler - I'm ready for a review on this. |
|
Hi @vladfr. Most of my time is spent working on another project, so I only have enough time to weigh in on issues and review smaller feature enhancements or security-related issues. I'd suggest reaching out on the Helm developer call on Thursdays to try and see if someone else can review this. Thanks! |
|
Thanks a lot for this PR!
I think parsing files after dirs is a good idea. IMHO, one wouldn't expect an explicit file include to be overwritten by a less specific dir include.
Failing when a path is not found or is unreadable seems fine to me. But the warning maybe better in case of a glob returning nothing. It would introduce behavior inconsistency though. No strong opinion on this one, sorry!
What about forbidding some special paths like the templates and the charts directories, the Chart.yaml, Chart.lock, requirements.yaml and requirements.lock files and maybe the values.yaml file? |
|
First congratulations on PR ❤️ 🚀 I am testing this implementation and trying to make some changes to make it work in my scenarios. Pass the It is also necessary to call the I would like to help you with implementation suggestions. |
Added a fix for upgrade --install added more tests for loader, parser and upgrade cmd Signed-off-by: Vlad Fratila <vfratila@adobe.com>
Signed-off-by: Vlad Fratila <vfratila@adobe.com>
|
@hunsche - thank you so much for your notes, you are correct on both points. I've added your suggestions and it seems to work nicely. I've also increased test coverage. The only part I'm missing is the actual I mistakenly thought that upgrade would run |
|
@yann-soubeyrand thanks for your replies, I'll go ahead and switch the ordering. We still need to solve the problem of all external files being added to the root of the chart. Your suggestion of blocking paths is reasonable, but I'd like some more feedback on it, since it's not very forward-compatible. |
|
Slating for 3.4.0 for review as discussed on the call |
|
Hi,
Forbidding paths is a possibility, but I would rather opt for your other proposition and place all the external files in a sub-folder.
The initial issue is about adding files from outside the package, not about overriding what is in it. Just my 2 cents. :) Anyway, thanks for working on this. We have just met the requirement on our project and we will be glad to use this feature as soon it is available. Soon, hopefully. 👍 |
Thanks for your feedback @vincent-zurczak, there is more work on this, so the PR is slotted for the 3.4.0 release. |
|
@vladfr can you please rebase from the master branch. I'm getting a test error about something in pkg/release/mock.go that's been fixed there. There is also a difference in cmd/helm/install.go that needs to be handled. |
The error conveys at least as much information as the boolean. Signed-off-by: Simon Alling <alling.simon@gmail.com>
Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
Signed-off-by: Sebastian Sdorra <sebastian.sdorra@cloudogu.com>
A security issue fixed in 3.3.2 caught repos with the same name being added a second time and produced an error. This caused an issue for tools, such as helmfile, that will add the same name with the same configuration multiple times. This fix checks that the configuration on the existing and new repo are the same. If there is no change it notes it and exists with a 0 exit code. If there is a change the existing error is returned (for reverse compat). If --force-update is given the user opts in to changing the config for the name. Closes helm#8771 Signed-off-by: Matt Farina <matt@mattfarina.com>
Add size of labels and number of reviewers is listed twice, pointing the area with less detail to the one with more detail. Signed-off-by: Matt Farina <matt@mattfarina.com>
This ensures warning messages are displayed on stderr rather than stdout. Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
Signed-off-by: lemonli <liwenjun0323@gmail.com>
When helm#8779 was merged it introduced an issue with windows builds, which we do not test for in PR CI. This change fixes that problem. Signed-off-by: Matt Farina <matt@mattfarina.com>
Closes helm#8806 Signed-off-by: Matt Farina <matt@mattfarina.com>
Remove klog flags from help text. No change to behavior.
```
...
Flags:
--debug enable verbose output
-h, --help help for helm
--kube-apiserver string the address and the port for the Kubernetes API server
--kube-context string name of the kubeconfig context to use
--kube-token string bearer token used for authentication
--kubeconfig string path to the kubeconfig file
-n, --namespace string namespace scope for this request
--registry-config string path to the registry config file (default "/Users/areese/.config/helm/registry.json")
--repository-cache string path to the file containing cached repository indexes (default "/Users/areese/.cache/helm/repository")
--repository-config string path to the file containing repository names and URLs (default "/Users/areese/.config/helm/repositories.yaml")
```
Signed-off-by: Adam Reese <adam@reese.io>
Signed-off-by: zouyu <zouy.fnst@cn.fujitsu.com>
Bumps [github.com/lib/pq](https://github.com/lib/pq) from 1.7.0 to 1.8.0. - [Release notes](https://github.com/lib/pq/releases) - [Commits](lib/pq@v1.7.0...v1.8.0) Signed-off-by: dependabot[bot] <support@github.com>
Bumps [github.com/gofrs/flock](https://github.com/gofrs/flock) from 0.7.1 to 0.8.0. - [Release notes](https://github.com/gofrs/flock/releases) - [Commits](gofrs/flock@v0.7.1...v0.8.0) Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Mikuláš Dítě <dite@mangoweb.cz>
Bumps [github.com/sirupsen/logrus](https://github.com/sirupsen/logrus) from 1.6.0 to 1.7.0. - [Release notes](https://github.com/sirupsen/logrus/releases) - [Changelog](https://github.com/sirupsen/logrus/blob/master/CHANGELOG.md) - [Commits](sirupsen/logrus@v1.6.0...v1.7.0) Signed-off-by: dependabot[bot] <support@github.com>
Bumps [github.com/DATA-DOG/go-sqlmock](https://github.com/DATA-DOG/go-sqlmock) from 1.4.1 to 1.5.0. - [Release notes](https://github.com/DATA-DOG/go-sqlmock/releases) - [Commits](DATA-DOG/go-sqlmock@v1.4.1...v1.5.0) Signed-off-by: dependabot[bot] <support@github.com>
|
@mattfarina - Unfortunately, I am not able to tend to this in the next few weeks to a month. I have made an attempt, but I messed it up. Sorry about that :( If someone else can pick it up, I'm ok with that. If this still open when I return, I'll clean it up. |
|
I can do it is a feature that I am using. |
|
I opened the new PR in #8841 |
|
It appears this PR is overcome by #8841. So, I am going to close it. If this is not the case we can re-open. |
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
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/") }}Still todo:
--include-dirto get all files in a dir; this could be enhanced with glob