@@ -479,48 +479,49 @@ func createHelmActionConfig(c *Client, cfg ApplyHelmChartConfig) (*action.Config
479479 tempFiles = append (tempFiles , keyFileName )
480480 kubeConfig .KeyFile = & keyFileName
481481 }
482- }
482+ } else {
483483
484- const (
485- clusterName = "meshery-cluster"
486- authInfo = "meshkit-helm-user"
487- )
484+ const (
485+ clusterName = "meshery-cluster"
486+ authInfo = "meshkit-helm-user"
487+ )
488488
489- helmKubeConfig := clientcmdapi .NewConfig ()
489+ helmKubeConfig := clientcmdapi .NewConfig ()
490490
491- helmKubeConfig .Clusters [clusterName ] = & clientcmdapi.Cluster {
492- Server : c .RestConfig .Host ,
493- TLSServerName : c .RestConfig .ServerName ,
494- InsecureSkipTLSVerify : c .RestConfig .Insecure ,
495- CertificateAuthority : c .RestConfig .CAFile ,
496- CertificateAuthorityData : c .RestConfig .CAData ,
497- }
491+ helmKubeConfig .Clusters [clusterName ] = & clientcmdapi.Cluster {
492+ Server : c .RestConfig .Host ,
493+ TLSServerName : c .RestConfig .ServerName ,
494+ InsecureSkipTLSVerify : c .RestConfig .Insecure ,
495+ CertificateAuthority : c .RestConfig .CAFile ,
496+ CertificateAuthorityData : c .RestConfig .CAData ,
497+ }
498498
499- helmKubeConfig .AuthInfos [clusterName ] = & clientcmdapi.AuthInfo {
500- Exec : c .RestConfig .ExecProvider ,
501- AuthProvider : c .RestConfig .AuthProvider ,
502- }
499+ helmKubeConfig .AuthInfos [authInfo ] = & clientcmdapi.AuthInfo {
500+ Exec : c .RestConfig .ExecProvider ,
501+ AuthProvider : c .RestConfig .AuthProvider ,
502+ }
503503
504- helmKubeConfig .Contexts [clusterName ] = & clientcmdapi.Context {
505- Cluster : clusterName ,
506- AuthInfo : authInfo ,
507- }
504+ helmKubeConfig .Contexts [clusterName ] = & clientcmdapi.Context {
505+ Cluster : clusterName ,
506+ AuthInfo : authInfo ,
507+ }
508508
509- // explicitly setting kube context may not be required
510- helmKubeConfig .CurrentContext = clusterName
509+ // explicitly setting kube context may not be required
510+ helmKubeConfig .CurrentContext = clusterName
511511
512- configBytes , err := clientcmd .Write (* helmKubeConfig )
513- if err != nil {
514- return nil , nil , fmt .Errorf ("failed to write kubeconfig %v" , err )
515- }
512+ configBytes , err := clientcmd .Write (* helmKubeConfig )
513+ if err != nil {
514+ return nil , nil , fmt .Errorf ("failed to write kubeconfig %v" , err )
515+ }
516516
517- configFile , err := setDataAndReturnFilename (configBytes )
518- if err != nil {
519- return nil , nil , fmt .Errorf ("failed to get kubeconfig file %v" , err )
520- }
521- tempFiles = append (tempFiles , configFile )
517+ configFile , err := setDataAndReturnFilename (configBytes )
518+ if err != nil {
519+ return nil , nil , fmt .Errorf ("failed to get kubeconfig file %v" , err )
520+ }
521+ tempFiles = append (tempFiles , configFile )
522522
523- kubeConfig .KubeConfig = & configFile
523+ kubeConfig .KubeConfig = & configFile
524+ }
524525
525526 actionConfig := new (action.Configuration )
526527 if err := actionConfig .Init (kubeConfig , cfg .Namespace , string (cfg .HelmDriver ), cfg .Logger ); err != nil {
0 commit comments