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 5 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
2 changes: 1 addition & 1 deletion docs/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ weight = 1
copyright = "Skaffold Authors"
privacy_policy = "https://policies.google.com/privacy"
github_repo = "https://github.com/GoogleContainerTools/skaffold"
skaffold_version = "skaffold/v2alpha3"
skaffold_version = "skaffold/v2alpha4"

# Google Custom Search Engine ID. Remove or comment out to disable search.
gcs_engine_id = "013756393218025596041:3nojel67sum"
Expand Down
2,069 changes: 2,069 additions & 0 deletions docs/content/en/schemas/v2alpha4.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion integration/examples/bazel/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
artifacts:
Expand Down
2 changes: 1 addition & 1 deletion integration/examples/buildpacks-node/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
artifacts:
Expand Down
2 changes: 1 addition & 1 deletion integration/examples/buildpacks/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
artifacts:
Expand Down
2 changes: 1 addition & 1 deletion integration/examples/custom/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
artifacts:
Expand Down
2 changes: 1 addition & 1 deletion integration/examples/gcb-kaniko/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
googleCloudBuild:
Expand Down
2 changes: 1 addition & 1 deletion integration/examples/generate-pipeline/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
artifacts:
Expand Down
2 changes: 1 addition & 1 deletion integration/examples/getting-started/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
artifacts:
Expand Down
2 changes: 1 addition & 1 deletion integration/examples/google-cloud-build/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
googleCloudBuild:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
tagPolicy:
Expand Down
2 changes: 1 addition & 1 deletion integration/examples/helm-deployment/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
tagPolicy:
Expand Down
2 changes: 1 addition & 1 deletion integration/examples/hot-reload/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
artifacts:
Expand Down
2 changes: 1 addition & 1 deletion integration/examples/jib-gradle/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
artifacts:
Expand Down
2 changes: 1 addition & 1 deletion integration/examples/jib-multimodule/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
artifacts:
Expand Down
2 changes: 1 addition & 1 deletion integration/examples/jib/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
artifacts:
Expand Down
2 changes: 1 addition & 1 deletion integration/examples/kaniko/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
artifacts:
Expand Down
2 changes: 1 addition & 1 deletion integration/examples/kustomize/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
deploy:
kustomize: {}
2 changes: 1 addition & 1 deletion integration/examples/microservices/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
artifacts:
Expand Down
2 changes: 1 addition & 1 deletion integration/examples/nodejs/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config

