1
0
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:
galal-hussein
2018-02-22 01:13:08 +02:00
parent ac1bf844ec
commit c02873b8e9
5 changed files with 60 additions and 25 deletions

View File

@@ -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
}