@@ -25,6 +25,7 @@ import (
25
25
"github.com/argoproj/argo-workflows/v3/workflow/common"
26
26
pubsub "github.com/devtron-labs/common-lib/pubsub-lib"
27
27
k8s1 "github.com/devtron-labs/common-lib/utils/k8s"
28
+ "github.com/devtron-labs/common-lib/utils/k8s/commonBean"
28
29
repository "github.com/devtron-labs/kubewatch/pkg/cluster"
29
30
"github.com/devtron-labs/kubewatch/pkg/middleware"
30
31
"github.com/devtron-labs/kubewatch/pkg/utils"
@@ -439,10 +440,16 @@ func (impl *K8sInformerImpl) getK8sClientForCluster(clusterInfo *repository.Clus
439
440
} else {
440
441
restConfig = & rest.Config {
441
442
Host : clusterInfo .ServerUrl ,
442
- BearerToken : clusterInfo .Config ["bearer_token" ],
443
- TLSClientConfig : rest.TLSClientConfig {Insecure : true },
443
+ BearerToken : clusterInfo .Config [commonBean .BearerToken ],
444
+ TLSClientConfig : rest.TLSClientConfig {Insecure : clusterInfo .InsecureSkipTlsVerify },
445
+ }
446
+ if ! restConfig .TLSClientConfig .Insecure {
447
+ restConfig .TLSClientConfig .KeyData = []byte (clusterInfo .Config [commonBean .TlsKey ])
448
+ restConfig .TLSClientConfig .CertData = []byte (clusterInfo .Config [commonBean .CertData ])
449
+ restConfig .TLSClientConfig .CAData = []byte (clusterInfo .Config [commonBean .CertificateAuthorityData ])
444
450
}
445
451
}
452
+
446
453
return impl .getK8sClientForConfig (restConfig )
447
454
}
448
455
0 commit comments