CKS: Use Zone MTUs when network is created at the time of CKS cluster creation

This commit is contained in:
Pearl Dsilva 2025-12-10 09:40:20 -05:00
parent 4348386970
commit a3cba0475c
4 changed files with 28 additions and 2 deletions

View File

@ -107,6 +107,10 @@ public interface NetworkService {
PhysicalNetwork physicalNetwork, long zoneId, ControlledEntity.ACLType aclType) throws
InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException;
Network createGuestNetwork(long networkOfferingId, String name, String displayText, Account owner,
PhysicalNetwork physicalNetwork, long zoneId, ControlledEntity.ACLType aclType, Pair<Integer, Integer> vrIfaceMTUs) throws
InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException;
Pair<List<? extends Network>, Integer> searchForNetworks(ListNetworksCmd cmd);
boolean deleteNetwork(long networkId, boolean forced);

View File

@ -973,9 +973,12 @@ public class KubernetesClusterManagerImpl extends ManagerBase implements Kuberne
CallContext networkContext = CallContext.register(CallContext.current(), ApiCommandResourceType.Network);
try {
Long zoneId = zone.getId();
Integer publicMTU = NetworkService.VRPublicInterfaceMtu.valueIn(zoneId);
Integer privateMTU = NetworkService.VRPrivateInterfaceMtu.valueIn(zoneId);
network = networkService.createGuestNetwork(networkOffering.getId(), clusterName + "-network",
owner.getAccountName() + "-network", owner, physicalNetwork, zone.getId(),
ControlledEntity.ACLType.Account);
owner.getAccountName() + "-network", owner, physicalNetwork, zoneId,
ControlledEntity.ACLType.Account, new Pair<>(publicMTU, privateMTU));
} catch (ConcurrentOperationException | InsufficientCapacityException | ResourceAllocationException e) {
logAndThrow(Level.ERROR, String.format("Unable to create network for the Kubernetes cluster: %s", clusterName));
} finally {

View File

@ -1869,6 +1869,18 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService, C
null, null, null, null, null, null, null, null, null, null);
}
@Override
@DB
@ActionEvent(eventType = EventTypes.EVENT_NETWORK_CREATE, eventDescription = "creating network")
public Network createGuestNetwork(long networkOfferingId, String name, String displayText, Account owner,
PhysicalNetwork physicalNetwork, long zoneId, ACLType aclType, Pair<Integer, Integer> vrIfaceMTUs) throws
InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException {
return _networkMgr.createGuestNetwork(networkOfferingId, name, displayText,
null, null, null, false, null, owner, null, physicalNetwork, zoneId,
aclType, null, null, null, null, true, null,
null, null, null, null, null, null, null, null, vrIfaceMTUs, null);
}
void checkAndSetRouterSourceNatIp(Account owner, CreateNetworkCmd cmd, Network network) throws InsufficientAddressCapacityException, ResourceAllocationException {
String sourceNatIp = cmd.getSourceNatIP();
if (sourceNatIp == null) {

View File

@ -230,6 +230,13 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkOrches
return null;
}
@Override
public Network createGuestNetwork(long networkOfferingId, String name, String displayText, Account owner,
PhysicalNetwork physicalNetwork, long zoneId, ACLType aclType, Pair<Integer, Integer> vrIfaceMTUs)
throws InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException {
return null;
}
/* (non-Javadoc)
* @see com.cloud.network.NetworkService#searchForNetworks(com.cloud.api.commands.ListNetworksCmd)
*/