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 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
31 changes: 31 additions & 0 deletions docs/content/en/schemas/v1beta6.json
Original file line number Diff line number Diff line change
Expand Up @@ -492,11 +492,42 @@
},
"type": "array",
"description": "a list of Helm releases."
},
"flags": {
"$ref": "#/definitions/HelmDeployFlags",
"description": "Optional flags to send to the helm command"
}
},
"additionalProperties": false,
"description": "(beta) uses the <code>helm</code> CLI to apply the charts to the cluster."
},
"HelmDeployFlags": {
"properties": {
"global": {
"items": {
"type": "string"
},
"type": "array",
"default": "[]"
},
"install": {
"items": {
"type": "string"
},
"type": "array",
"default": "[]"
},
"upgrade": {
"items": {
"type": "string"
},
"type": "array",
"default": "[]"
}
},
"additionalProperties": false,
"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
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
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 @@ -342,6 +342,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:"install,omitempty"`
Upgrade []string `yaml:"upgrade,omitempty"`
}

// KustomizeDeploy (beta) uses the `kustomize` CLI to "patch" a deployment for a target environment.
Expand Down