Skip to content

[Enhancement] Support CSI ephemeral inline volumes for FE, BE, CN and fe-proxy - #786

Merged
yandongxiao merged 1 commit into
StarRocks:mainfrom
yandongxiao:port-oss-588f26cc
Jul 31, 2026
Merged

yandongxiao merged 1 commit into
StarRocks:mainfrom
yandongxiao:port-oss-588f26cc

Conversation

@yandongxiao

@yandongxiao yandongxiao commented Jul 28, 2026 •

Copy link
Copy Markdown
Collaborator

Description

When I need to mount the SPIRE Agent's Workload API socket into FE pods for SPIFFE-based
workload identity. That requires a CSI ephemeral inline volume — a volume source with no
PersistentVolumeClaim, published by a Node-only CSI driver at pod start and torn down with the
pod. StorageVolume could only express a PVC (via storageClassName), emptyDir, or hostPath,
so this configuration had no way to be declared, and the hostPath workaround is
blocked by their OPA admission policy.

A PVC cannot express this: the SPIFFE CSI driver implements only the CSI Node Service (no
CreateVolume), so a PVC against it stays Pending forever; a bound PV's node affinity would
pin the pod to one node while the socket is node-local everywhere; and PVC semantics (capacity,
access mode, reclaim policy) are meaningless for a Unix socket.

This adds a csi field to StorageVolume and a csi pseudo storage class — the same pattern
already used for emptyDir/hostPath — renders it into the pod spec via a new
MountCSIVolume, and confirms PVCList() excludes it (it already skips every special storage
class, so no PVC is ever created for a CSI volume). The Helm chart exposes it as csiVolumes on
starrocksFESpec/starrocksBeSpec/starrocksCnSpec, alongside the existing emptyDirs/
hostPaths keys.

At the CRD level csi is supported on all four component specs (FE, BE, CN, fe-proxy) and on
StarRocksWarehouse, because they all share the same StorageVolume/StarRocksComponentSpec
types; the Helm csiVolumes convenience key is scoped to FE/BE/CN only. Mid-branch we found that
fe-proxy's sub-controller had never validated storageVolumes at all (a pre-existing gap, not
introduced here) — meaning the new validation errors below would have been dead code on fe-proxy,
leaving the exact silent-PVC failure this PR fixes still reachable there. That gap is closed in
the same PR (feproxy_controller.go's validating() now validates storage volumes like FE/BE/CN
do); it cannot break an existing cluster, since a config it newly rejects was already either
stuck Pending (a PVC literally named csi) or already rejected by the apiserver (hostPath with
an empty path).

Three new validation errors turn previously silent misconfigurations into explicit rejections:
a csi block next to a real (non-csi) storage class, csi alongside hostPath, and csi/
storageClassName: csi without a driver. csi (case-insensitive) is now a reserved
storageClassName value, like emptyDir/hostPath — a pre-existing cluster referencing a real
StorageClass literally named csi will fail validation after upgrade (a stuck, non-destructive
reconcile failure, disclosed in the how-to's Limitations).

Verified on a real kind cluster (v1.27.3): the operator renders the CSI volume into
StatefulSet.spec.template.spec.volumes and never into volumeClaimTemplates; readOnly
reaches Volume.CSI but is deliberately not copied onto the container's volumeMount (the
driver enforces it via csi.readOnly, matching the existing emptyDir/hostPath mount
helpers); all three new errors surface both in status.reason and as a Kubernetes Warning Event
naming the failing sub-controller; and an operator/CRD upgrade with no CR changes leaves FE and
CN's StatefulSet.spec.template byte-identical with unchanged pod UIDs and restart counts (BE
was not part of the minimal test cluster but shares the identical rendering code path). No
Ephemeral-capable CSI driver was available on the test cluster, so a genuine successful mount
was not demonstrated — verification stops at "the operator renders it correctly and kubelet
takes the CSI path," which is where this operator's contract ends.

This PR supersedes and completes #785 (same capability, but adding the validation, tests,
Helm chart support and documentation it was missing). The csi field name and csiVolumes
key are identical to #785, so existing users of that patch are unaffected; its author is
credited on the commit (Co-authored-by).

Checklist

For operator, please complete the following checklist:

  • run make generate to generate the code.
  • run make lint to check the code style. (golangci-lint v2.2.2, CI-pinned: 0 issues)
  • run make test to run UT. (all packages pass; TestStorageVolumeValidate covers the full
    validation decision table, TestMakePVCList pins the no-PVC-for-CSI exclusion)
  • run make manifests to update the yaml files of CRD.

For helm chart, please complete the following checklist:

  • make sure you have updated the values.yaml
    file of starrocks chart. (csiVolumes: [] added for FE/BE/CN, with the storageVolumes
    render guard extended so a csiVolumes-only config doesn't silently disappear; verified
    with helm template that FE/BE/CN each render their csi block)
  • In scripts directory, run bash create-parent-chart-values.sh to update the values.yaml file of the parent
    chart( kube-starrocks chart).

… fe-proxy

Some CSI drivers publish node-local resources into pods through a CSI
ephemeral inline volume instead of a PersistentVolumeClaim — the SPIFFE
CSI driver (csi.spiffe.io), which mounts the SPIRE Agent's Workload API
socket, is the common example. Such drivers implement only the CSI Node
Service and declare volumeLifecycleModes: [Ephemeral], so a PVC against
them stays Pending forever, and a bound PV's node affinity would pin the
pod to one node while the socket exists on every node. StorageVolume
could only express a PVC, emptyDir or hostPath, so this configuration
could not be declared (and hostPath is commonly blocked by OPA policies).

This change:

- Adds a csi field to StorageVolume plus a csi pseudo storage class
  (the same pattern as emptyDir/hostPath). The volume is rendered into
  the pod spec via a new MountCSIVolume and never becomes a PVC
  (PVCList already skips every special storage class; a test pins that).
- Adds a StorageVolume readOnly flag that sets readOnly on the
  container's volumeMount — independent of csi.readOnly, which asks the
  driver to publish the volume read-only. Also honored for emptyDirs /
  hostPaths entries in the Helm chart.
- Turns three previously-silent misconfigurations into explicit
  validation errors: csi with a real (non-csi) storage class, csi
  together with hostPath, and storageClassName: csi without a driver.
  csi (case-insensitive) becomes a reserved storageClassName value.
- Closes a pre-existing gap where fe-proxy never validated its
  storageVolumes, so the new errors (and hostPath's existing one)
  actually surface there too.
- Helm: csiVolumes lists on starrocksFESpec / starrocksBeSpec /
  starrocksCnSpec, rendered as storageClassName: "csi" entries.
- Docs: doc/mount_csi_volumes_howto.md with a SPIFFE walkthrough.

Supersedes and completes StarRocks#785 (same csi field name and csiVolumes values
key, so existing users of that patch are unaffected), adding the
validation, tests, Helm chart support and documentation it was missing.

Signed-off-by: yandongxiao <yandongxiao@starrocks.com>
@yandongxiao
yandongxiao merged commit 7027f91 into StarRocks:main Jul 31, 2026
7 checks passed
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.

1 participant