Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote helm charts should not be upgraded by default #3274

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions docs/content/en/schemas/v2beta5.json
Original file line number Diff line number Diff line change
Expand Up @@ -1250,8 +1250,8 @@
},
"remote": {
"type": "boolean",
"description": "specifies whether the chart path is remote, or exists on the host filesystem. `remote: true` implies `skipBuildDependencies: true`.",
"x-intellij-html-description": "specifies whether the chart path is remote, or exists on the host filesystem. <code>remote: true</code> implies <code>skipBuildDependencies: true</code>.",
"description": "specifies whether the chart path is remote, or exists on the host filesystem.",
"x-intellij-html-description": "specifies whether the chart path is remote, or exists on the host filesystem.",
"default": "false"
},
"setFiles": {
Expand Down Expand Up @@ -1283,10 +1283,15 @@
},
"skipBuildDependencies": {
"type": "boolean",
"description": "should build dependencies be skipped.",
"x-intellij-html-description": "should build dependencies be skipped.",
"description": "should build dependencies be skipped. Ignored when `remote: true`.",
"x-intellij-html-description": "should build dependencies be skipped. Ignored when <code>remote: true</code>.",
"default": "false"
},
"upgradeOnChange": {
"type": "boolean",
"description": "specifies whether to upgrade helm chart on code changes. Default is `true` when helm chart is local (`remote: false`). Default is `false` if `remote: true`.",
"x-intellij-html-description": "specifies whether to upgrade helm chart on code changes. Default is <code>true</code> when helm chart is local (<code>remote: false</code>). Default is <code>false</code> if <code>remote: true</code>."
},
"useHelmSecrets": {
"type": "boolean",
"description": "instructs skaffold to use secrets plugin on deployment.",
Expand Down Expand Up @@ -1329,6 +1334,7 @@
"skipBuildDependencies",
"useHelmSecrets",
"remote",
"upgradeOnChange",
"overrides",
"packaged",
"imageStrategy"
Expand Down
8 changes: 8 additions & 0 deletions pkg/skaffold/deploy/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,14 @@ func (h *HelmDeployer) deployRelease(ctx context.Context, out io.Writer, r lates

opts.upgrade = false
opts.flags = h.Flags.Install
} else {
if r.UpgradeOnChange != nil && !*r.UpgradeOnChange {
logrus.Infof("Release %s already installed...", releaseName)
return []Artifact{}, nil
} else if r.UpgradeOnChange == nil && r.Remote {
logrus.Infof("Release %s not upgraded as it is remote...", releaseName)
return []Artifact{}, nil
}
}

// Only build local dependencies, but allow a user to skip them.
Expand Down
16 changes: 16 additions & 0 deletions pkg/skaffold/deploy/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,15 @@ var testDeployRemoteChart = latest.HelmDeploy{
}},
}

var upgradeOnChangeFalse = false
var testDeployUpgradeOnChange = latest.HelmDeploy{
Releases: []latest.HelmRelease{{
Name: "skaffold-helm-upgradeOnChange",
ChartPath: "examples/test",
UpgradeOnChange: &upgradeOnChangeFalse,
}},
}

var testDeployWithoutTags = latest.HelmDeploy{
Releases: []latest.HelmRelease{{
Name: "skaffold-helm",
Expand Down Expand Up @@ -507,6 +516,13 @@ func TestHelmDeploy(t *testing.T) {
runContext: makeRunContext(testDeploySkipBuildDependencies, false),
builds: testBuilds,
},
{
description: "deploy success when `upgradeOnChange: false` and does not upgrade",
commands: testutil.
CmdRunWithOutput("helm version", version21).
AndRun("helm --kube-context kubecontext get skaffold-helm-upgradeOnChange --kubeconfig kubeconfig"),
runContext: makeRunContext(testDeployUpgradeOnChange, false),
},
{