@@ -73,6 +73,8 @@ const (
73
73
var (
74
74
// Master nodes are not added to standard load balancer by default.
75
75
defaultExcludeMasterFromStandardLB = true
76
+ // Outbound SNAT is enabled by default.
77
+ defaultDisableOutboundSNAT = false
76
78
)
77
79
78
80
// Config holds the configuration parsed from the --cloud-config flag
@@ -145,6 +147,9 @@ type Config struct {
145
147
// ExcludeMasterFromStandardLB excludes master nodes from standard load balancer.
146
148
// If not set, it will be default to true.
147
149
ExcludeMasterFromStandardLB * bool `json:"excludeMasterFromStandardLB" yaml:"excludeMasterFromStandardLB"`
150
+ // DisableOutboundSNAT disables the outbound SNAT for public load balancer rules.
151
+ // It should only be set when loadBalancerSku is standard. If not set, it will be default to false.
152
+ DisableOutboundSNAT * bool `json:"disableOutboundSNAT" yaml:"disableOutboundSNAT"`
148
153
149
154
// Maximum allowed LoadBalancer Rule Count is the limit enforced by Azure Load balancer
150
155
MaximumLoadBalancerRuleCount int `json:"maximumLoadBalancerRuleCount" yaml:"maximumLoadBalancerRuleCount"`
@@ -321,9 +326,20 @@ func NewCloud(configReader io.Reader) (cloudprovider.Interface, error) {
321
326
config .CloudProviderBackoffDuration = backoffDurationDefault
322
327
}
323
328
324
- // Do not add master nodes to standard LB by default.
325
- if config .ExcludeMasterFromStandardLB == nil {
326
- config .ExcludeMasterFromStandardLB = & defaultExcludeMasterFromStandardLB
329
+ if strings .EqualFold (config .LoadBalancerSku , loadBalancerSkuStandard ) {
330
+ // Do not add master nodes to standard LB by default.
331
+ if config .ExcludeMasterFromStandardLB == nil {
332
+ config .ExcludeMasterFromStandardLB = & defaultExcludeMasterFromStandardLB
333
+ }
334
+
335
+ // Enable outbound SNAT by default.
336
+ if config .DisableOutboundSNAT == nil {
337
+ config .DisableOutboundSNAT = & defaultDisableOutboundSNAT
338
+ }
339
+ } else {
340
+ if config .DisableOutboundSNAT != nil && * config .DisableOutboundSNAT {
341
+ return nil , fmt .Errorf ("disableOutboundSNAT should only set when loadBalancerSku is standard" )
342
+ }
327
343
}
328
344
329
345
azClientConfig := & azClientConfig {
0 commit comments