node_count and worker_node_count render incorrect values on CI Platforms
The Helm templating logic for node_count and worker_node_count is incorrectly resolving to 0 worker nodes on CI platforms, even when valid worker node configurations exist in the input values.
This leads to misleading or incorrect rendering of cluster state and impacts dependent logic relying on accurate node counts.
The template uses .Values.cluster.machine_deployments to compute:
-
worker_node_count: Sum of .replicas across worker machine deployments -
node_count: Sum of control plane + worker replicas
When rendered manually on local platforms, the values behave correctly.
- Example:
worker_node_count: 1,
node_count: 2 (for 1 control plane + 1 worker)
But when rendered on CI platforms, both variables return 0 for worker count, despite the fact that:
- Nodes are successfully deployed, including workers.
~/builds/VnUqjBN8A/0/sylva-projects/sylva-core$ kubectl get nodes -A
NAME STATUS ROLES AGE VERSION
mgmt-1903863780-rke2-capm3-virt-management-cp-0 Ready control-plane,etcd,master 18m v1.30.11+rke2r1
mgmt-1903863780-rke2-capm3-virt-management-cp-1 Ready control-plane,etcd,master 7m5s v1.30.11+rke2r1
mgmt-1903863780-rke2-capm3-virt-management-cp-2 Ready control-plane,etcd,master 12m v1.30.11+rke2r1
mgmt-1903863780-rke2-capm3-virt-management-md-0 Ready <none> 12m v1.30.11+rke2r1
- The values secret clearly shows a defined replica count:
machine_deployments:
md0:
capm3:
hostSelector:
matchLabels:
cluster-role: worker
primary_pool_interface: bond0.100
provisioning_pool_interface: bond0
replicas: 1
Validating secrets on CI: kubectl get secret sylva-units-values -n sylva-system -o template="{{ .data.values }}" | base64 -d
Shows the correct structure and replicas: 1 under the md0 deployment.
Expectation:
-
worker_node_countshould evaluate to no. of replicas defined undermachine_deployments.md0 -
node_countshould include both control plane and worker replicas
How to Reproduce
- Trigger any CAPM3-based pipeline in HA which created 3 control plane nodes + 1 worker node.
- Once the cluster is provisioned and running, access the CI job console.
- Run:
kubectl get secret sylva-units-values -n sylva-system -o template="{{ .data.values }}" | base64 -d > sylva-values.txt - Open the output file:
cat sylva-values.txt - Navigate to the following section:
cluster:
machine_deployments:
md0:
replicas: 1
...
Check the rendered variable values in the same file:
node_count: 3
worker_node_count: 0
Expected:
node_count: 4
worker_node_count: 1