File tree Expand file tree Collapse file tree 1 file changed +16
-16
lines changed Expand file tree Collapse file tree 1 file changed +16
-16
lines changed Original file line number Diff line number Diff line change @@ -303,22 +303,22 @@ func GetNodePort(portAmount int32) int32 {
303303 for attempts = 0 ; attempts < 100 ; attempts ++ {
304304 port := minPort + rand .Int31n (int32 (portRange ))
305305
306- allAvailable := true
307- for i := int32 (0 ); i <= portAmount ; i ++ {
308- if nodePorts [port + i ] {
309- allAvailable = false
310- break
311- }
312- }
313-
314- if allAvailable {
315- for i := int32 (0 ); i <= portAmount ; i ++ {
316- nodePorts [port + i ] = true
317- }
318- fmt .Printf ("GetNodePort: Successfully allocated NodePort range %d-%d after %d attempts\n " ,
319- port , port + portAmount , attempts + 1 )
320- return port
321- }
306+ allAvailable := true
307+ for i := int32 (0 ); i <= portAmount ; i ++ {
308+ if nodePorts [port + i ] {
309+ allAvailable = false
310+ break
311+ }
312+ }
313+
314+ if allAvailable {
315+ for i := int32 (0 ); i <= portAmount ; i ++ {
316+ nodePorts [port + i ] = true
317+ }
318+ fmt .Printf ("GetNodePort: Successfully allocated NodePort range %d-%d after %d attempts\n " ,
319+ port , port + portAmount , attempts + 1 )
320+ return port
321+ }
322322 }
323323
324324 fmt .Printf ("WARNING: No free NodePorts found after %d attempts, returning 0 for auto-assignment\n " , attempts )
You can’t perform that action at this time.
0 commit comments