Skip to content

Commit 147f6fa

Browse files
authored
Merge pull request #536 from CecileRobertMichon/udp-rule
Add UDP and TCP standard load balancer rule
2 parents 441bad0 + 5d76898 commit 147f6fa

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

cloud/services/publicloadbalancers/publicloadbalancers.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,13 @@ func (s *Service) Reconcile(ctx context.Context, spec interface{}) error {
111111
},
112112
},
113113
},
114+
// We disable outbound SNAT explicitly in the HTTPS LB rule and enable TCP and UDP outbound NAT with an outbound rule.
115+
// For more information on Standard LB outbound connections see https://docs.microsoft.com/en-us/azure/load-balancer/load-balancer-outbound-connections.
114116
LoadBalancingRules: &[]network.LoadBalancingRule{
115117
{
116118
Name: to.StringPtr("LBRuleHTTPS"),
117119
LoadBalancingRulePropertiesFormat: &network.LoadBalancingRulePropertiesFormat{
120+
DisableOutboundSnat: to.BoolPtr(true),
118121
Protocol: network.TransportProtocolTCP,
119122
FrontendPort: to.Int32Ptr(s.Scope.APIServerPort()),
120123
BackendPort: to.Int32Ptr(s.Scope.APIServerPort()),
@@ -133,6 +136,23 @@ func (s *Service) Reconcile(ctx context.Context, spec interface{}) error {
133136
},
134137
},
135138
},
139+
OutboundRules: &[]network.OutboundRule{
140+
{
141+
Name: to.StringPtr("OutboundNATAllProtocols"),
142+
OutboundRulePropertiesFormat: &network.OutboundRulePropertiesFormat{
143+
Protocol: network.LoadBalancerOutboundRuleProtocolAll,
144+
IdleTimeoutInMinutes: to.Int32Ptr(4),
145+
FrontendIPConfigurations: &[]network.SubResource{
146+
{
147+
ID: to.StringPtr(fmt.Sprintf("/%s/%s/frontendIPConfigurations/%s", idPrefix, lbName, frontEndIPConfigName)),
148+
},
149+
},
150+
BackendAddressPool: &network.SubResource{
151+
ID: to.StringPtr(fmt.Sprintf("/%s/%s/backendAddressPools/%s", idPrefix, lbName, backEndAddressPoolName)),
152+
},
153+
},
154+
},
155+
},
136156
},
137157
})
138158

0 commit comments

Comments
 (0)