Skip to content

Support routed networks #439

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 25, 2025

Conversation

vishesh92
Copy link
Member

Issue #, if available:
Fixes #435
Description of changes:

Generated

This pull request introduces several updates to the CloudStack provider, including enhancements to network configuration, dependency upgrades, and validation logic improvements. The changes also include a migration to the Uber mock library for mocking in tests. Below are the most important changes grouped by theme:

Network Configuration Enhancements:

  • Added a NetworkMode field to the Network and CloudStackIsolatedNetworkStatus structs to support routing mode configurations. This field is also reflected in the CRDs (cloudstackclusters.yaml, cloudstackfailuredomains.yaml, cloudstackisolatednetworks.yaml). [1] [2] [3] [4] [5]
  • Updated the Network() method of CloudStackIsolatedNetwork to include the NetworkMode from its status.
  • Added logic to handle NetworkMode in the AddToLBIfNeeded method, ensuring that load balancer assignment is skipped for routed networks.

Validation Logic Improvements:

  • Modified the ValidateUpdate method in CloudStackCluster to allow updates to the ControlPlaneEndpoint.Host field while ensuring the Port remains unchanged.

Dependency and Tooling Updates:

  • Migrated from github.com/golang/mock to go.uber.org/mock for mocking in tests, updating all relevant test files and the Makefile. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]
  • Upgraded Go version to 1.23 and updated dependencies in go.mod files, including cloudstack-go to v2.17.0 and golangci-lint to v1.60.2. [1] [2] [3] [4] [5] [6]

These changes improve the flexibility of network configurations, enhance validation rules, and modernize the codebase with updated dependencies and tooling.

Testing performed:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 23, 2025
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 23, 2025
Copy link

netlify bot commented Apr 23, 2025

Deploy Preview for kubernetes-sigs-cluster-api-cloudstack ready!

Name Link
🔨 Latest commit 4aec197
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-cloudstack/deploys/680a29b3d1d18700085c02b7
😎 Deploy Preview https://deploy-preview-439--kubernetes-sigs-cluster-api-cloudstack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@vishesh92 vishesh92 force-pushed the support-routed-networks branch 2 times, most recently from 89c72e5 to 4847bbe Compare April 23, 2025 08:02
@vishesh92 vishesh92 force-pushed the support-routed-networks branch from 4847bbe to 55bdc5d Compare April 23, 2025 08:08
@rohityadavcloud
Copy link
Member

/assign @weizhouapache

@codecov-commenter
Copy link

codecov-commenter commented Apr 23, 2025

Codecov Report

Attention: Patch coverage is 22.36842% with 59 lines in your changes missing coverage. Please review.

Project coverage is 25.78%. Comparing base (d597e80) to head (4aec197).
Report is 98 commits behind head on main.

Files with missing lines Patch % Lines
pkg/cloud/isolated_network.go 48.14% 11 Missing and 3 partials ⚠️
api/v1beta1/zz_generated.conversion.go 0.00% 9 Missing ⚠️
api/v1beta2/zz_generated.conversion.go 0.00% 9 Missing ⚠️
api/v1beta3/cloudstackisolatednetwork_types.go 0.00% 8 Missing ⚠️
controllers/cloudstackmachine_controller.go 0.00% 7 Missing ⚠️
api/v1beta1/conversion.go 0.00% 6 Missing ⚠️
api/v1beta2/conversion.go 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #439      +/-   ##
==========================================
+ Coverage   25.66%   25.78%   +0.11%     
==========================================
  Files          59       72      +13     
  Lines        5563     6778    +1215     
==========================================
+ Hits         1428     1748     +320     
- Misses       3996     4865     +869     
- Partials      139      165      +26     

☔ 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.

Copy link
Collaborator

@weizhouapache weizhouapache left a comment

Choose a reason for hiding this comment

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

@vishesh92
great job !

I left two minor comments

@blueorangutan
Copy link

Setting up environment failed

@vishesh92 vishesh92 force-pushed the support-routed-networks branch from fbe2232 to 49df11a Compare April 23, 2025 10:10
@blueorangutan
Copy link

Setting up environment failed

