Skip to content

Commit 93d4ef8

Browse files
committed
CSI ephemeral volumes: use fixed size
With storage capacity simulation enabled, trying to create ephemeral volumes with the default maximum volume size may have failed: Warning FailedMount 6s (x5 over 14s) kubelet MountVolume.SetUp failed for volume "ephemeral-volume" : rpc error: code = ResourceExhausted desc = not enough capacity: have 100Gi, need 1Ti Using a smaller size is better because then more than one volume can be created per host. Even better would be to also add a parameter for it, but that can be added later.
1 parent b595865 commit 93d4ef8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/hostpath/nodeserver.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ func (hp *hostPath) NodePublishVolume(ctx context.Context, req *csi.NodePublishV
6464
volID := req.GetVolumeId()
6565
volName := fmt.Sprintf("ephemeral-%s", volID)
6666
kind := req.GetVolumeContext()[storageKind]
67-
vol, err := hp.createVolume(req.GetVolumeId(), volName, maxStorageCapacity, mountAccess, ephemeralVolume, kind)
67+
// Configurable size would be nice. For now we use a small, fixed volume size of 100Mi.
68+
volSize := int64(100 * 1024 * 1024)
69+
vol, err := hp.createVolume(req.GetVolumeId(), volName, volSize, mountAccess, ephemeralVolume, kind)
6870
if err != nil && !os.IsExist(err) {
6971
glog.Error("ephemeral mode failed to create volume: ", err)
7072
return nil, err

0 commit comments

Comments
 (0)