mirror of
https://github.com/kubesphere/kubekey.git
synced 2025-12-26 01:22:51 +00:00
update lb precheck
Signed-off-by: “Forest-L <lilin@yunify.com>
This commit is contained in:
parent
e6aee4ca1c
commit
7197ac5258
|
|
@ -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, ":") {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue