-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix: Helm deploy was not working with variable templatinging chart path #9600
fix: Helm deploy was not working with variable templatinging chart path #9600
Conversation
I believe the chartPath property is supposed to be a templatable field. In my use I have helm charts in a separate git repo from the application where the skaffold.yaml is. We defined a skaffold.env.template file, that we add to git and then on checkout we copy this to skaffold.env and modify as needed, so the path to the location to the other repo with a helm chart is a variable. and this skaffold.env file is added to the .gitignore We noticed that we were getting listing files: issue walking releases: lstat {{.HELM_REPO}}/helm/app/chart/path: no such file or directory This PR fixes this issue.
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi team,
I'm currently reviewing this pull request and will provide a full review shortly. In the meantime, here's a quick summary for you and other reviewers to get up to speed:
This pull request, submitted by @travishein, addresses an issue where Helm deployments were failing when using variable templating for the chartPath
property. The problem stemmed from the chartPath
not being correctly interpreted as a template, leading to errors like lstat {{.HELM_REPO}}/helm/app/chart/path: no such file or directory
.
Intent: The primary goal is to enable the use of environment variables within the chartPath
setting for Helm deployments, allowing for more flexible chart location management.
Changes:
The core change involves modifying the helm.go
file (specifically lines 398-408). The original code directly used the release.ChartPath
value, which was not being templated. The updated code now uses util.ExpandEnvTemplateOrFail
to expand any environment variables present in release.ChartPath
before using it to locate the Helm chart. This ensures that the path is correctly resolved, even if it's defined using variables from a skaffold.env
file.
Summary Table:
File | Change Summary |
---|---|
pkg/skaffold/deploy/helm/helm.go |
Added environment variable expansion to release.ChartPath before path traversal. |
I'll provide a more detailed review shortly, including a check for potential edge cases and thorough testing.
And now, a little haiku to lighten the mood:
Paths once unclear,
Now templated, bright and bold,
Skaffold builds anew.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change correctly addresses the issue of the chartPath
not being templatable by expanding the environment variable. The implementation is good, but a couple of minor suggestions for improved readability and a potential performance enhancement are included below.
…th (GoogleContainerTools#9600) * fix: Helm deployer was not working with variable templatingin chartPath I believe the chartPath property is supposed to be a templatable field. In my use I have helm charts in a separate git repo from the application where the skaffold.yaml is. We defined a skaffold.env.template file, that we add to git and then on checkout we copy this to skaffold.env and modify as needed, so the path to the location to the other repo with a helm chart is a variable. and this skaffold.env file is added to the .gitignore We noticed that we were getting listing files: issue walking releases: lstat {{.HELM_REPO}}/helm/app/chart/path: no such file or directory This PR fixes this issue. * fix: lint warnings.
I believe the chartPath property is supposed to be a templatable field.
In my use I have helm charts in a separate git repo from the application where the skaffold.yaml is. We defined a skaffold.env.template file, that we add to git and then on checkout we copy this to skaffold.env and modify as needed, so the path to the location to the other repo with a helm chart is a variable. and this skaffold.env file is added to the .gitignore
We noticed that we were getting
listing files: issue walking releases: lstat {{.HELM_REPO}}/helm/app/chart/path: no such file or directory
This PR fixes this issue.
Fixes: #nnn
Related: Relevant tracking issues, for context
Merge before/after: Dependent or prerequisite PRs
Description
User facing changes (remove if N/A)
Follow-up Work (remove if N/A)