From 60f6c066d6981cca443ee676d2579cc40e58ff54 Mon Sep 17 00:00:00 2001 From: akash-gautam Date: Mon, 24 Feb 2020 00:23:14 +0530 Subject: [PATCH] fix(helm): add --skipCRDs flag to 'helm upgrade' When 'helm upgrade --install' is run, this will allow to skip installing CRDs Closes #7452 Signed-off-by: akash-gautam Signed-off-by: Matheus Hunsche --- cmd/helm/upgrade.go | 2 ++ pkg/action/upgrade.go | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index dea866e4d..53aef7af7 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -105,6 +105,7 @@ func newUpgradeCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { instClient.ChartPathOptions = client.ChartPathOptions instClient.DryRun = client.DryRun instClient.DisableHooks = client.DisableHooks + instClient.SkipCRDs = client.SkipCRDs instClient.Timeout = client.Timeout instClient.Wait = client.Wait instClient.Devel = client.Devel @@ -170,6 +171,7 @@ func newUpgradeCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { f.BoolVar(&client.Force, "force", false, "force resource updates through a replacement strategy") f.BoolVar(&client.DisableHooks, "no-hooks", false, "disable pre/post upgrade hooks") f.BoolVar(&client.DisableOpenAPIValidation, "disable-openapi-validation", false, "if set, the upgrade process will not validate rendered templates against the Kubernetes OpenAPI Schema") + f.BoolVar(&client.SkipCRDs, "skip-crds", false, "if set, no CRDs will be installed when an upgrade is performed with install flag enabled. By default, CRDs are installed if not already present, when an upgrade is performed with install flag enabled") f.DurationVar(&client.Timeout, "timeout", 300*time.Second, "time to wait for any individual Kubernetes operation (like Jobs for hooks)") f.BoolVar(&client.ResetValues, "reset-values", false, "when upgrading, reset the values to the ones built into the chart") f.BoolVar(&client.ReuseValues, "reuse-values", false, "when upgrading, reuse the last release's values and merge in any overrides from the command line via --set and -f. If '--reset-values' is specified, this is ignored") diff --git a/pkg/action/upgrade.go b/pkg/action/upgrade.go index 08b638171..62e26adb4 100644 --- a/pkg/action/upgrade.go +++ b/pkg/action/upgrade.go @@ -42,9 +42,11 @@ type Upgrade struct { ChartPathOptions - Install bool - Devel bool - Namespace string + Install bool + Devel bool + Namespace string + // SkipCRDs skip installing CRDs when install flag is enabled during upgrade + SkipCRDs bool Timeout time.Duration Wait bool DisableHooks bool