use kube-apiserver proxy if no kubesphere api endpoint provided (#2144)

This commit is contained in:
zryfish
2020-06-01 19:54:05 +08:00
committed by GitHub
parent 345ce1ac0f
commit 59900f6e1c
5 changed files with 163 additions and 20 deletions

View File

@@ -388,6 +388,11 @@ func (c *ClusterController) syncCluster(key string) error {
// is safe.
if isConditionTrue(cluster, clusterv1alpha1.ClusterAgentAvailable) ||
cluster.Spec.Connection.Type == clusterv1alpha1.ConnectionTypeDirect {
if len(cluster.Spec.Connection.KubernetesAPIEndpoint) == 0 {
cluster.Spec.Connection.KubernetesAPIEndpoint = clusterConfig.Host
}
version, err := clientSet.Discovery().ServerVersion()
if err != nil {
klog.Errorf("Failed to get kubernetes version, %#v", err)