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

#296 Support remote helm chart repositories #1254

Merged
merged 6 commits into from
Jan 30, 2019
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
2 changes: 2 additions & 0 deletions integration/examples/annotated-skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ deploy:
# namespace: skaffold
# version: ""
# recreatePods: false
# # set to true if you need to skip "helm dep build". Necessary for use with remote chart.
# skipBuildDependencies: false
#
# # setValues get appended to the helm deploy with --set.
# setValues:
Expand Down
10 changes: 6 additions & 4 deletions pkg/skaffold/deploy/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,12 @@ func (h *HelmDeployer) deployRelease(ctx context.Context, out io.Writer, r lates
}
}

// First build dependencies.
logrus.Infof("Building helm dependencies...")
if err := h.helm(ctx, out, "dep", "build", r.ChartPath); err != nil {
return nil, errors.Wrap(err, "building helm dependencies")
if !r.SkipBuildDependencies {
// First build dependencies.
logrus.Infof("Building helm dependencies...")
if err := h.helm(ctx, out, "dep", "build", r.ChartPath); err != nil {
return nil, errors.Wrap(err, "building helm dependencies")
}
}

var args []string
Expand Down
36 changes: 36 additions & 0 deletions pkg/skaffold/deploy/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,26 @@ var testDeployWithTemplatedName = &latest.HelmDeploy{
},
}

var testDeploySkipBuildDependencies = &latest.HelmDeploy{
Releases: []latest.HelmRelease{
{
Name: "skaffold-helm",
ChartPath: "stable/chartmuseum",
SkipBuildDependencies: true,
},
},
}

var testDeployRemoteChart = &latest.HelmDeploy{
Releases: []latest.HelmRelease{
{
Name: "skaffold-helm-remote",
ChartPath: "stable/chartmuseum",
SkipBuildDependencies: false,
},
},
}

var testNamespace = "testNamespace"

var validDeployYaml = `
Expand Down Expand Up @@ -268,6 +288,22 @@ func TestHelmDeploy(t *testing.T) {
builds: testBuilds,
shouldErr: true,
},
{
description: "deploy success remote chart with skipBuildDependencies",
cmd: &MockHelm{t: t},
deployer: NewHelmDeployer(testDeploySkipBuildDependencies, testKubeContext, testNamespace, ""),
builds: testBuilds,
},
{
description: "deploy error remote chart without skipBuildDependencies",
cmd: &MockHelm{
t: t,
depResult: fmt.Errorf("unexpected error"),
},
deployer: NewHelmDeployer(testDeployRemoteChart, testKubeContext, testNamespace, ""),
builds: testBuilds,
shouldErr: true,
},
{
description: "get failure should install not upgrade",
cmd: &MockHelm{
Expand Down
27 changes: 14 additions & 13 deletions pkg/skaffold/schema/latest/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,19 +187,20 @@ type KustomizeDeploy struct {
}

type HelmRelease struct {
Name string `yaml:"name,omitempty"`
ChartPath string `yaml:"chartPath,omitempty"`
ValuesFiles []string `yaml:"valuesFiles,omitempty"`
Values map[string]string `yaml:"values,omitempty,omitempty"`
Namespace string `yaml:"namespace,omitempty"`
Version string `yaml:"version,omitempty"`
SetValues map[string]string `yaml:"setValues,omitempty"`
SetValueTemplates map[string]string `yaml:"setValueTemplates,omitempty"`
Wait bool `yaml:"wait,omitempty"`
RecreatePods bool `yaml:"recreatePods,omitempty"`
Overrides map[string]interface{} `yaml:"overrides,omitempty"`
Packaged *HelmPackaged `yaml:"packaged,omitempty"`
ImageStrategy HelmImageStrategy `yaml:"imageStrategy,omitempty"`
Name string `yaml:"name,omitempty"`
ChartPath string `yaml:"chartPath,omitempty"`
ValuesFiles []string `yaml:"valuesFiles,omitempty"`
Values map[string]string `yaml:"values,omitempty,omitempty"`
Namespace string `yaml:"namespace,omitempty"`
Version string `yaml:"version,omitempty"`
SetValues map[string]string `yaml:"setValues,omitempty"`
SetValueTemplates map[string]string `yaml:"setValueTemplates,omitempty"`
Wait bool `yaml:"wait,omitempty"`
RecreatePods bool `yaml:"recreatePods,omitempty"`
SkipBuildDependencies bool `yaml:"skipBuildDependencies,omitempty"`
eraac marked this conversation as resolved.
Show resolved Hide resolved
Overrides map[string]interface{} `yaml:"overrides,omitempty"`
Packaged *HelmPackaged `yaml:"packaged,omitempty"`
ImageStrategy HelmImageStrategy `yaml:"imageStrategy,omitempty"`
}

// HelmPackaged represents parameters for packaging helm chart.
Expand Down