Skip to content

CKS: split the glued document separator in the CSI driver manifest - #14914

Open
bhouse-nexthop wants to merge 1 commit into
apache:4.22from
bhouse-nexthop:cks-csi-manifest-separator
Open

bhouse-nexthop wants to merge 1 commit into
apache:4.22from
bhouse-nexthop:cks-csi-manifest-separator

Conversation

@bhouse-nexthop

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

Copy link
Copy Markdown
Collaborator

Description

Correction: an earlier version of this text said volume snapshots fail. They shouldn't: cloudstack-csi-controller-role, bound to the same ServiceAccount, already grants the snapshot permissions, and the CSIDriver's spec equals the Kubernetes defaults. What is wrong is that the CSI deploy step fails and the failure is hidden, and the cluster lacks the CSIDriver object and the binding.

A CKS cluster created with the CSI driver has no CSIDriver object and no cloudstack-csi-snapshotter-binding ClusterRoleBinding, although both are in the manifest. The cause is in the cloudstack-csi-driver v3.0.0 manifest.yaml that the ISO builder downloads: line 121 ends with the document separator (apiGroup: rbac.authorization.k8s.io---), which merges the binding into the CSIDriver document. The API server refuses that document and kubectl applies the rest:

Error from server (BadRequest): error when creating "/opt/csi/manifest.yaml": CSIDriver in version "v1" cannot be handled as a CSIDriver: strict decoding error: unknown field "roleRef", unknown field "subjects"

Nothing reports it, and any other apply failure would be hidden the same way. deploy-csi-driver fails, CloudStack re-copies the scripts and runs it again, and the second run exits 0 at its first line because the controller pod from the partial apply exists.

The control node now puts the separator on a line of its own when it copies manifest.yaml from the ISO to /opt/csi (commit 08a9c41). The fix sits there, not in the ISO builder, so it also covers clusters created from ISOs that were already built. On a manifest without the glued separator the sed changes nothing, so it keeps working once the driver ships a fixed release. The driver's release workflow still produces the glued separator; that is reported there separately.

Not covered: the download fallback in deploy-csi-driver (ISO without CSI files) fetches the same file. On 4.22 that fallback never applies the manifest at all (#14597, fixed by #14598). Changing it here would conflict with #14598.

Fixes: #14913

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?

  • Ran the CSI block of setup-kube-system, taken from the edited cloud-config, on the v3.0.0 manifest.yaml. Only line 121 changes: the file parses as 12 documents instead of 11, and ClusterRoleBinding/cloudstack-csi-snapshotter-binding is back. On a manifest with the separator already on its own line, the output is byte-identical to the input.
  • On a Kubernetes v1.33 cluster with the snapshot CRDs: kubectl apply of the v3.0.0 manifest fails with the error above and creates neither object. Applying the split manifest creates both, and everything else is unchanged.
  • bash -n on the extracted script passes.
  • A CKS cluster created with the CSI driver on a KVM test environment: report to follow.

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

  • Comment lines, ---- lines and lines that already hold only --- are left alone.
  • The cloud-config is a Jinja template: the line has no {{, {% or {#, and the Java side only replaces its own {{ ... }} keys.
  • The step only runs when the ISO has the CSI files, in the same block as the copy.

@codecov

codecov Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 18.33%. Comparing base (a8735b2) to head (08a9c41).

Additional details and impacted files
@@             Coverage Diff              @@
##               4.22   #14914      +/-   ##
============================================
- Coverage     18.34%   18.33%   -0.01%     
+ Complexity    16671    16669       -2     
============================================
  Files          5939     5939              
  Lines        537817   537817              
  Branches      65938    65938              
============================================
- Hits          98640    98622      -18     
- Misses       427954   427972      +18     
  Partials      11223    11223              
Flag Coverage Δ
uitests 4.08% <ø> (ø)
unittests 19.42% <ø> (-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.

The manifest.yaml of cloudstack-csi-driver v3.0.0, which the binaries
ISO builder downloads, ends line 121 with the document separator:

    apiGroup: rbac.authorization.k8s.io---

That merges the cloudstack-csi-snapshotter-binding ClusterRoleBinding
into the CSIDriver document that follows it. The API server refuses
the merged document, so deploy-csi-driver's kubectl apply fails and a
cluster created with the CSI driver has neither the CSIDriver object
nor that binding. The failure is not reported: the script's retry
finds the controller pod from the partial apply and exits 0, so any
other apply failure would be hidden the same way.

Put the separator on a line of its own when the control node copies
the manifest from the ISO. This covers clusters on ISOs that were
already built. On a manifest without the glued separator the sed
changes nothing.

Signed-off-by: Brad House <bhouse@nexthop.ai>
@bhouse-nexthop
bhouse-nexthop force-pushed the cks-csi-manifest-separator branch from 40cb164 to 08a9c41 Compare November 29, 2026 14:39
@bhouse-nexthop

Copy link
Copy Markdown
Collaborator Author

Tested on a KVM lab running a main (24.0) build. Primary storage is Ceph RBD. Each CKS cluster is Kubernetes 1.33.1 from an ISO built by create-kubernetes-binaries-iso.sh (it carries the v3.0.0 manifest.yaml), 1 control and 1 worker node, created with enablecsi=true. The first cluster used the packaged k8s-control-node.yml. The second used the same file plus this change, and nothing else differed.

Result: both runs passed all of their checks, 13 of 13 each. The control reproduces the bug, and the change fixes it.

Check Without the change With the change
/opt/csi/manifest.yaml on the control node has apiGroup: rbac.authorization.k8s.io--- yes no
kubectl get csidriver csi.cloudstack.apache.org NotFound found
kubectl get clusterrolebinding cloudstack-csi-snapshotter-binding NotFound found
Management server logged "CSI files missing. Adding them now" (first deploy-csi-driver run failed) during the create yes no
Cluster state Running Running
CSI controller (7/7) and node (3/3) pods Running Running
PVC on a StorageClass with a custom disk offering bound, pod with it mounted Running Running
VolumeSnapshot with class cloudstack-snapshot readyToUse readyToUse

The snapshot works in both runs, as the corrected description says: cloudstack-csi-controller-role already grants the snapshot permissions to the same ServiceAccount. Without the change the cluster reaches Running even though the CSI deploy failed.

Rendered control node user data: 25,809 bytes before, 26,138 bytes with the change.

Both clusters, with their volumes and snapshots, were deleted afterwards.

Not tested: 4.22, and an ISO without the CSI files (the download fallback in deploy-csi-driver, which this change doesn't touch).

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