mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-09 04:09:49 +02:00
Add support for --validate on chartify (#1960)
Apparently we needed to pass `--validate` on helm-template run by chartify when the targeted chart contains Capabilities.APIVersions in a chart template. Otherwise, you can never make such chart work with chartify, as at apply time helm template expressions that involved Capabilities.APIVersions are already nowhere.
This commit is contained in:
@@ -172,6 +172,7 @@ func (a *App) Diff(c DiffConfigProvider) error {
|
||||
SkipRepos: c.SkipDeps(),
|
||||
SkipDeps: c.SkipDeps(),
|
||||
IncludeCRDs: &includeCRDs,
|
||||
Validate: c.Validate(),
|
||||
}, func() {
|
||||
msg, matched, affected, errs = a.diff(run, c)
|
||||
})
|
||||
@@ -238,6 +239,7 @@ func (a *App) Template(c TemplateConfigProvider) error {
|
||||
SkipDeps: c.SkipDeps(),
|
||||
IncludeCRDs: &includeCRDs,
|
||||
SkipCleanup: c.SkipCleanup(),
|
||||
Validate: c.Validate(),
|
||||
}, func() {
|
||||
ok, errs = a.template(run, c)
|
||||
})
|
||||
@@ -392,6 +394,7 @@ func (a *App) Apply(c ApplyConfigProvider) error {
|
||||
WaitForJobs: c.WaitForJobs(),
|
||||
IncludeCRDs: &includeCRDs,
|
||||
SkipCleanup: c.RetainValuesFiles() || c.SkipCleanup(),
|
||||
Validate: c.Validate(),
|
||||
}, func() {
|
||||
matched, updated, es := a.apply(run, c)
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ type ApplyConfigProvider interface {
|
||||
DiffOutput() string
|
||||
|
||||
RetainValuesFiles() bool
|
||||
Validate() bool
|
||||
SkipCleanup() bool
|
||||
SkipDiffOnInstall() bool
|
||||
|
||||
@@ -90,6 +91,7 @@ type DiffConfigProvider interface {
|
||||
|
||||
Values() []string
|
||||
Set() []string
|
||||
Validate() bool
|
||||
SkipCRDs() bool
|
||||
SkipDeps() bool
|
||||
|
||||
|
||||
+9
-5
@@ -966,10 +966,13 @@ type ChartPrepareOptions struct {
|
||||
SkipDeps bool
|
||||
SkipResolve bool
|
||||
SkipCleanup bool
|
||||
IncludeCRDs *bool
|
||||
Wait bool
|
||||
WaitForJobs bool
|
||||
OutputDir string
|
||||
// Validate is a helm-3-only option. When it is set to true, it configures chartify to pass --validate to helm-template run by it.
|
||||
// It's required when one of your chart relies on Capabilities.APIVersions in a template
|
||||
Validate bool
|
||||
IncludeCRDs *bool
|
||||
Wait bool
|
||||
WaitForJobs bool
|
||||
OutputDir string
|
||||
}
|
||||
|
||||
type chartPrepareResult struct {
|
||||
@@ -1142,9 +1145,10 @@ func (st *HelmState) PrepareCharts(helm helmexec.Interface, dir string, concurre
|
||||
if opts.IncludeCRDs != nil {
|
||||
includeCRDs = *opts.IncludeCRDs
|
||||
}
|
||||
|
||||
chartifyOpts.IncludeCRDs = includeCRDs
|
||||
|
||||
chartifyOpts.Validate = opts.Validate
|
||||
|
||||
out, err := c.Chartify(release.Name, chartPath, chartify.WithChartifyOpts(chartifyOpts))
|
||||
if err != nil {
|
||||
results <- &chartPrepareResult{err: err}
|
||||
|
||||
Reference in New Issue
Block a user