未验证 提交 54f518ff 编写于 作者: R runzexia

add master url scheme prefix

Signed-off-by: Nrunzexia <runzexia@yunify.com>
上级 593304a8
......@@ -7,6 +7,7 @@ import (
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
kubesphere "kubesphere.io/kubesphere/pkg/client/clientset/versioned"
"strings"
)
type KubernetesClient struct {
......@@ -48,7 +49,12 @@ func NewKubernetesClientOrDie(options *KubernetesOptions) *KubernetesClient {
if options.Master != "" {
k.master = options.Master
}
// The https prefix is automatically added when using sa.
// But it will not be set automatically when reading from kubeconfig
// which may cause some problems in the client of other languages.
if !strings.HasPrefix(k.master, "http://") && !strings.HasPrefix(k.master, "https://") {
k.master = "https://" + k.master
}
return k
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册