Skip to content

Add RKE2 scaling test and refactoring#2501

Merged
albinsun merged 1 commit intoharvester:mainfrom
albinsun:rke2_scaling
Mar 16, 2026
Merged

Add RKE2 scaling test and refactoring#2501
albinsun merged 1 commit intoharvester:mainfrom
albinsun:rke2_scaling

Conversation

@albinsun
Copy link
Copy Markdown
Contributor

@albinsun albinsun commented Mar 11, 2026

Which issue(s) this PR fixes:

What this PR does / why we need it:

  1. Add test suite TestRKE2Scaling for RKE2 cluster.
    • Check cluster status, deployment and service status after each scaling
    • Current size path is 1 -> 2 -> 3 -> 2 set via parametrize and will check cluster size equals to fromsize before scaling to tosize.
  2. Refactor
    • Extract service data to LBServiceSpec
    • Enhance reliability for cluster Active judgement
    • Change ipam parametrized on test case instead of whole module

Special notes for your reviewer:

Verification

  1. ✔️ 1 node Baremetal harvester-v1.7.1 + rancher-v2.13.1
    • harvester-runtests/64
      image
  2. ✔️ 4 nodes Baremetal harvester-v1.7.1 + rancher-v2.13.1
    • harvester-runtests/62
      image

Additional documentation or context

@albinsun albinsun marked this pull request as ready for review March 12, 2026 00:46
Copilot AI review requested due to automatic review settings March 12, 2026 00:46
Copy link
Copy Markdown
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

Adds an end-to-end scaling test for Rancher-provisioned RKE2 guest clusters and refactors LoadBalancer service creation into a reusable spec/model, with some added “Active/Ready” stabilization logic.

Changes:

  • Add TestRKE2Scaling suite to scale an RKE2 guest cluster (1→2→3→2) and validate cluster/deployments/services after each step.
  • Refactor LoadBalancer Service creation by introducing LBServiceSpec and updating ClusterServiceManager.create(...).
  • Adjust RKE2 cluster readiness checks to reduce false negatives by re-checking “Active/Ready”.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
harvester_e2e_tests/integrations/test_9_rancher_integration.py Adds the RKE2 scaling test suite; refactors LB service fixture/flows; adjusts cluster readiness logic.
apiclient/rancher_api/models.py Introduces LBServiceSpec model to generate LB service payloads.
apiclient/rancher_api/managers.py Updates service manager to build LB service payloads via LBServiceSpec; adds mgmt cluster update.

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

Comment thread harvester_e2e_tests/integrations/test_9_rancher_integration.py
Comment thread harvester_e2e_tests/integrations/test_9_rancher_integration.py
Comment thread harvester_e2e_tests/integrations/test_9_rancher_integration.py
Comment thread apiclient/rancher_api/managers.py Outdated
Comment thread harvester_e2e_tests/integrations/test_9_rancher_integration.py
Comment thread harvester_e2e_tests/integrations/test_9_rancher_integration.py
Copy link
Copy Markdown
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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.


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

Comment thread harvester_e2e_tests/integrations/test_9_rancher_integration.py Outdated
Comment thread harvester_e2e_tests/integrations/test_9_rancher_integration.py
Comment thread harvester_e2e_tests/integrations/test_9_rancher_integration.py Outdated
Comment thread harvester_e2e_tests/integrations/test_9_rancher_integration.py
@albinsun albinsun force-pushed the rke2_scaling branch 2 times, most recently from c094234 to c27160e Compare March 12, 2026 04:03
@albinsun albinsun requested a review from Copilot March 12, 2026 04:08
Copy link
Copy Markdown
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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.


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

Comment thread harvester_e2e_tests/integrations/test_9_rancher_integration.py
Comment thread harvester_e2e_tests/integrations/test_9_rancher_integration.py
Comment thread harvester_e2e_tests/integrations/test_9_rancher_integration.py
@albinsun albinsun requested review from a team and noahgildersleeve March 12, 2026 06:53
Signed-off-by: Albin Sun <albin.sun@suse.com>
Copy link
Copy Markdown
Contributor

@asc5543 asc5543 left a comment

Choose a reason for hiding this comment

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

LGTM

@khushboo-rancher khushboo-rancher requested a review from a team March 12, 2026 17:38
],
"selector": self.selector
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

non-blocking, qq:

Do we want to possibly add more depth to the spec for the Rancher LB Service?

---
apiVersion: v1
kind: Service
metadata:
  annotations:
    cloudprovider.harvesterhci.io/ipam: dhcp
    field.cattle.io/description: ipam lb ngx1
  name: lb-ngx1-ipam
  namespace: default
spec:
  allocateLoadBalancerNodePorts: true
  externalTrafficPolicy: Cluster
  internalTrafficPolicy: Cluster
  ipFamilies:
    - IPv4
  ipFamilyPolicy: SingleStack
  ports:
    - name: ngx1lb
      nodePort: 30001
      port: 8080
      protocol: TCP
      targetPort: 80
  selector:
    svc: ngx1
  sessionAffinity: None
  type: LoadBalancer
---

I believe a majority of the above spec properties are "default" - but I'm unsure if "future" Rancher versions will change the underlying default ... At least too, from a UI perspective Rancher forces users to choose a nodePort number like 30001 ... not sure how explicit we want to be in our Service obj definition? 😄

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Exactly. About the nodePort, IIRC Rancher assign it dynamically if user not config it, so I think we can keep how it is and let Rancher handle it. (At least fo 2.13. We should enhance if the behavior change in newer version)

The current strategy is provide minimum/critical parameters (ns, name, ipam and selector) to fit our test scenario and let Rancher handle others with default value.

We can introduce more fields according the future requirement.

Copy link
Copy Markdown
Contributor

@irishgordo irishgordo left a comment

Choose a reason for hiding this comment

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

lgtm

@albinsun albinsun merged commit 6ce08cc into harvester:main Mar 16, 2026
5 checks passed
@albinsun albinsun deleted the rke2_scaling branch March 16, 2026 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants