Skip to content

Commit

Permalink
updated docker base image to alpine:3.15 (#85)
Browse files Browse the repository at this point in the history
* updated docker base image to alpine:3.15

* added devicePath to volumeContext

* returned CapacityBytes after NodeExpansion

* updated docker base image to alpine:3.15

* updated docker base image to ubuntu:20.04

* updated docker base image to alpine:3.18

* updated docker base image to alpine:3.8

* updated docker base image to alpine:3.18

* updated docker base image to alpine:3.18

* updated docker base image to alpine:3.18
  • Loading branch information
geoffrey1330 authored Oct 25, 2024
1 parent 8025583 commit 71c92e3
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 3 deletions.
5 changes: 3 additions & 2 deletions deploy/image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
#
# XXX: pin alpine to 3.8 with e2fsprogs-1.44
# e2fsprogs-1.45+ crashes my test vm when running mkfs.ext4
FROM alpine:3.8
FROM alpine:3.18
LABEL maintainers="SPDK-CSI Authors"
LABEL description="SPDK-CSI Plugin"

COPY spdkcsi /usr/local/bin/spdkcsi

RUN apk add nvme-cli open-iscsi e2fsprogs xfsprogs blkid
RUN apk update && \
apk add nvme-cli open-iscsi e2fsprogs xfsprogs blkid xfsprogs-extra e2fsprogs-extra

ENTRYPOINT ["/usr/local/bin/spdkcsi"]
38 changes: 37 additions & 1 deletion pkg/spdk/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ func (ns *nodeServer) NodeStageVolume(_ context.Context, req *csi.NodeStageVolum
klog.Errorf("failed to stage volume, volumeID: %s devicePath:%s err: %v", volumeID, devicePath, err)
return nil, status.Error(codes.Internal, err.Error())
}

vc["devicePath"] = devicePath
// stash VolumeContext to stagingParentPath (useful during Unstage as it has no
// VolumeContext passed to the RPC as per the CSI spec)
err = util.StashVolumeContext(req.GetVolumeContext(), stagingParentPath)
Expand Down Expand Up @@ -297,7 +299,41 @@ func (ns *nodeServer) NodeGetCapabilities(_ context.Context, _ *csi.NodeGetCapab

func (ns *nodeServer) NodeExpandVolume(_ context.Context, req *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error) {
klog.Infof("NodeExpandVolume: called with args %+v", *req)
return &csi.NodeExpandVolumeResponse{}, nil

volumeID := req.GetVolumeId()
volumeMountPath := req.GetVolumePath()
updatedSize := req.GetCapacityRange().GetRequiredBytes()

stagingParentPath := req.GetStagingTargetPath()
volumeContext, err := util.LookupVolumeContext(stagingParentPath)
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to retrieve volume context for volume %s: %v", volumeID, err)
}

devicePath, ok := volumeContext["devicePath"]
if !ok || devicePath == "" {
return nil, status.Errorf(codes.Internal, "could not find device path for volume %s", volumeID)
}

resizer := mount.NewResizeFs(exec.New())
needsResize, err := resizer.NeedResize(devicePath, volumeMountPath)
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to check if volume %s needs resizing: %v", volumeID, err)
}

if needsResize {
resized, err := resizer.Resize(devicePath, volumeMountPath)
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to resize volume %s: %v", volumeID, err)
}
if resized {
klog.Infof("Successfully resized volume %s (device: %s, mount path: %s)", volumeID, devicePath, volumeMountPath)
} else {
klog.Warningf("Volume %s did not require resizing", volumeID)
}
}

return &csi.NodeExpandVolumeResponse{CapacityBytes: updatedSize}, nil
}

// must be idempotent
Expand Down

0 comments on commit 71c92e3

Please sign in to comment.