diff --git a/utils/kubernetes/apply-helm-chart.go b/utils/kubernetes/apply-helm-chart.go index 9d8dac48..95688949 100644 --- a/utils/kubernetes/apply-helm-chart.go +++ b/utils/kubernetes/apply-helm-chart.go @@ -404,15 +404,19 @@ func checkIfInstallable(ch *chart.Chart) error { func createHelmActionConfig(c *Client, cfg ApplyHelmChartConfig) (*action.Configuration, error) { // Set the environment variable needed by the Init methods os.Setenv("HELM_DRIVER_SQL_CONNECTION_STRING", cfg.SQLConnectionString) - os.Setenv("HELM_KUBEAPISERVER", c.RestConfig.Host) + // KubeConfig setup cafile, err := setDataAndReturnFileHandler(c.RestConfig.CAData) if err != nil { return nil, err } cafilename := cafile.Name() - os.Setenv("HELM_KUBECAFILE", cafilename) + kubeConfig := genericclioptions.NewConfigFlags(false) + kubeConfig.APIServer = &c.RestConfig.Host + kubeConfig.CAFile = &cafilename + kubeConfig.BearerToken = &c.RestConfig.BearerToken + actionConfig := new(action.Configuration) if err := actionConfig.Init(kubeConfig, cfg.Namespace, string(cfg.HelmDriver), cfg.Logger); err != nil { return nil, ErrApplyHelmChart(err)