Repository navigation
[Enhancement] Support CSI ephemeral inline volumes for FE, BE, CN and fe-proxy - #786
Merged
Merged
Conversation
yandongxiao
force-pushed
the
port-oss-588f26cc
branch
from
July 28, 2026 11:32
ef1911b to
5187ee0
Compare
… 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
force-pushed
the
port-oss-588f26cc
branch
from
July 28, 2026 11:32
5187ee0 to
4ce1a45
Compare
6 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
StorageVolumecould only express a PVC (viastorageClassName),emptyDir, orhostPath,so this configuration had no way to be declared, and the
hostPathworkaround isblocked 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 staysPendingforever; a bound PV's node affinity wouldpin 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
csifield toStorageVolumeand acsipseudo storage class — the same patternalready used for
emptyDir/hostPath— renders it into the pod spec via a newMountCSIVolume, and confirmsPVCList()excludes it (it already skips every special storageclass, so no PVC is ever created for a CSI volume). The Helm chart exposes it as
csiVolumesonstarrocksFESpec/starrocksBeSpec/starrocksCnSpec, alongside the existingemptyDirs/hostPathskeys.At the CRD level
csiis supported on all four component specs (FE, BE, CN, fe-proxy) and onStarRocksWarehouse, because they all share the sameStorageVolume/StarRocksComponentSpectypes; the Helm
csiVolumesconvenience key is scoped to FE/BE/CN only. Mid-branch we found thatfe-proxy's sub-controller had never validatedstorageVolumesat all (a pre-existing gap, notintroduced 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'svalidating()now validates storage volumes like FE/BE/CNdo); 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 (hostPathwithan empty path).
Three new validation errors turn previously silent misconfigurations into explicit rejections:
a
csiblock next to a real (non-csi) storage class,csialongsidehostPath, andcsi/storageClassName: csiwithout a driver.csi(case-insensitive) is now a reservedstorageClassNamevalue, likeemptyDir/hostPath— a pre-existing cluster referencing a realStorageClass literally named
csiwill fail validation after upgrade (a stuck, non-destructivereconcile 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.volumesand never intovolumeClaimTemplates;readOnlyreaches
Volume.CSIbut is deliberately not copied onto the container'svolumeMount(thedriver enforces it via
csi.readOnly, matching the existingemptyDir/hostPathmounthelpers); all three new errors surface both in
status.reasonand as a Kubernetes Warning Eventnaming the failing sub-controller; and an operator/CRD upgrade with no CR changes leaves FE and
CN's
StatefulSet.spec.templatebyte-identical with unchanged pod UIDs and restart counts (BEwas 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 mountwas 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
csifield name andcsiVolumeskey 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:
make generateto generate the code.make lintto check the code style. (golangci-lintv2.2.2, CI-pinned: 0 issues)make testto run UT. (all packages pass;TestStorageVolumeValidatecovers the fullvalidation decision table,
TestMakePVCListpins the no-PVC-for-CSI exclusion)make manifeststo update the yaml files of CRD.For helm chart, please complete the following checklist:
file of starrocks chart. (
csiVolumes: []added for FE/BE/CN, with thestorageVolumesrender guard extended so a
csiVolumes-only config doesn't silently disappear; verifiedwith
helm templatethat FE/BE/CN each render their csi block)scriptsdirectory, runbash create-parent-chart-values.shto update the values.yaml file of the parentchart( kube-starrocks chart).