@blueorangutan
Copy link

Test Results : (tid-857)
Environment: kvm Rocky8(x3), Advanced Networking with Management Server Rocky8
Kubernetes Version: v1.32.3
Kubernetes Version upgrade from: v1.31.7
Kubernetes Version upgrade to: v1.32.3
CloudStack Version: 4.20
Template: ubuntu-2404-kube
E2E Test Run Logs: https://github.com/blueorangutan/capc-prs/releases/download/capc-pr-ci-cd/capc-e2e-artifacts-pr439-sl-857.zip



Summarizing 5 Failures:
 [FAIL] When testing Kubernetes version upgrades [It] Should successfully upgrade kubernetes versions when there is a change in relevant fields
 /root/go/pkg/mod/sigs.k8s.io/cluster-api/test@v1.9.6/framework/node_helpers.go:56
 [FAIL] When testing affinity group [It] Should have host affinity group when affinity is pro
 /root/go/pkg/mod/sigs.k8s.io/cluster-api/test@v1.9.6/framework/controlplane_helpers.go:116
 [FAIL] When testing clusters in a VPC network [It] Should successfully create a cluster in a VPC network with a custom offering
 /root/go/pkg/mod/sigs.k8s.io/cluster-api/test@v1.9.6/framework/cluster_helpers.go:147
 [FAIL] When testing resource cleanup [It] Should create a new network when the specified network does not exist
 /root/go/pkg/mod/sigs.k8s.io/cluster-api/test@v1.9.6/framework/cluster_helpers.go:147
 [TIMEDOUT] When testing project [It] Should create a cluster in a project
 /jenkins/workspace/capc-e2e-new/test/e2e/project.go:73

Ran 31 of 34 Specs in 10689.494 seconds
FAIL! - Suite Timeout Elapsed -- 26 Passed | 5 Failed | 0 Pending | 3 Skipped
--- FAIL: TestE2E (10689.50s)
FAIL

@blueorangutan
Copy link

Test Results : (tid-858)
Environment: kvm Rocky8(x3), Advanced Networking with Management Server Rocky8
Kubernetes Version: v1.32.3
Kubernetes Version upgrade from: v1.31.7
Kubernetes Version upgrade to: v1.32.3
CloudStack Version: 4.20
Template: ubuntu-2404-kube
E2E Test Run Logs: https://github.com/blueorangutan/capc-prs/releases/download/capc-pr-ci-cd/capc-e2e-artifacts-pr439-sl-858.zip



Summarizing 3 Failures:
 [FAIL] When testing Kubernetes version upgrades [It] Should successfully upgrade kubernetes versions when there is a change in relevant fields
 /root/go/pkg/mod/sigs.k8s.io/cluster-api/test@v1.9.6/framework/node_helpers.go:56
 [FAIL] When testing multiple CPs in a shared network with kubevip [It] Should successfully create a cluster with multiple CPs in a shared network
 /root/go/pkg/mod/sigs.k8s.io/cluster-api/test@v1.9.6/framework/cluster_helpers.go:147
 [FAIL] When testing node drain timeout [It] A node should be forcefully removed if it cannot be drained in time
 /root/go/pkg/mod/sigs.k8s.io/cluster-api/test@v1.9.6/framework/clusterctl/clusterctl_helpers.go:466

Ran 33 of 34 Specs in 10340.583 seconds
FAIL! -- 30 Passed | 3 Failed | 0 Pending | 1 Skipped
--- FAIL: TestE2E (10340.58s)
FAIL

Copy link
Collaborator

@weizhouapache weizhouapache 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

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vishesh92, weizhouapache

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [vishesh92,weizhouapache]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@weizhouapache
Copy link
Collaborator

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 24, 2025
@vishesh92 vishesh92 force-pushed the support-routed-networks branch from 49df11a to 08d655a Compare April 24, 2025 08:42
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 24, 2025
@weizhouapache
Copy link
Collaborator

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 24, 2025
@weizhouapache
Copy link
Collaborator

@vishesh92
it seems the checks are stuck, can you check ?
image

