Skip to content

Use the node type's offering for CKS scale accounting - #14806

Open
bhouse-nexthop wants to merge 1 commit into
apache:4.22from
bhouse-nexthop:cks-scale-node-offering
Open

bhouse-nexthop wants to merge 1 commit into
apache:4.22from
bhouse-nexthop:cks-scale-node-offering

Conversation

@bhouse-nexthop

@bhouse-nexthop bhouse-nexthop commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Description

This PR makes CKS scaling use the node type's offering for capacity planning and for the cluster's stored cores/memory.

Path Before Now
Capacity check before adding workers cluster offering worker offering
Cores/memory after a size scale new workers at the cluster offering worker offering
Cores/memory after an offering scale old offering read from the VMs after they were upgraded (no change) node type's offering on the cluster
Nodes added with addNodesToKubernetesCluster upgraded by a worker offering scale, counted at the worker offering keep their own offering; their cores/memory stay as counted when added

The node type's offering falls back to the cluster offering when none is set, same as VM deployment (getServiceOfferingForNodeTypeOnCluster).

Fixes: #14805

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

How Has This Been Tested?

  • New unit tests in KubernetesClusterScaleWorkerTest:
    • size scale stores cores/memory at the worker offering
    • size scale falls back to the cluster offering when no worker offering is set
    • offering scale counts the old offering from the cluster, not the already-upgraded VMs
    • capacity check plans new workers with the worker offering
  • New tests fail without the change; KubernetesClusterScaleWorkerTest, KubernetesClusterManagerImplTest, KubernetesClusterActionWorkerTest, KubernetesClusterResourceModifierActionWorkerTest pass.

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

  • Clusters without per-type offerings: lookup falls back to the cluster offering, same numbers as before.
  • Combined offering + size scale, both orders (up and down): totals end at the new offering × new count.
  • Etcd with no nodes: skips the lookup.

@codecov

codecov Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.33%. Comparing base (16238b1) to head (d7e2114).
⚠️ Report is 1 commits behind head on 4.22.

Files with missing lines Patch % Lines
...er/actionworkers/KubernetesClusterScaleWorker.java 76.00% 3 Missing and 3 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.22   #14806      +/-   ##
============================================
+ Coverage     18.31%   18.33%   +0.01%     
- Complexity    16642    16662      +20     
============================================
  Files          5939     5939              
  Lines        537787   537808      +21     
  Branches      65932    65937       +5     
============================================
+ Hits          98510    98604      +94     
+ Misses       428072   427985      -87     
- Partials      11205    11219      +14     
Flag Coverage Δ
uitests 4.08% <ø> (ø)
unittests 19.42% <76.00%> (+0.01%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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.

@bhouse-nexthop

Copy link
Copy Markdown
Collaborator Author

Tested in a nested KVM lab on a 24.0-based build that carries this PR (and #14808). Cluster with 1 control + 1 worker; cluster offering 2 cores / 4 GB.

Step Node offerings Cluster cores / memory Sum of node VMs
Create control 2c/4G, worker 2c/4G 4 / 8192 4 / 8192
Worker offering to 2c/3G (nodeofferings, rollout) worker 2c/3G 4 / 7168 4 / 7168
Size-only scale to 2 new worker on 2c/3G 6 / 10240 6 / 10240
Size-only scale to 1 unchanged 4 / 7168 4 / 7168
Enable, then disable autoscaling (1..2) unchanged 4 / 7168 4 / 7168

The stored cores and memory matched the node VMs after every step. The new worker came up on the worker offering, not the cluster offering. All nodes were Ready at the end.

@bhouse-nexthop

Copy link
Copy Markdown
Collaborator Author

Lab test on a 4.22-based build with this PR plus the related CKS PRs: KVM, cluster with control on a 2c/4G offering and workers moved to a 2c/5G offering (scale with nodeofferings, cluster stopped, as running KVM clusters can't change offering).

step cluster cores / memory sum of node offerings
workers on the 5G offering (1 control + 4 workers incl. 2 added) 10 / 24576 2+4x2 / 4096+4x5120
size-only scale up by 1 12 / 29696 2+5x2 / 4096+5x5120
enable then disable autoscaling unchanged unchanged
control moved to the 5G offering too 12 / 30720 6x2 / 6x5120

Scaling a CKS cluster with per-node-type offerings got the capacity
check and the stored cores/memory wrong:

| Path | Before | Now |
|---|---|---|
| Capacity check before adding workers | cluster offering | worker offering |
| Cores/memory after a size-only scale | new workers counted at the cluster offering | worker offering |
| Cores/memory after an offering scale | old offering read from the VMs after they were upgraded, so nothing changed | old offering read from the cluster's node type offering |
| Nodes added with addNodesToKubernetesCluster | upgraded by a worker offering scale and counted at the worker offering | left on their own offering; their cores/memory stay as counted when added |

The node type's offering falls back to the cluster offering when none
is set, as VM deployment already does.

Signed-off-by: Brad House <bhouse@nexthop.ai>
@bhouse-nexthop
bhouse-nexthop force-pushed the cks-scale-node-offering branch from 7df09c0 to d7e2114 Compare November 24, 2026 11:00
@bhouse-nexthop

Copy link
Copy Markdown
Collaborator Author

Lab test of the amendment (added nodes left out of offering scale) on a 4.22-based build (e19539e): KVM, isolated network. Offerings: control C 2 vCPU/4096 MB, workers W 2/2048, W2 4/4096, and A 4/8192 for the added node.

step cores / memory result
create 1 control (C) + 2 workers (W) 6 / 8192 = C + 2×W, all Ready
add a VM on A with addNodesToKubernetesCluster 10 / 16384 rises by exactly A, size 3
stop, scale nodeofferings[0].node=WORKER to W2 14 / 20480 = C + 2×W2 + A; both CKS workers on W2 (4/4096), the added VM still on A (4/8192)
start, scale size 3 → 4 18 / 24576 rises by one W2; new worker on W2, the added VM still on A; 5 nodes Ready

Offerings were checked both in the cluster's VM map and on the VMs themselves (listVirtualMachines cpunumber/memory).

This branch has not been deployed

No deployments
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.

1 participant