mirror of
https://github.com/rancher/rke.git
synced 2025-09-01 06:56:29 +00:00
Ignore inactive hosts
This commit is contained in:
@@ -9,12 +9,8 @@ import (
|
||||
|
||||
func (c *Cluster) ValidateCluster() error {
|
||||
// make sure cluster has at least one controlplane/etcd host
|
||||
|
||||
if len(c.EtcdHosts) == 0 && len(c.Services.Etcd.ExternalURLs) == 0 {
|
||||
return fmt.Errorf("Cluster must have at least one etcd plane host")
|
||||
}
|
||||
if len(c.EtcdHosts) > 0 && len(c.Services.Etcd.ExternalURLs) > 0 {
|
||||
return fmt.Errorf("Cluster can't have both internal and external etcd")
|
||||
if err := ValidateHostCount(c); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// validate hosts options
|
||||
@@ -120,3 +116,13 @@ func validateIngressOptions(c *Cluster) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func ValidateHostCount(c *Cluster) error {
|
||||
if len(c.EtcdHosts) == 0 && len(c.Services.Etcd.ExternalURLs) == 0 {
|
||||
return fmt.Errorf("Cluster must have at least one etcd plane host")
|
||||
}
|
||||
if len(c.EtcdHosts) > 0 && len(c.Services.Etcd.ExternalURLs) > 0 {
|
||||
return fmt.Errorf("Cluster can't have both internal and external etcd")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user