From acc1927b17c949d880766f952599426ef0fdb66d Mon Sep 17 00:00:00 2001 From: Eliran Bivas Date: Tue, 17 Jul 2018 12:26:01 +0300 Subject: [PATCH] add support for helm image convention vs fqn setting --- pkg/skaffold/deploy/helm.go | 9 ++++++++- pkg/skaffold/schema/v1alpha2/config.go | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/pkg/skaffold/deploy/helm.go b/pkg/skaffold/deploy/helm.go index ff95dec7e55..eb141f47188 100644 --- a/pkg/skaffold/deploy/helm.go +++ b/pkg/skaffold/deploy/helm.go @@ -128,7 +128,14 @@ func (h *HelmDeployer) deployRelease(out io.Writer, r v1alpha2.HelmRelease, buil var setOpts []string for k, v := range params { setOpts = append(setOpts, "--set") - setOpts = append(setOpts, fmt.Sprintf("%s=%s", k, v.Tag)) + if r.ImageStrategy.HelmImageConfig.HelmFQNConfig != nil { + setOpts = append(setOpts, fmt.Sprintf("%s=%s", k, v.Tag)) + } else { + tagSplit := strings.Split(v.Tag, ":") + imageRepository := fmt.Sprintf("%s.repository=%s", k, tagSplit[0]) + imageTag := fmt.Sprintf("%s.tag=%s", k, tagSplit[1]) + setOpts = append(setOpts, imageRepository, imageTag) + } } // First build dependencies. diff --git a/pkg/skaffold/schema/v1alpha2/config.go b/pkg/skaffold/schema/v1alpha2/config.go index 39dbb6b00b0..c02a53aa038 100644 --- a/pkg/skaffold/schema/v1alpha2/config.go +++ b/pkg/skaffold/schema/v1alpha2/config.go @@ -150,6 +150,7 @@ type HelmRelease struct { Wait bool `yaml:"wait"` Overrides map[string]interface{} `yaml:"overrides"` Packaged *HelmPackaged `yaml:"packaged"` + ImageStrategy HelmImageStrategy `yaml:"imageStrategy"` } // HelmPackaged represents parameters for packaging helm chart. @@ -161,6 +162,24 @@ type HelmPackaged struct { AppVersion string `yaml:"appVersion"` } +type HelmImageStrategy struct { + HelmImageConfig `yaml:",inline"` +} + +type HelmImageConfig struct { + HelmFQNConfig *HelmFQNConfig `yaml:"fqn"` + HelmConventionConfig *HelmConventionConfig `yaml:"helm"` +} + +// HelmFQNConfig represents image config to use the FullyQualifiedImageName as param to set +type HelmFQNConfig struct { + Property string `yaml:"property"` +} + +// HelmConventionConfig represents image config in the syntax of image.repository and image.tag +type HelmConventionConfig struct { +} + // Artifact represents items that need to be built, along with the context in which // they should be built. type Artifact struct {