Skip to content

Commit

Permalink
ReAdding template file filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
jguionnet committed Oct 25, 2023
1 parent 2e57203 commit 3af4232
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions modules/helm/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,17 @@ func RenderRemoteTemplateE(t testing.TestingT, options *Options, chartURL string
if err != nil {
return "", err
}
// for _, templateFile := range templateFiles {
// // validate this is a valid template file
// absTemplateFile := filepath.Join(absChartDir, templateFile)
// if !strings.HasPrefix(templateFile, "charts") && !files.FileExists(absTemplateFile) {
// return "", errors.WithStackTrace(TemplateFileNotFoundError{Path: templateFile, ChartDir: absChartDir})
// }

// // Note: we only get the abs template file path to check it actually exists, but the `helm template` command
// // expects the relative path from the chart.
// args = append(args, "--show-only", templateFile)
// }
for _, templateFile := range templateFiles {
// validate this is a valid template file
// absTemplateFile := filepath.Join(absChartDir, templateFile)
// if !strings.HasPrefix(templateFile, "charts") && !files.FileExists(absTemplateFile) {
// return "", errors.WithStackTrace(TemplateFileNotFoundError{Path: templateFile, ChartDir: absChartDir})
// }

// Note: we only get the abs template file path to check it actually exists, but the `helm template` command
// expects the relative path from the chart.
args = append(args, "--show-only", templateFile)
}
// deal extraHelmArgs
args = append(args, extraHelmArgs...)

Expand Down
2 changes: 1 addition & 1 deletion test/helm_keda_remote_example_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestHelmKedaRemoteExampleTemplateRenderedDeployment(t *testing.T) {
// we want to assert that the template renders without any errors.
// Additionally, although we know there is only one yaml file in the template, we deliberately path a templateFiles
// arg to demonstrate how to select individual templates to render.
output := helm.RenderRemoteTemplate(t, options, "https://kedacore.github.io/charts", releaseName, []string{"templates/metrics-server/deployment.yamll"})
output := helm.RenderRemoteTemplate(t, options, "https://kedacore.github.io/charts", releaseName, []string{"templates/metrics-server/deployment.yaml"})

// Now we use kubernetes/client-go library to render the template output into the Deployment struct. This will
// ensure the Deployment resource is rendered correctly.
Expand Down

0 comments on commit 3af4232

Please sign in to comment.