Skip to content

Commit

Permalink
Add support for internel node subnets (#840)
Browse files Browse the repository at this point in the history
Signed-off-by: Mikkel Oscar Lyderik Larsen <[email protected]>
  • Loading branch information
mikkeloscar authored Jan 13, 2025
1 parent b83f7f7 commit a97d1b6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions provisioner/clusterpy.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const (
tagNameKubernetesClusterPrefix = "kubernetes.io/cluster/"
subnetELBRoleTagName = "kubernetes.io/role/elb"
subnetNodeRoleTagName = "kubernetes.io/role/node"
subnetInternalNodeRoleTagName = "kubernetes.io/role/internal-node"
resourceLifecycleShared = "shared"
resourceLifecycleOwned = "owned"
mainStackTagKey = "cluster-lifecycle-controller.zalando.org/main-stack"
Expand Down Expand Up @@ -222,11 +223,13 @@ func (p *clusterpyProvisioner) provision(
// find the best subnet for each AZ
azInfoLBs := selectSubnetIDs(subnets, subnetELBRoleTagName)
azInfoNodes := selectSubnetIDs(subnets, subnetNodeRoleTagName)
azInfoIntenalNodes := selectSubnetIDs(subnets, subnetInternalNodeRoleTagName)

// if availability zones are defined, filter the subnet list
if azNames, ok := cluster.ConfigItems[availabilityZonesConfigItemKey]; ok {
azInfoLBs = azInfoLBs.RestrictAZs(strings.Split(azNames, ","))
azInfoNodes = azInfoNodes.RestrictAZs(strings.Split(azNames, ","))
azInfoIntenalNodes = azInfoIntenalNodes.RestrictAZs(strings.Split(azNames, ","))
}

// optional config item to hard-code subnets. This is useful for
Expand Down Expand Up @@ -266,6 +269,7 @@ func (p *clusterpyProvisioner) provision(
availabilityZonesValueKey: azInfoNodes.AvailabilityZones(),
subnetIPV6CIDRsKey: strings.Join(azInfoNodes.SubnetIPv6CIDRs(), ","),
"lb_subnets": azInfoLBs.SubnetsByAZ(),
"internal_node_subnets": azInfoIntenalNodes.SubnetsByAZ(),
"hosted_zone": hostedZone,
"load_balancer_certificate": loadBalancerCert.ID(),
"vpc_ipv4_cidr": aws.StringValue(vpc.CidrBlock),
Expand Down

0 comments on commit a97d1b6

Please sign in to comment.