Skip to content

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

Merged
DaanHoogland merged 1 commit into4.20from
ghi12205-cks-network-mtu
Jan 27, 2026
Merged

CKS: Use Zone MTUs when network is created at the time of CKS cluster creation#12228
DaanHoogland merged 1 commit into4.20from
ghi12205-cks-network-mtu

Conversation

@Pearl1594
Copy link
Contributor

Description

This PR fixes: #12205
When a cluster is created without specifying a network, then an isolated network is created automatically with the default MTU. However, if there is an MTU set at zone level, then it would be ideal to use that instead.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

@codecov
Copy link

codecov bot commented Dec 10, 2025

Codecov Report

❌ Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 16.21%. Comparing base (4348386) to head (a3cba04).
⚠️ Report is 71 commits behind head on 4.20.

Files with missing lines Patch % Lines
...bernetes/cluster/KubernetesClusterManagerImpl.java 0.00% 4 Missing ⚠️
...ain/java/com/cloud/network/NetworkServiceImpl.java 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               4.20   #12228   +/-   ##
=========================================
  Coverage     16.21%   16.21%           
- Complexity    13353    13354    +1     
=========================================
  Files          5657     5657           
  Lines        498647   498654    +7     
  Branches      60533    60533           
=========================================
+ Hits          80863    80869    +6     
+ Misses       408771   408766    -5     
- Partials       9013     9019    +6     
Flag Coverage Δ
uitests 4.00% <ø> (ø)
unittests 17.07% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Pearl1594
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@Pearl1594 a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 40%)

See analysis details on SonarQube Cloud

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15979

Copy link
Contributor

@shwstppr shwstppr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code lgtm

@Damans227
Copy link
Contributor

Damans227 commented Jan 26, 2026

Created a PR test environment and tested against it. Set zone-level MTU to 1400 (vr.public.interface.max.mtu and vr.private.interface.max.mtu), then created a CKS cluster without specifying a network. The auto-created network correctly inherited the zone MTU settings (publicmtu=1400, privatemtu=1400) instead of the default 1500. LGTM

image image

Copy link
Contributor

@Damans227 Damans227 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it manually and posted my findings. LGTM.

@DaanHoogland
Copy link
Contributor

@Pearl1594 is this ready (everybody but you seems to think so ;)

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an issue where Kubernetes cluster default networks don't respect zone-level MTU restrictions. When a CKS cluster is created without specifying a network, an isolated network is automatically created. Previously, this network would always use the default 1500 MTU regardless of zone-level MTU settings. Now, the network creation respects the zone's configured MTU values.

Changes:

  • Added a new overload of createGuestNetwork method that accepts zone MTU values as a parameter
  • Updated Kubernetes cluster network creation to retrieve and pass zone MTU values when automatically creating networks

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
api/src/main/java/com/cloud/network/NetworkService.java Added new method signature to the NetworkService interface that accepts MTU values for VR interfaces
server/src/main/java/com/cloud/network/NetworkServiceImpl.java Implemented the new method overload that delegates to the network manager with MTU parameters
plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesClusterManagerImpl.java Updated network creation logic to retrieve zone-level MTU values and pass them when creating the network
server/src/test/java/com/cloud/vpc/MockNetworkManagerImpl.java Added mock implementation of the new interface method for test purposes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


CallContext networkContext = CallContext.register(CallContext.current(), ApiCommandResourceType.Network);
try {
Long zoneId = zone.getId();
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable 'zoneId' is only assigned values of primitive type and is never 'null', but it is declared with the boxed type 'Long'.

Suggested change
Long zoneId = zone.getId();
long zoneId = zone.getId();

Copilot uses AI. Check for mistakes.
@Pearl1594 Pearl1594 marked this pull request as ready for review January 27, 2026 10:58
@DaanHoogland DaanHoogland merged commit ca52327 into 4.20 Jan 27, 2026
52 of 55 checks passed
@DaanHoogland DaanHoogland deleted the ghi12205-cks-network-mtu branch January 27, 2026 11:04
sandeeplocharla pushed a commit to NetApp/cloudstack that referenced this pull request Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CKS default network does not respect zone restrictions

9 participants