Support creating dualstack internal NLBs

This commit is contained in:
John Gardiner Myers 2021-12-19 21:45:41 -08:00
parent 97c2377d88
commit 3314c18e89
2 changed files with 6 additions and 3 deletions

View File

@ -183,9 +183,7 @@ func (b *APILoadBalancerBuilder) Build(c *fi.ModelBuilderContext) error {
Type: fi.String("network"),
IpAddressType: fi.String("ipv4"),
}
// DualStack can only be used for public NLB
// https://aws.amazon.com/premiumsupport/knowledge-center/elb-configure-with-ipv6
if b.UseIPv6ForAPI() && lbSpec.Type == kops.LoadBalancerTypePublic {
if b.UseIPv6ForAPI() {
nlb.IpAddressType = fi.String("dualstack")
}

View File

@ -402,6 +402,11 @@ func (e *NetworkLoadBalancer) Find(c *fi.Context) (*NetworkLoadBalancer, error)
e.LoadBalancerName = actual.LoadBalancerName
}
// An existing internal NLB can't be updated to dualstack.
if fi.StringValue(actual.Scheme) == elbv2.LoadBalancerSchemeEnumInternal && fi.StringValue(actual.IpAddressType) == elbv2.IpAddressTypeIpv4 {
e.IpAddressType = actual.IpAddressType
}
// We allow for the LoadBalancerName to be wrong:
// 1. We don't want to force a rename of the NLB, because that is a destructive operation
if fi.StringValue(e.LoadBalancerName) != fi.StringValue(actual.LoadBalancerName) {