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

Helm flags for Global, Install and Upgrade helm commands #1673

Merged
merged 8 commits into from
Feb 26, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions examples/annotated-skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ deploy:
# delete: [""]

# helm:
# helm can be passed additional option flags either
# on every command (Global), on install (Install) or on upgrade (Upgrade).
# flags:
# global: [""]
# install: [""]
# upgrade: [""]
# helm releases to deploy.
# releases:
# - name: skaffold-helm
Expand Down
8 changes: 7 additions & 1 deletion integration/examples/annotated-skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,13 @@ deploy:
# apply: [""]
# delete: [""]

# helm:
# helm:
# helm can be passed additional option flags either
# on every command (Global), on install (Install) or on upgrade (Upgrade).
# flags:
# global: [""]
# install: [""]
# upgrade: [""]
# helm releases to deploy.
# releases:
# - name: skaffold-helm
Expand Down
3 changes: 3 additions & 0 deletions pkg/skaffold/deploy/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ func (h *HelmDeployer) Cleanup(ctx context.Context, out io.Writer) error {

func (h *HelmDeployer) helm(ctx context.Context, out io.Writer, arg ...string) error {
args := append([]string{"--kube-context", h.kubeContext}, arg...)
args = append(args, h.Flags.Global...)

cmd := exec.CommandContext(ctx, "helm", args...)
cmd.Stdout = out
Expand Down Expand Up @@ -169,8 +170,10 @@ func (h *HelmDeployer) deployRelease(ctx context.Context, out io.Writer, r lates
var args []string
if !isInstalled {
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 r.RecreatePods {
args = append(args, "--recreate-pods")
}
Expand Down
12 changes: 12 additions & 0 deletions pkg/skaffold/schema/latest/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,18 @@ type KubectlFlags struct {
type HelmDeploy struct {
// Releases is a list of Helm releases.
Releases []HelmRelease `yaml:"releases,omitempty" yamltags:"required"`

// Optional flags to send to the helm command
Flags HelmDeployFlags `yaml:"flags,omitempty"`
}

// HelmDeployFlags describes additional options flags that are passed on the command
// line to helm either on every command (Global), on install (Install)
// or on update (Update).
type HelmDeployFlags struct {
Global []string `yaml:"global,omitempty"`
Install []string `yaml:"apply,omitempty"`
tjerkw marked this conversation as resolved.
Show resolved Hide resolved
Upgrade []string `yaml:"delete,omitempty"`
tjerkw marked this conversation as resolved.
Show resolved Hide resolved
tjerkw marked this conversation as resolved.
Show resolved Hide resolved
}

// KustomizeDeploy contains the configuration needed for deploying with `kustomize`.
Expand Down
33 changes: 33 additions & 0 deletions schemas/v1beta5.json
Original file line number Diff line number Diff line change
Expand Up @@ -493,10 +493,43 @@
},
"type": "array",
"description": "a list of Helm releases."
},
"flags": {
"$ref": "#/definitions/HelmDeployFlags",
"description": "Optional flags to send to the helm command"
}
},
"description": "contains the configuration needed for deploying with \u003ccode\u003ehelm\u003c/code\u003e."
},
"HelmDeployFlags": {
"properties": {
"global": {
"items": {
"type": "string",
"default": "\"\""
},
"type": "array",
"default": "[]"
},
"apply": {
"items": {
"type": "string",
"default": "\"\""
},
"type": "array",
"default": "[]"
},
"delete": {
"items": {
"type": "string",
"default": "\"\""
},
"type": "array",
"default": "[]"
}
},
"description": "describes additional options flags that are passed on the command line to helm either on every command (Global), on install (Install) or on update (Update)."
},
"KustomizeDeploy": {
"properties": {
"path": {
Expand Down