update lb precheck

Signed-off-by: “Forest-L <lilin@yunify.com>
This commit is contained in:
“Forest-L 2020-09-25 16:45:59 +08:00
parent e6aee4ca1c
commit 7197ac5258
3 changed files with 6 additions and 7 deletions

View File

@ -20,6 +20,7 @@ import (
"fmt"
"github.com/kubesphere/kubekey/pkg/util"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"os"
"regexp"
"strconv"
"strings"
@ -229,6 +230,11 @@ func (cfg *ClusterSpec) ParseRolesList() ([]string, []string, []string) {
masterGroupList = append(masterGroupList, host)
}
}
//The detection is not an HA environment, and the address at LB does not need input
if len(masterGroupList) == 1 && cfg.ControlPlaneEndpoint.Address != "" {
fmt.Println("When the environment is not HA, the LB address does not need to be entered, so delete the corresponding value.")
os.Exit(0)
}
for _, host := range cfg.RoleGroups.Worker {
if strings.Contains(host, "[") && strings.Contains(host, "]") && strings.Contains(host, ":") {

View File

@ -120,7 +120,6 @@ func SetDefaultHostsCfg(cfg *ClusterSpec) []HostCfg {
}
func SetDefaultLBCfg(cfg *ClusterSpec, masterGroup []HostCfg) ControlPlaneEndpoint {
if cfg.ControlPlaneEndpoint.Address == "" {
cfg.ControlPlaneEndpoint.Address = masterGroup[0].InternalAddress
}

View File

@ -56,7 +56,6 @@ func CreateCluster(clusterCfgFile, k8sVersion, ksVersion string, logger *log.Log
}
}
return Execute(executor.NewExecutor(&cfg.Spec, logger, "", verbose, skipCheck, skipPullImages, false))
}
func ExecTasks(mgr *manager.Manager) error {
@ -107,10 +106,5 @@ func Execute(executor *executor.Executor) error {
if err != nil {
return err
}
//The detection is not an HA environment, and the address at LB does not need input
if len(mgr.MasterNodes) == 1 && mgr.Cluster.ControlPlaneEndpoint.Address != "" {
fmt.Println("When the environment is not HA, the LB address does not need to be entered, so delete the corresponding value.")
os.Exit(0)
}
return ExecTasks(mgr)
}