New 🌊 wave for @helm

Commit 70edc31b

70edc31b6905Merged

Svyatoslav Dumchenko <[email protected]> · 4 years ago · 4 files · ~4 modified

Description

feat: allow to set kubecontext per release

Details

Commit
70edc31b6905
Parent
41aeef59a699

pkg/helper/helm.gomodifiedView file

@@ -44,14 +44,18 @@
4444 return client
4545 }
4646
47-// NewCfg creates helm internal configuration for provided namespace.
48-func NewCfg(ns string) (*action.Configuration, error) {
47+// NewCfg creates helm internal configuration for provided namespace and kubecontext.
48+func NewCfg(ns string, kubecontext string) (*action.Configuration, error) {
4949 cfg := new(action.Configuration)
5050 helmDriver := os.Getenv("HELM_DRIVER") // TODO: get rid of getenv in runtime
5151 config := genericclioptions.NewConfigFlags(false)
5252 config.WrapConfigFn = wrapConfigFn
5353 config.Namespace = &ns
54- config.Context = &Helm.KubeContext
54+ if kubecontext != "" {
55+ config.Context = &kubecontext
56+ } else {
57+ config.Context = &Helm.KubeContext
58+ }
5559
5660 if Helm.Debug {
5761 helmLogLevel = log.Infof