mirror of https://github.com/kubernetes/kops.git
Reduce use of cluster topology field
This commit is contained in:
parent
fc527b6e9f
commit
1be8be233f
|
|
@ -217,9 +217,14 @@ func (b *NetworkModelBuilder) Build(c *fi.CloudupModelBuilderContext) error {
|
|||
infoByZone := make(map[string]*zoneInfo)
|
||||
|
||||
haveDualStack := map[string]bool{}
|
||||
haveAnyPrivate := false
|
||||
for _, subnetSpec := range b.Cluster.Spec.Networking.Subnets {
|
||||
if subnetSpec.Type == kops.SubnetTypeDualStack {
|
||||
switch subnetSpec.Type {
|
||||
case kops.SubnetTypeDualStack:
|
||||
haveDualStack[subnetSpec.Zone] = true
|
||||
haveAnyPrivate = true
|
||||
case kops.SubnetTypePrivate:
|
||||
haveAnyPrivate = true
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -240,8 +245,8 @@ func (b *NetworkModelBuilder) Build(c *fi.CloudupModelBuilderContext) error {
|
|||
tags[aws.TagNameSubnetPublicELB] = "1"
|
||||
|
||||
// AWS ALB contoller won't provision any internal ELBs unless this tag is set.
|
||||
// So we add this to public subnets as well if we do not expect any private subnets.
|
||||
if b.Cluster.Spec.Networking.Topology.Nodes == kops.TopologyPublic {
|
||||
// So we add this to public subnets as well if we do not have any private subnets.
|
||||
if !haveAnyPrivate {
|
||||
tags[aws.TagNameSubnetInternalELB] = "1"
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ func (b *AutoscalingGroupModelBuilder) buildInstanceTemplate(c *fi.CloudupModelB
|
|||
Preemptible: fi.PtrTo(fi.ValueOf(ig.Spec.GCPProvisioningModel) == "SPOT"),
|
||||
GCPProvisioningModel: ig.Spec.GCPProvisioningModel,
|
||||
|
||||
HasExternalIP: fi.PtrTo(b.Cluster.Spec.Networking.Topology.ControlPlane == kops.TopologyPublic),
|
||||
HasExternalIP: fi.PtrTo(subnet.Type == kops.SubnetTypePublic || subnet.Type == kops.SubnetTypeUtility),
|
||||
|
||||
Scopes: []string{
|
||||
"compute-rw",
|
||||
|
|
|
|||
|
|
@ -1163,7 +1163,6 @@ resource "aws_subnet" "us-east-1a-utility-complex-example-com" {
|
|||
"foo/bar" = "fib+baz"
|
||||
"kubernetes.io/cluster/complex.example.com" = "owned"
|
||||
"kubernetes.io/role/elb" = "1"
|
||||
"kubernetes.io/role/internal-elb" = "1"
|
||||
}
|
||||
vpc_id = aws_vpc.complex-example-com.id
|
||||
}
|
||||
|
|
@ -1183,7 +1182,6 @@ resource "aws_subnet" "us-test-1a-complex-example-com" {
|
|||
"kops.k8s.io/instance-group/nodes" = "true"
|
||||
"kubernetes.io/cluster/complex.example.com" = "owned"
|
||||
"kubernetes.io/role/elb" = "1"
|
||||
"kubernetes.io/role/internal-elb" = "1"
|
||||
}
|
||||
vpc_id = aws_vpc.complex-example-com.id
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue