mirror of https://github.com/kubernetes/kops.git
Only do HA if master-count or master-zones is specified
We don't want to "accidentally" enable HA. When users specify multiple zones, but don't specify a master-count or master-zones, we interpret that as master-count=1
This commit is contained in:
parent
3417b6a9d0
commit
4487639eff
|
@ -423,6 +423,7 @@ func RunCreateCluster(f *util.Factory, out io.Writer, c *CreateClusterOptions) e
|
|||
// We then round-robin around the zones
|
||||
if len(masters) == 0 {
|
||||
var masterSubnets []*api.ClusterSubnetSpec
|
||||
masterCount := c.MasterCount
|
||||
if len(c.MasterZones) != 0 {
|
||||
for _, subnetName := range c.MasterZones {
|
||||
subnet := findSubnet(cluster, subnetName)
|
||||
|
@ -436,10 +437,20 @@ func RunCreateCluster(f *util.Factory, out io.Writer, c *CreateClusterOptions) e
|
|||
if c.MasterCount != 0 && c.MasterCount < int32(len(masterSubnets)) {
|
||||
return fmt.Errorf("specified %d master zones, but also requested %d masters. If specifying both, the count should match.", len(masterSubnets), c.MasterCount)
|
||||
}
|
||||
|
||||
if masterCount == 0 {
|
||||
// If master count is not specified, default to the number of master zones
|
||||
masterCount = int32(len(c.MasterZones))
|
||||
}
|
||||
} else {
|
||||
for i := range cluster.Spec.Subnets {
|
||||
masterSubnets = append(masterSubnets, &cluster.Spec.Subnets[i])
|
||||
}
|
||||
|
||||
if masterCount == 0 {
|
||||
// If master count is not specified, default to 1
|
||||
masterCount = 1
|
||||
}
|
||||
}
|
||||
|
||||
if len(masterSubnets) == 0 {
|
||||
|
@ -447,11 +458,6 @@ func RunCreateCluster(f *util.Factory, out io.Writer, c *CreateClusterOptions) e
|
|||
return fmt.Errorf("cannot determine master subnets")
|
||||
}
|
||||
|
||||
masterCount := c.MasterCount
|
||||
if masterCount == 0 {
|
||||
masterCount = int32(len(masterSubnets))
|
||||
}
|
||||
|
||||
for i := 0; i < int(masterCount); i++ {
|
||||
subnet := masterSubnets[i%len(masterSubnets)]
|
||||
name := subnet.Name
|
||||
|
|
Loading…
Reference in New Issue