kiali add kubeconfig check
Signed-off-by: zackzhangkai <zackzhang@yunify.com>
This commit is contained in:
@@ -120,14 +120,16 @@ func initializeServicemeshConfig(s *options.ServerRunOptions) {
|
||||
kconfig.Set(config)
|
||||
|
||||
// Set kiali config
|
||||
kubeconfig, err := clientcmd.BuildConfigFromFlags("", s.KubernetesOptions.KubeConfig)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
if len(s.KubernetesOptions.KubeConfig) != 0 {
|
||||
kubeconfig, err := clientcmd.BuildConfigFromFlags("", s.KubernetesOptions.KubeConfig)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
k8sClient, err := kubernetes.NewClientFromConfig(kubeconfig)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
prometheusClient, _ := prometheus.NewClient()
|
||||
business.SetWithBackends(k8sClient, prometheusClient)
|
||||
}
|
||||
k8sClient, err := kubernetes.NewClientFromConfig(kubeconfig)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
prometheusClient, _ := prometheus.NewClient()
|
||||
business.SetWithBackends(k8sClient, prometheusClient)
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ func (c *Controller) reconcile(key string) error {
|
||||
|
||||
func (c *Controller) deleteGroupBindings(group *iam1alpha2.Group) error {
|
||||
|
||||
// Groupbindings that created by kubeshpere will be deleted directly.
|
||||
// Groupbindings that created by kubesphere will be deleted directly.
|
||||
listOptions := metav1.ListOptions{
|
||||
LabelSelector: labels.SelectorFromSet(labels.Set{iam1alpha2.GroupReferenceLabel: group.Name}).String(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user