Skip to content

Commit 01b7247

Browse files
committed
add SkipCRDs helm flag
Signed-off-by: Mikhail Scherba <mikhail.scherba@flant.com>
1 parent b19d19c commit 01b7247

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

pkg/helm/helm3/helm3.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ func (h *Helm3Client) UpgradeRelease(releaseName string, chart string, valuesPat
142142
args := []string{
143143
"upgrade", releaseName, chart,
144144
"--install",
145+
"--skip-crds",
145146
"--history-max", fmt.Sprintf("%d", Options.HistoryMax),
146147
"--timeout", Options.Timeout.String(),
147148
"--post-renderer", "./post-renderer",

pkg/helm/helm3lib/helm3lib.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ func (h *LibClient) upgradeRelease(releaseName string, chartName string, valuesP
189189
}
190190

191191
upg.Install = true
192+
upg.SkipCRDs = true
192193
upg.MaxHistory = int(options.HistoryMax)
193194
upg.Timeout = options.Timeout
194195

@@ -235,6 +236,7 @@ func (h *LibClient) upgradeRelease(releaseName string, chartName string, valuesP
235236
if helmPostRenderer != nil {
236237
instClient.PostRenderer = helmPostRenderer
237238
}
239+
instClient.SkipCRDs = true
238240
instClient.Timeout = options.Timeout
239241
instClient.ReleaseName = releaseName
240242
instClient.UseReleaseName = true
@@ -434,14 +436,14 @@ func (h *LibClient) Render(releaseName, chartName string, valuesPaths, setValues
434436
slog.String("chart", chartName),
435437
slog.String("namespace", namespace))
436438

437-
inst := newInstAction(namespace, releaseName)
439+
inst := newDryRunInstAction(namespace, releaseName)
438440

439441
rs, err := inst.Run(chart, resultValues)
440442
if err != nil {
441443
// helm render can fail because the CRD were previously created
442444
// handling this case we can reinitialize RESTClient and repeat one more time by backoff
443445
_ = h.actionConfigInit()
444-
inst = newInstAction(namespace, releaseName)
446+
inst = newDryRunInstAction(namespace, releaseName)
445447

446448
rs, err = inst.Run(chart, resultValues)
447449
}
@@ -462,7 +464,7 @@ func (h *LibClient) Render(releaseName, chartName string, valuesPaths, setValues
462464
return rs.Manifest, nil
463465
}
464466

465-
func newInstAction(namespace, releaseName string) *action.Install {
467+
func newDryRunInstAction(namespace, releaseName string) *action.Install {
466468
inst := action.NewInstall(actionConfig)
467469
inst.DryRun = true
468470

0 commit comments

Comments
 (0)