build:
Expand Down
2 changes: 1 addition & 1 deletion integration/examples/profile-patches/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
# only build and deploy "base-service" on main profile
Expand Down
2 changes: 1 addition & 1 deletion integration/examples/profiles/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
# only build and deploy "world-service" on main profile
Expand Down
2 changes: 1 addition & 1 deletion integration/examples/react-reload/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
artifacts:
Expand Down
2 changes: 1 addition & 1 deletion integration/examples/ruby/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
artifacts:
Expand Down
2 changes: 1 addition & 1 deletion integration/examples/structure-tests/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
artifacts:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
artifacts:
Expand Down
2 changes: 1 addition & 1 deletion integration/testdata/build/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
local:
Expand Down
2 changes: 1 addition & 1 deletion integration/testdata/debug/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
artifacts:
Expand Down
2 changes: 1 addition & 1 deletion integration/testdata/deploy-multiple/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
artifacts:
Expand Down
2 changes: 1 addition & 1 deletion integration/testdata/dev/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
artifacts:
Expand Down
2 changes: 1 addition & 1 deletion integration/testdata/gke_loadbalancer/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
artifacts:
Expand Down
2 changes: 1 addition & 1 deletion integration/testdata/init/compose/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
metadata:
name: compose
Expand Down
2 changes: 1 addition & 1 deletion integration/testdata/jib/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
artifacts:
Expand Down
2 changes: 1 addition & 1 deletion integration/testdata/kaniko-explicit-repo/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
artifacts:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
artifacts:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
profiles:
- name: build-artifact
Expand Down
2 changes: 1 addition & 1 deletion integration/testdata/kaniko-microservices/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
artifacts:
Expand Down
2 changes: 1 addition & 1 deletion integration/testdata/kaniko-sub-folder/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
artifacts:
Expand Down
2 changes: 1 addition & 1 deletion integration/testdata/kaniko-target/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
artifacts:
Expand Down
2 changes: 1 addition & 1 deletion integration/testdata/tagPolicy/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: skaffold/v2alpha3
apiVersion: skaffold/v2alpha4
kind: Config
build:
artifacts:
Expand Down
32 changes: 26 additions & 6 deletions pkg/skaffold/deploy/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,33 @@ func (h *HelmDeployer) deployRelease(ctx context.Context, out io.Writer, r lates
args = append(args, "install", "--name", releaseName)
args = append(args, h.Flags.Install...)
} else {
args = append(args, "upgrade", releaseName)
args = append(args, h.Flags.Upgrade...)
if h.forceDeploy {
args = append(args, "--force")

dahovey marked this conversation as resolved.
Show resolved Hide resolved
var shouldUpgrade bool
if r.UpgradeOnChange != nil {
shouldUpgrade = *r.UpgradeOnChange

if !shouldUpgrade {
logrus.Infof("Release %s already installed...\n", releaseName)
}
} else {
shouldUpgrade = !r.Remote

if !shouldUpgrade {
logrus.Infof("Release %s not upgraded since remote (see `upgradeOnChange`)...\n", releaseName)
}
}
if r.RecreatePods {
args = append(args, "--recreate-pods")

if shouldUpgrade {
args = append(args, "upgrade", releaseName)
args = append(args, h.Flags.Upgrade...)
if h.forceDeploy {
args = append(args, "--force")
}
if r.RecreatePods {
args = append(args, "--recreate-pods")
}
} else {
return []Artifact{}, nil
}
}

Expand Down
18 changes: 18 additions & 0 deletions pkg/skaffold/deploy/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,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 @@ -369,6 +378,15 @@ func TestHelmDeploy(t *testing.T) {
runContext: makeRunContext(testDeploySkipBuildDependencies, false),
builds: testBuilds,
},
{
description: "deploy success when `upgradeOnChange: false` and does not upgrade",
commands: &MockHelm{
installResult: fmt.Errorf("should not have called install"),
upgradeResult: fmt.Errorf("should not have called upgrade"),
},
runContext: makeRunContext(testDeployUpgradeOnChange, false),
builds: testBuilds,
},
{
description: "deploy error remote chart without skipBuildDependencies",
commands: &MockHelm{
Expand Down
10 changes: 7 additions & 3 deletions pkg/skaffold/schema/latest/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/util"
)

// !!! WARNING !!! This config version is already released, please DO NOT MODIFY the structs in this file.
const Version string = "skaffold/v2alpha3"
// This config version is not yet released, it is SAFE TO MODIFY the structs in this file.
const Version string = "skaffold/v2alpha4"

// NewSkaffoldConfig creates a SkaffoldConfig
func NewSkaffoldConfig() util.VersionedConfig {
Expand Down Expand Up @@ -510,9 +510,13 @@ type HelmRelease struct {
UseHelmSecrets bool `yaml:"useHelmSecrets,omitempty"`

// Remote specifies whether the chart path is remote, or exists on the host filesystem.
// `remote: true` implies `skipBuildDependencies: true`.
// `remote: true` implies `skipBuildDependencies: true` and `upgradeOnChange: false`.
// `remote: false` implies `upgradeOnChange: true`.
Remote bool `yaml:"remote,omitempty"`
dahovey marked this conversation as resolved.
Show resolved Hide resolved

// UpgradeOnChange specifies whether to upgrade helm chart on code changes.
UpgradeOnChange *bool `yaml:"upgradeOnChange,omitempty"`

// Overrides are key-value pairs.
// If present, Skaffold will build a Helm `values` file that overrides
// the original and use it to call Helm CLI (`--f` flag).
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v2alpha2/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ limitations under the License.
package v2alpha2

import (
next "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/util"
next "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/v2alpha3"
pkgutil "github.com/GoogleContainerTools/skaffold/pkg/skaffold/util"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/schema/v2alpha2/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

yaml "gopkg.in/yaml.v2"

next "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest"
next "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/v2alpha3"
"github.com/GoogleContainerTools/skaffold/testutil"
)

Expand Down
Loading