Skip to content

Commit 24a7a53

Browse files
e-karchI763619
andauthored
Use currentContext from kubeconfig if user did not set context flag (#1047)
Co-authored-by: I763619 <emil.karch@sap.com>
1 parent 91a276b commit 24a7a53

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/cmd/kubernikusctl/common/kubecontext.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ func NewKubernikusContext(kubeconfig, context string) (*KubernikusContext, error
2121
pathOptions.LoadingRules.ExplicitPath = kubeconfig
2222

2323
config, err := pathOptions.GetStartingConfig()
24+
25+
if context == "" { // The user did not set the --context flag
26+
context = config.CurrentContext
27+
}
28+
2429
if err != nil {
2530
return nil, err
2631
}

0 commit comments

Comments
 (0)