@@ -3,6 +3,7 @@ package elbv2
3
3
import (
4
4
"context"
5
5
"fmt"
6
+
6
7
awssdk "github.com/aws/aws-sdk-go-v2/aws"
7
8
elbv2sdk "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2"
8
9
elbv2types "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2/types"
@@ -179,14 +180,15 @@ func (m *defaultLoadBalancerManager) updateSDKLoadBalancerWithSubnetMappings(ctx
179
180
180
181
resLBEnablePrefixForIpv6SourceNatValue = string (resLB .Spec .EnablePrefixForIpv6SourceNat )
181
182
182
- if desiredSubnets .Equal (currentSubnets ) && desiredSubnetsSourceNATPrefixes .Equal (currentSubnetsSourceNATPrefixes ) && sdkLBEnablePrefixForIpv6SourceNatValue == resLBEnablePrefixForIpv6SourceNatValue {
183
+ if desiredSubnets .Equal (currentSubnets ) && desiredSubnetsSourceNATPrefixes .Equal (currentSubnetsSourceNATPrefixes ) && (( sdkLBEnablePrefixForIpv6SourceNatValue == resLBEnablePrefixForIpv6SourceNatValue ) || ( resLBEnablePrefixForIpv6SourceNatValue == "" )) {
183
184
return nil
184
185
}
185
-
186
186
req := & elbv2sdk.SetSubnetsInput {
187
- LoadBalancerArn : sdkLB .LoadBalancer .LoadBalancerArn ,
188
- SubnetMappings : buildSDKSubnetMappings (resLB .Spec .SubnetMappings ),
189
- EnablePrefixForIpv6SourceNat : elbv2types .EnablePrefixForIpv6SourceNatEnum (resLBEnablePrefixForIpv6SourceNatValue ),
187
+ LoadBalancerArn : sdkLB .LoadBalancer .LoadBalancerArn ,
188
+ SubnetMappings : buildSDKSubnetMappings (resLB .Spec .SubnetMappings ),
189
+ }
190
+ if resLB .Spec .Type == elbv2model .LoadBalancerTypeNetwork {
191
+ req .EnablePrefixForIpv6SourceNat = elbv2types .EnablePrefixForIpv6SourceNatEnum (resLBEnablePrefixForIpv6SourceNatValue )
190
192
}
191
193
changeDesc := fmt .Sprintf ("%v => %v" , currentSubnets .List (), desiredSubnets .List ())
192
194
m .logger .Info ("modifying loadBalancer subnetMappings" ,
0 commit comments