@vishesh92 vishesh92 force-pushed the support-routed-networks branch from 08d655a to 5674a5c Compare April 24, 2025 09:35
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 24, 2025
@vishesh92
Copy link
Member Author

@vishesh92 it seems the checks are stuck, can you check ? image

Yes. I think it's due to golangci-lint & go version.

@vishesh92 vishesh92 force-pushed the support-routed-networks branch from 5674a5c to fcba507 Compare April 24, 2025 11:00
@vishesh92 vishesh92 force-pushed the support-routed-networks branch from fcba507 to 4aec197 Compare April 24, 2025 12:08
@weizhouapache weizhouapache reopened this Apr 25, 2025
@weizhouapache
Copy link
Collaborator

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 25, 2025
@k8s-ci-robot k8s-ci-robot merged commit 4befde1 into kubernetes-sigs:main Apr 25, 2025
11 checks passed
@vishesh92 vishesh92 deleted the support-routed-networks branch April 25, 2025 08:43
@blueorangutan
Copy link

Test Results : (tid-859)
Environment: kvm Rocky8(x3), Advanced Networking with Management Server Rocky8
Kubernetes Version: v1.32.3
Kubernetes Version upgrade from: v1.31.7
Kubernetes Version upgrade to: v1.32.3
CloudStack Version: 4.20
Template: ubuntu-2404-kube
E2E Test Run Logs: https://github.com/blueorangutan/capc-prs/releases/download/capc-pr-ci-cd/capc-e2e-artifacts-pr439-sl-859.zip



Summarizing 10 Failures:
 [FAIL] When testing resource cleanup [AfterEach] Should create a new network when the specified network does not exist
 /jenkins/workspace/capc-e2e-new/test/e2e/resource_cleanup.go:109
 [FAIL] When testing Kubernetes version upgrades [It] Should successfully upgrade kubernetes versions when there is a change in relevant fields
 /root/go/pkg/mod/sigs.k8s.io/cluster-api/test@v1.9.6/framework/node_helpers.go:56
 [FAIL] When testing multiple CPs in a shared network with kubevip [It] Should successfully create a cluster with multiple CPs in a shared network
 /root/go/pkg/mod/sigs.k8s.io/cluster-api/test@v1.9.6/framework/cluster_helpers.go:147
 [FAIL] When testing subdomain [It] Should create a cluster in a subdomain
 /root/go/pkg/mod/sigs.k8s.io/cluster-api/test@v1.9.6/framework/cluster_helpers.go:147
 [FAIL] When testing affinity group [It] Should have host affinity group when affinity is pro
 /root/go/pkg/mod/sigs.k8s.io/cluster-api/test@v1.9.6/framework/cluster_helpers.go:147
 [FAIL] When testing affinity group [It] Should have host affinity group when affinity is anti
 /root/go/pkg/mod/sigs.k8s.io/cluster-api/test@v1.9.6/framework/cluster_helpers.go:147
 [FAIL] When testing with custom disk offering [It] Should successfully create a cluster with a custom disk offering
 /root/go/pkg/mod/sigs.k8s.io/cluster-api/test@v1.9.6/framework/cluster_helpers.go:147
 [FAIL] When testing MachineDeployment rolling upgrades [It] Should successfully upgrade Machines upon changes in relevant MachineDeployment fields
 /root/go/pkg/mod/sigs.k8s.io/cluster-api/test@v1.9.6/framework/cluster_helpers.go:147
 [FAIL] with two clusters [It] should successfully add and remove a second cluster without breaking the first cluster
 /root/go/pkg/mod/sigs.k8s.io/cluster-api/test@v1.9.6/framework/cluster_helpers.go:147
 [TIMEDOUT] When the specified resource does not exist [It] Should fail due to the specified control plane offering is not found [TC7]
 /jenkins/workspace/capc-e2e-new/test/e2e/invalid_resource.go:79

Ran 23 of 34 Specs in 10784.228 seconds
FAIL! - Suite Timeout Elapsed -- 13 Passed | 10 Failed | 0 Pending | 11 Skipped
--- FAIL: TestE2E (10784.23s)
FAIL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CAPC cluster on isolated networks with Routed mode
6 participants