Hi,
i would like to know if it's possible (and how) to create volumes smaller that 1Gi in size.
when i try to build a smaller volume in rancher, longhorn always create 1Gi volume....
if you look at this kubernetes volume file you can see that i tried to create a 400Mi volume but longhorn created a 1Gi one.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
annotations:
control-plane.alpha.kubernetes.io/leader: '{"holderIdentity":"297fad77-060f-11e9-8d7b-8ea00bc77d09","leaseDurationSeconds":15,"acquireTime":"2019-01-05T14:50:25Z","renewTime":"2019-01-05T14:50:27Z","leaderTransitions":0}'
pv.kubernetes.io/bind-completed: "yes"
pv.kubernetes.io/bound-by-controller: "yes"
volume.beta.kubernetes.io/storage-provisioner: rancher.io/longhorn
creationTimestamp: 2019-01-05T14:50:25Z
finalizers:
- kubernetes.io/pvc-protection
labels:
app: nextcloud-apps
chart: nextcloud-1.0.0-apps
heritage: Tiller
instance: nextcloud-wggng
io.cattle.field/appId: nextcloud-wggng
name: nextcloud-wggng-apps
namespace: nextcloud-wggng
resourceVersion: "1895891"
selfLink: /api/v1/namespaces/nextcloud-wggng/persistentvolumeclaims/nextcloud-wggng-apps
uid: 3c0cf148-10f9-11e9-8f38-e0d55e2e2e44
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 400Mi
storageClassName: longhorn
volumeName: pvc-3c0cf14810f911e9
status:
accessModes:
- ReadWriteOnce
capacity:
storage: 1Gi
phase: Bound
is this normal ? thanks a lot for your answers
@Angelinsky7 I think in the manager we've limited the minimal size of the volume to 1G. I need to check but I agree that we should able to create volume less than 1G. 1 MiB sounds like a reasonable minimum.
On second thought, 1G sounds fine too. Since Longhorn is sparse, so unused storage won't take space anyway.
Thanks for you answer, i would gladly prefer a 1Mi minimum limit like that i could create 1Mi maximum storage. If you see what i mean... (or a 500Mi maximum redis cache, or db or anything that i would like)
with the 1Gi minimum limit it also mean that every storage can be 1Gi and in some case i would prefer not (like that i can be completely sure of my storage usage)
1MiB minimal sounds a bit too small. I think 10MiB can be used as the minimal.
Thank you for the update, yasker. Let me know if I can help test anything en route to 1.1.0.
(definitely agree. 1MIB is way too small. 10MiB is still a little on the small side, so wouldn't be unhappy if it turned into 50MiB)
[x] Does the PR include the explanation for the fix or the feature?
[x] Is the backend code merged (Manager, Engine, Instance Manager, BackupStore etc)?
The PR is at https://github.com/longhorn/longhorn-manager/pull/730
[x] Is the reproduce steps/test steps documented?
[x] ~~Which areas/issues this PR might have potential impacts on?
Area CSI Provisioning.
Issues
[x] If the fix introduces the code for backward compatibility Has an separate issue been filed with the label release/obsolete-compatibility?
The compatibility issue is filed at
[x] If labeled: area/ui Has the UI issue filed or ready to be merged?
The UI issue/PR is at
[x] if labeled: require/doc Has the necessary document PR submitted or merged?
The Doc issue/PR is at
[x] If labeled: require/automation-e2e Has the end-to-end test plan been merged? Have QAs agreed on the automation test case?
The automation skeleton PR is at https://github.com/longhorn/longhorn-tests/pull/447
The automation test case PR is at
[x] if labeled: require/automation-engine Has the engine integration test been merged?
The engine automation PR is at
[x] if labeled: require/manual-test-plan Has the manual test plan been documented?
The updated manual test plan is at
Verified with longhorn-master - 10/28/2020
Validation - Pass
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: longhorn-simple-5
namespace: default
spec:
accessModes:
- ReadWriteOnce
storageClassName: longhorn
resources:
requests:
storage: 5Mi
Validated the read/write snapshot and backup functionality of above created volume.
log on creating PVC smaller than 10Mi, the request has 10Mi size.
[longhorn-manager-l5qhq] 10.42.1.63 - - [28/Oct/2020:19:42:59 +0000] "GET /v1/volumes/pvc-6b289b20-371d-4ce0-9d21-2949581df1ce HTTP/1.1" 404 0 "" "Go-http-client/1.1"
[longhorn-manager-l5qhq] time="2020-10-28T19:42:59Z" level=debug msg="Created volume pvc-6b289b20-371d-4ce0-9d21-2949581df1ce: {Size:10485760 Frontend:blockdev FromBackup: NumberOfReplicas:3 DataLocality:disabled StaleReplicaTimeout:2880 NodeID: EngineImage:longhornio/longhorn-engine:master RecurringJobs:[] BaseImage: Standby:false DiskSelector:[] NodeSelector:[] DisableFrontend:false RevisionCounterDisabled:false}"
The integration test test_csi_minimal_volume_size has been passing in the nightly run since merged.
Most helpful comment
Thanks for you answer, i would gladly prefer a 1Mi minimum limit like that i could create 1Mi maximum storage. If you see what i mean... (or a 500Mi maximum redis cache, or db or anything that i would like)
with the 1Gi minimum limit it also mean that every storage can be 1Gi and in some case i would prefer not (like that i can be completely sure of my storage usage)