mirror of https://github.com/kubernetes/kops.git
A few real-world fixes to create-cluster around initialization
This commit is contained in:
parent
91b77ae11e
commit
aeef9dc6eb
|
@ -82,6 +82,7 @@ func (o *CreateClusterOptions) InitDefaults() {
|
|||
|
||||
func NewCmdCreateCluster(f *util.Factory, out io.Writer) *cobra.Command {
|
||||
options := &CreateClusterOptions{}
|
||||
options.InitDefaults()
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "cluster",
|
||||
|
@ -454,25 +455,25 @@ func RunCreateCluster(f *util.Factory, out io.Writer, c *CreateClusterOptions) e
|
|||
cluster.Spec.Subnets[i].Type = api.SubnetTypePrivate
|
||||
}
|
||||
|
||||
var utilitySubnets []api.ClusterSubnetSpec
|
||||
for _, s := range cluster.Spec.Subnets {
|
||||
if s.Type == api.SubnetTypeUtility {
|
||||
continue
|
||||
}
|
||||
subnet := api.ClusterSubnetSpec{
|
||||
SubnetName: "utility-" + s.SubnetName,
|
||||
Zone: s.Zone,
|
||||
Type: api.SubnetTypeUtility,
|
||||
}
|
||||
utilitySubnets = append(utilitySubnets, subnet)
|
||||
}
|
||||
cluster.Spec.Subnets = append(cluster.Spec.Subnets, utilitySubnets...)
|
||||
|
||||
if c.Bastion {
|
||||
bastionGroup := &api.InstanceGroup{}
|
||||
bastionGroup.Spec.Role = api.InstanceGroupRoleBastion
|
||||
bastionGroup.ObjectMeta.Name = "bastions"
|
||||
instanceGroups = append(instanceGroups, bastionGroup)
|
||||
|
||||
var bastionSubnets []api.ClusterSubnetSpec
|
||||
for _, s := range cluster.Spec.Subnets {
|
||||
if s.Type == api.SubnetTypeUtility {
|
||||
continue
|
||||
}
|
||||
subnet := api.ClusterSubnetSpec{
|
||||
SubnetName: "utility-" + s.SubnetName,
|
||||
Zone: s.Zone,
|
||||
Type: api.SubnetTypeUtility,
|
||||
}
|
||||
bastionSubnets = append(bastionSubnets, subnet)
|
||||
}
|
||||
cluster.Spec.Subnets = append(cluster.Spec.Subnets, bastionSubnets...)
|
||||
}
|
||||
|
||||
default:
|
||||
|
|
|
@ -62,6 +62,7 @@ func LoadChannel(location string) (*Channel, error) {
|
|||
if err != nil {
|
||||
return nil, fmt.Errorf("invalid base channel location: %q", DefaultChannelBase)
|
||||
}
|
||||
glog.V(4).Infof("resolving %q against default channel location %q", location, DefaultChannelBase)
|
||||
u = base.ResolveReference(u)
|
||||
}
|
||||
|
||||
|
|
|
@ -330,10 +330,11 @@ func (c *Cluster) Validate(strict bool) error {
|
|||
}
|
||||
|
||||
if c.Spec.Topology.Bastion != nil {
|
||||
bastion := c.Spec.Topology.Bastion
|
||||
if c.Spec.Topology.Masters == TopologyPublic || c.Spec.Topology.Nodes == TopologyPublic {
|
||||
return fmt.Errorf("Bastion supports only Private Masters and Nodes")
|
||||
}
|
||||
if fi.Int64Value(c.Spec.Topology.Bastion.IdleTimeout) <= int64(0) {
|
||||
if bastion.IdleTimeout != nil && *bastion.IdleTimeout <= 0 {
|
||||
return fmt.Errorf("Bastion IdleTimeout should be greater than zero")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue