Skip to content

Commit

Permalink
CSI ephemeral volumes: use fixed size
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pohly committed Mar 19, 2021
1 parent b595865 commit 93d4ef8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/hostpath/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ func (hp *hostPath) NodePublishVolume(ctx context.Context, req *csi.NodePublishV
volID := req.GetVolumeId()
volName := fmt.Sprintf("ephemeral-%s", volID)
kind := req.GetVolumeContext()[storageKind]
vol, err := hp.createVolume(req.GetVolumeId(), volName, maxStorageCapacity, mountAccess, ephemeralVolume, kind)
// Configurable size would be nice. For now we use a small, fixed volume size of 100Mi.
volSize := int64(100 * 1024 * 1024)
vol, err := hp.createVolume(req.GetVolumeId(), volName, volSize, mountAccess, ephemeralVolume, kind)
if err != nil && !os.IsExist(err) {
glog.Error("ephemeral mode failed to create volume: ", err)
return nil, err
Expand Down

0 comments on commit 93d4ef8

Please sign in to comment.