Repository navigation
Add storage capabilities for rancher.io/local-path - #4319
Conversation
local-path-provisioner is the default provisioner in k3s and kind, and the kind provider in cluster-up uses it for its default StorageClass. It has no entry in CapabilitiesByProvisionerKey, so its StorageProfiles get no claimPropertySets and the Recognized condition is False with UnrecognizedProvisioner. A DataVolume that uses spec.storage without accessModes on such a StorageClass then fails with "no accessMode specified in StorageProfile". local-path-provisioner only accepts ReadWriteOnce and ReadWriteOncePod for node paths and always creates Filesystem PVs, so advertise ReadWriteOnce with Filesystem. Assisted-by: Claude <[email protected]> Signed-off-by: YoungjuKim <[email protected]>
|
Hi @fjvbn2003. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
| "k8s.io/minikube-hostpath": {{rwo, file}}, | ||
| // local-path-provisioner (default in k3s and kind); node-local directories, | ||
| // so only RWO filesystem volumes unless a shared filesystem is configured | ||
| "rancher.io/local-path": {{rwo, file}}, |
There was a problem hiding this comment.
I think we can do some aggregation of these local path provisioners which all ultimately give out rwo,file
There was a problem hiding this comment.
Thanks for the review! Done in the second commit: I added a createLocalPathCapabilities() helper and switched the node-local path provisioners to it (hostpath-provisioner CSI and legacy, k8s.io/minikube-hostpath, rancher.io/local-path). The hostpath-provisioner overlay variant stays RWX filesystem.
I left DirectPV (directpv-min-io) out, since it hands out whole local drives rather than directories, but I can fold it in as well if you'd prefer.
Unit tests: go test ./pkg/controller/ runs 388 of 388 specs, all passing.
hostpath-provisioner (CSI and legacy), minikube-hostpath and local-path-provisioner all back a volume with a directory on one node, so each of them only offers ReadWriteOnce Filesystem volumes. Use a single createLocalPathCapabilities helper for them instead of repeating the literal, as suggested in review. Assisted-by: Claude <[email protected]> Signed-off-by: YoungjuKim <[email protected]>
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: akalenyu The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Hi @alromeros @arnongilboa, this already has an /approve from @akalenyu and |
| It("Should create storage profile with RWO filesystem claim property set for local-path-provisioner", func() { | ||
| reconciler = createStorageProfileReconciler(CreateStorageClassWithProvisioner(storageClassName, nil, nil, localPathProvisioner)) | ||
| _, err := reconciler.Reconcile(context.TODO(), reconcile.Request{NamespacedName: types.NamespacedName{Name: storageClassName}}) | ||
| Expect(err).ToNot(HaveOccurred()) | ||
|
|
||
| sp := &cdiv1.StorageProfile{} | ||
| err = reconciler.client.Get(context.TODO(), types.NamespacedName{Name: storageClassName}, sp, &client.GetOptions{}) | ||
| Expect(err).ToNot(HaveOccurred()) | ||
| Expect(*sp.Status.Provisioner).To(Equal(localPathProvisioner)) | ||
| Expect(sp.Status.ClaimPropertySets).To(Equal([]cdiv1.ClaimPropertySet{ | ||
| {AccessModes: []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce}, VolumeMode: ptr.To(v1.PersistentVolumeFilesystem)}, | ||
| })) | ||
| }) | ||
|
|
There was a problem hiding this comment.
Not sure why 2 additional utests are needed for this provisioner, as it has nothing new in the logic which is already well covered.
There was a problem hiding this comment.
Thanks @arnongilboa, fair point. The provisioner only reuses createLocalPathCapabilities, which the existing hostpath tests already cover, so I dropped both tests in 39e13da.
rancher.io/local-path only reuses createLocalPathCapabilities, which the existing hostpath-provisioner tests already cover, so the extra reconcile test and the recognized-provisioner table entry did not exercise any new logic. Signed-off-by: YoungjuKim <[email protected]> Assisted-by: Claude <[email protected]>
|
/lgtm |
What this PR does / why we need it:
Adds
rancher.io/local-path(local-path-provisioner) toCapabilitiesByProvisionerKeywith{{rwo, file}}.local-path-provisioner is the default provisioner in k3s and kind (CDI's own
cluster-up/cluster/kind/manifests/local-storage-class.yamluses it too). Today its StorageProfiles come outempty. On my homelab cluster (CDI v1.66.0, local-path-provisioner v0.0.32):
and cdi-deployment keeps reporting
Set metric:local-path complete:false ..., which is whatCDIStorageProfilesIncompletealerts on. A DataVolume on this class that relies onspec.storagedefaultsfails with
ErrClaimNotValid: no accessMode specified in StorageProfile local-path.Why
{{rwo, file}}, from the provisioner source (same in v0.0.32 and v0.0.37):NodePath only supports ReadWriteOnce and ReadWriteOncePod (1.22+) access modes(provisioner.go)
VolumeMode: &fswithfs := v1.PersistentVolumeFilesystem, so Block is never offered.RWX is only possible when a shared filesystem path is configured for the provisioner, which is not the
default and cannot be seen from the StorageClass; those users can keep setting
spec.claimPropertySetson theStorageProfile. No clone strategy is advised: the provisioner has no snapshot or CSI clone support, so the
existing default (host-assisted
copy, already chosen today) stays.Which issue(s) this PR fixes:
Fixes #3005
Special notes for your reviewer:
Recognizedentry.
localStorageClass. After this change thatStorageProfile becomes complete. If a functional lane depends on that profile being incomplete, please
point me to it and I will adjust.
GOFLAGS=-mod=vendor, onmain@ 9cd4fbd): the new specs fail without the capability entry (7 ran, 2 failed) and pass with it;go test ./pkg/controller/gives 385 passed / 3 failed with this change and 383 passed / 3 failed without it — the same threeUpdate PVC from PODVDDK specs fail in that environment either way;./pkg/storagecapabilities/...passes.AI disclosure: I used Claude (Anthropic) to help read the provisioner source and draft the change and tests.
I reviewed every line, and the StorageProfile output above is from my own cluster. The commit carries an
Assisted-bytrailer.Release note:
🤖 Generated with Claude Code