Skip to content

Commit 53a47f5

Browse files
committed
Support BYO VNet in AzureStack cluster manifest
Some of the calls we depend on for Azure cluster generation are not available in AzureStack. Adds a dumber way of selecting IP for the load balancer.
1 parent 30c863f commit 53a47f5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pkg/asset/manifests/azure/cluster.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,16 @@ func getNextAvailableIPForLoadBalancer(ctx context.Context, installConfig *insta
381381
}
382382
machineCidr = cidrRange
383383
}
384+
// AzureStack does not support the call to CheckIPAddressAvailability.
385+
if installConfig.Azure.CloudName == azure.StackCloud {
386+
cidr := machineCidr[0]
387+
if cidr.CIDR.Contains(net.IP(lbip)) {
388+
return lbip, nil
389+
}
390+
ipSubnets := cidr.CIDR.IP
391+
ipSubnets[len(ipSubnets)-1] += 4
392+
return ipSubnets.String(), nil
393+
}
384394
availableIP, err := client.CheckIPAddressAvailability(ctx, networkResourceGroupName, virtualNetworkName, lbip)
385395
if err != nil {
386396
return "", fmt.Errorf("failed to get azure ip availability: %w", err)

0 commit comments

Comments
 (0)