@@ -47,6 +47,7 @@ type LBSpec struct {
47
47
APIServerPort int32
48
48
IdleTimeoutInMinutes * int32
49
49
AdditionalTags map [string ]string
50
+ AdditionalPorts []infrav1.LoadBalancerPort
50
51
}
51
52
52
53
// ResourceName returns the name of the load balancer.
@@ -221,14 +222,14 @@ func getLoadBalancingRules(lbSpec LBSpec, frontendIDs []*armnetwork.SubResource)
221
222
if len (frontendIDs ) != 0 {
222
223
frontendIPConfig = frontendIDs [0 ]
223
224
}
224
- return []* armnetwork.LoadBalancingRule {
225
+ rules := []* armnetwork.LoadBalancingRule {
225
226
{
226
227
Name : ptr .To (lbRuleHTTPS ),
227
228
Properties : & armnetwork.LoadBalancingRulePropertiesFormat {
228
229
DisableOutboundSnat : ptr .To (true ),
229
230
Protocol : ptr .To (armnetwork .TransportProtocolTCP ),
230
- FrontendPort : ptr.To [ int32 ] (lbSpec .APIServerPort ),
231
- BackendPort : ptr.To [ int32 ] (lbSpec .APIServerPort ),
231
+ FrontendPort : ptr .To (lbSpec .APIServerPort ),
232
+ BackendPort : ptr .To (lbSpec .APIServerPort ),
232
233
IdleTimeoutInMinutes : lbSpec .IdleTimeoutInMinutes ,
233
234
EnableFloatingIP : ptr .To (false ),
234
235
LoadDistribution : ptr .To (armnetwork .LoadDistributionDefault ),
@@ -242,6 +243,30 @@ func getLoadBalancingRules(lbSpec LBSpec, frontendIDs []*armnetwork.SubResource)
242
243
},
243
244
},
244
245
}
246
+
247
+ for _ , port := range lbSpec .AdditionalPorts {
248
+ rules = append (rules , & armnetwork.LoadBalancingRule {
249
+ Name : ptr .To (port .Name ),
250
+ Properties : & armnetwork.LoadBalancingRulePropertiesFormat {
251
+ DisableOutboundSnat : ptr .To (true ),
252
+ Protocol : ptr .To (armnetwork .TransportProtocolTCP ),
253
+ FrontendPort : ptr .To (port .Port ),
254
+ BackendPort : ptr .To (port .Port ),
255
+ IdleTimeoutInMinutes : lbSpec .IdleTimeoutInMinutes ,
256
+ EnableFloatingIP : ptr .To (false ),
257
+ LoadDistribution : ptr .To (armnetwork .LoadDistributionDefault ),
258
+ FrontendIPConfiguration : frontendIPConfig ,
259
+ BackendAddressPool : & armnetwork.SubResource {
260
+ ID : ptr .To (azure .AddressPoolID (lbSpec .SubscriptionID , lbSpec .ResourceGroup , lbSpec .Name , lbSpec .BackendPoolName )),
261
+ },
262
+ Probe : & armnetwork.SubResource {
263
+ ID : ptr .To (azure .ProbeID (lbSpec .SubscriptionID , lbSpec .ResourceGroup , lbSpec .Name , httpsProbe )),
264
+ },
265
+ },
266
+ })
267
+ }
268
+
269
+ return rules
245
270
}
246
271
return []* armnetwork.LoadBalancingRule {}
247
272
}
0 commit comments