From 05120a8ad7d8f1c86f3ed89abd4fb3ec69c9ece5 Mon Sep 17 00:00:00 2001 From: Tomas Dabasinskas Date: Tue, 12 Jun 2018 09:27:28 +0300 Subject: [PATCH] Inroduce --update-dependencies flag --- main.go | 60 ++++++++++++++++++++++++++++++------------------------- plugin.go | 57 ++++++++++++++++++++++++++-------------------------- 2 files changed, 62 insertions(+), 55 deletions(-) diff --git a/main.go b/main.go index a3e5e1e..aeda145 100644 --- a/main.go +++ b/main.go @@ -134,6 +134,11 @@ func main() { Usage: "purge on delete", EnvVar: "PLUGIN_PURGE,PURGE", }, + cli.BoolFlag{ + Name: "update-dependencies", + Usage: "update dependency charts based on the contents of requirements.yaml file of the local chart", + EnvVar: "PLUGIN_UPDATE_DEPENDENCIES,UPDATE_DEPENDENCIES", + }, } if err := app.Run(os.Args); err != nil { logrus.Fatal(err) @@ -146,33 +151,34 @@ func run(c *cli.Context) error { } plugin := Plugin{ Config: Config{ - APIServer: c.String("api_server"), - Token: c.String("token"), - Certificate: c.String("certificate"), - ServiceAccount: c.String("service-account"), - KubeConfig: c.String("kube-config"), - HelmCommand: c.String("helm_command"), - Namespace: c.String("namespace"), - SkipTLSVerify: c.Bool("skip_tls_verify"), - Values: c.String("values"), - ValuesFiles: c.String("values_files"), - Release: c.String("release"), - HelmRepos: c.StringSlice("helm_repos"), - Chart: c.String("chart"), - Version: c.String("chart-version"), - Debug: c.Bool("debug"), - DryRun: c.Bool("dry-run"), - Secrets: c.StringSlice("secrets"), - Prefix: c.String("prefix"), - TillerNs: c.String("tiller-ns"), - Wait: c.Bool("wait"), - RecreatePods: c.Bool("recreate-pods"), - ClientOnly: c.Bool("client-only"), - CanaryImage: c.Bool("canary-image"), - Upgrade: c.Bool("upgrade"), - ReuseValues: c.Bool("reuse-values"), - Timeout: c.String("timeout"), - Force: c.Bool("force"), + APIServer: c.String("api_server"), + Token: c.String("token"), + Certificate: c.String("certificate"), + ServiceAccount: c.String("service-account"), + KubeConfig: c.String("kube-config"), + HelmCommand: c.String("helm_command"), + Namespace: c.String("namespace"), + SkipTLSVerify: c.Bool("skip_tls_verify"), + Values: c.String("values"), + ValuesFiles: c.String("values_files"), + Release: c.String("release"), + HelmRepos: c.StringSlice("helm_repos"), + Chart: c.String("chart"), + Version: c.String("chart-version"), + Debug: c.Bool("debug"), + DryRun: c.Bool("dry-run"), + Secrets: c.StringSlice("secrets"), + Prefix: c.String("prefix"), + TillerNs: c.String("tiller-ns"), + Wait: c.Bool("wait"), + RecreatePods: c.Bool("recreate-pods"), + ClientOnly: c.Bool("client-only"), + CanaryImage: c.Bool("canary-image"), + Upgrade: c.Bool("upgrade"), + ReuseValues: c.Bool("reuse-values"), + Timeout: c.String("timeout"), + Force: c.Bool("force"), + UpdateDependencies: c.Bool("update-dependencies"), }, } return plugin.Exec() diff --git a/plugin.go b/plugin.go index 14ef1c0..7324b4c 100644 --- a/plugin.go +++ b/plugin.go @@ -19,34 +19,35 @@ var KUBECONFIG = "/root/.kube/kubeconfig" type ( // Config maps the params we need to run Helm Config struct { - APIServer string `json:"api_server"` - Token string `json:"token"` - Certificate string `json:"certificate"` - ServiceAccount string `json:"service_account"` - KubeConfig string `json:"kube_config"` - HelmCommand string `json:"helm_command"` - SkipTLSVerify bool `json:"tls_skip_verify"` - Namespace string `json:"namespace"` - Release string `json:"release"` - Chart string `json:"chart"` - Version string `json:"version"` - Values string `json:"values"` - ValuesFiles string `json:"values_files"` - Debug bool `json:"debug"` - DryRun bool `json:"dry_run"` - Secrets []string `json:"secrets"` - Prefix string `json:"prefix"` - TillerNs string `json:"tiller_ns"` - Wait bool `json:"wait"` - RecreatePods bool `json:"recreate_pods"` - Upgrade bool `json:"upgrade"` - CanaryImage bool `json:"canary_image"` - ClientOnly bool `json:"client_only"` - ReuseValues bool `json:"reuse_values"` - Timeout string `json:"timeout"` - Force bool `json:"force"` - HelmRepos []string `json:"helm_repos"` - Purge bool `json:"purge"` + APIServer string `json:"api_server"` + Token string `json:"token"` + Certificate string `json:"certificate"` + ServiceAccount string `json:"service_account"` + KubeConfig string `json:"kube_config"` + HelmCommand string `json:"helm_command"` + SkipTLSVerify bool `json:"tls_skip_verify"` + Namespace string `json:"namespace"` + Release string `json:"release"` + Chart string `json:"chart"` + Version string `json:"version"` + Values string `json:"values"` + ValuesFiles string `json:"values_files"` + Debug bool `json:"debug"` + DryRun bool `json:"dry_run"` + Secrets []string `json:"secrets"` + Prefix string `json:"prefix"` + TillerNs string `json:"tiller_ns"` + Wait bool `json:"wait"` + RecreatePods bool `json:"recreate_pods"` + Upgrade bool `json:"upgrade"` + CanaryImage bool `json:"canary_image"` + ClientOnly bool `json:"client_only"` + ReuseValues bool `json:"reuse_values"` + Timeout string `json:"timeout"` + Force bool `json:"force"` + HelmRepos []string `json:"helm_repos"` + Purge bool `json:"purge"` + UpdateDependencies bool `json:"update_dependencies"` } // Plugin default Plugin struct {