Skip to content

Commit a3cba04

Browse files
committed
CKS: Use Zone MTUs when network is created at the time of CKS cluster creation
1 parent 4348386 commit a3cba04

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

api/src/main/java/com/cloud/network/NetworkService.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ Network createGuestNetwork(long networkOfferingId, String name, String displayTe
107107
PhysicalNetwork physicalNetwork, long zoneId, ControlledEntity.ACLType aclType) throws
108108
InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException;
109109

110+
Network createGuestNetwork(long networkOfferingId, String name, String displayText, Account owner,
111+
PhysicalNetwork physicalNetwork, long zoneId, ControlledEntity.ACLType aclType, Pair<Integer, Integer> vrIfaceMTUs) throws
112+
InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException;
113+
110114
Pair<List<? extends Network>, Integer> searchForNetworks(ListNetworksCmd cmd);
111115

112116
boolean deleteNetwork(long networkId, boolean forced);

plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesClusterManagerImpl.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -973,9 +973,12 @@ private Network getKubernetesClusterNetworkIfMissing(final String clusterName, f
973973

974974
CallContext networkContext = CallContext.register(CallContext.current(), ApiCommandResourceType.Network);
975975
try {
976+
Long zoneId = zone.getId();
977+
Integer publicMTU = NetworkService.VRPublicInterfaceMtu.valueIn(zoneId);
978+
Integer privateMTU = NetworkService.VRPrivateInterfaceMtu.valueIn(zoneId);
976979
network = networkService.createGuestNetwork(networkOffering.getId(), clusterName + "-network",
977-
owner.getAccountName() + "-network", owner, physicalNetwork, zone.getId(),
978-
ControlledEntity.ACLType.Account);
980+
owner.getAccountName() + "-network", owner, physicalNetwork, zoneId,
981+
ControlledEntity.ACLType.Account, new Pair<>(publicMTU, privateMTU));
979982
} catch (ConcurrentOperationException | InsufficientCapacityException | ResourceAllocationException e) {
980983
logAndThrow(Level.ERROR, String.format("Unable to create network for the Kubernetes cluster: %s", clusterName));
981984
} finally {

server/src/main/java/com/cloud/network/NetworkServiceImpl.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1869,6 +1869,18 @@ public Network createGuestNetwork(long networkOfferingId, String name, String di
18691869
null, null, null, null, null, null, null, null, null, null);
18701870
}
18711871

1872+
@Override
1873+
@DB
1874+
@ActionEvent(eventType = EventTypes.EVENT_NETWORK_CREATE, eventDescription = "creating network")
1875+
public Network createGuestNetwork(long networkOfferingId, String name, String displayText, Account owner,
1876+
PhysicalNetwork physicalNetwork, long zoneId, ACLType aclType, Pair<Integer, Integer> vrIfaceMTUs) throws
1877+
InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException {
1878+
return _networkMgr.createGuestNetwork(networkOfferingId, name, displayText,
1879+
null, null, null, false, null, owner, null, physicalNetwork, zoneId,
1880+
aclType, null, null, null, null, true, null,
1881+
null, null, null, null, null, null, null, null, vrIfaceMTUs, null);
1882+
}
1883+
18721884
void checkAndSetRouterSourceNatIp(Account owner, CreateNetworkCmd cmd, Network network) throws InsufficientAddressCapacityException, ResourceAllocationException {
18731885
String sourceNatIp = cmd.getSourceNatIP();
18741886
if (sourceNatIp == null) {

server/src/test/java/com/cloud/vpc/MockNetworkManagerImpl.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,13 @@ public Network createGuestNetwork(long networkOfferingId, String name, String di
230230
return null;
231231
}
232232

233+
@Override
234+
public Network createGuestNetwork(long networkOfferingId, String name, String displayText, Account owner,
235+
PhysicalNetwork physicalNetwork, long zoneId, ACLType aclType, Pair<Integer, Integer> vrIfaceMTUs)
236+
throws InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException {
237+
return null;
238+
}
239+
233240
/* (non-Javadoc)
234241
* @see com.cloud.network.NetworkService#searchForNetworks(com.cloud.api.commands.ListNetworksCmd)
235242
*/

0 commit comments

Comments
 (0)