mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-10 08:20:59 +00:00
Add --helm-debug Flag to Kustomize for Enhanced Helm Debugging (#5751)
* feat: add helm-debug flag * revert: go.work.sum * test: add helm chart args helm-debug test * test: helm debug flag * refactor: helm debug output * style: linting * revert: go.work.sum
This commit is contained in:
@@ -96,6 +96,9 @@ type HelmChart struct {
|
||||
|
||||
// SkipTests skips tests from templated output.
|
||||
SkipTests bool `json:"skipTests,omitempty" yaml:"skipTests,omitempty"`
|
||||
|
||||
// debug enables debug output from the Helm chart inflator generator.
|
||||
Debug bool `json:"debug,omitempty" yaml:"debug,omitempty"`
|
||||
}
|
||||
|
||||
// HelmChartArgs contains arguments to helm.
|
||||
@@ -188,5 +191,8 @@ func (h HelmChart) AsHelmArgs(absChartHome string) []string {
|
||||
if h.SkipHooks {
|
||||
args = append(args, "--no-hooks")
|
||||
}
|
||||
if h.Debug {
|
||||
args = append(args, "--debug")
|
||||
}
|
||||
return args
|
||||
}
|
||||
|
||||
@@ -60,4 +60,21 @@ func TestAsHelmArgs(t *testing.T) {
|
||||
"-f", "values1", "-f", "values2",
|
||||
"--api-versions", "foo", "--api-versions", "bar"})
|
||||
})
|
||||
|
||||
t.Run("use helm-debug", func(t *testing.T) {
|
||||
p := types.HelmChart{
|
||||
Name: "chart-name",
|
||||
Version: "1.0.0",
|
||||
Repo: "https://helm.releases.hashicorp.com",
|
||||
ValuesFile: "values",
|
||||
AdditionalValuesFiles: []string{"values1", "values2"},
|
||||
Debug: true,
|
||||
}
|
||||
require.Equal(t, p.AsHelmArgs("/home/charts"),
|
||||
[]string{"template", "--generate-name", "/home/charts/chart-name",
|
||||
"-f", "values",
|
||||
"-f", "values1",
|
||||
"-f", "values2",
|
||||
"--debug"})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ type HelmConfig struct {
|
||||
Command string
|
||||
ApiVersions []string
|
||||
KubeVersion string
|
||||
Debug bool
|
||||
}
|
||||
|
||||
// PluginConfig holds plugin configuration.
|
||||
|
||||
Reference in New Issue
Block a user