Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug: when node restart, pod using csi-s3 stuck in terminating state #151

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
FROM golang:1.19-alpine as gobuild
#FROM golang:1.19-alpine as gobuild
FROM registry.cn-hangzhou.aliyuncs.com/eryajf/golang:1.20.14-alpine3.19 as gobuild

WORKDIR /build
ENV GOPROXY=https://goproxy.cn
ADD go.mod go.sum /build/
RUN go mod download -x
ADD cmd /build/cmd
ADD pkg /build/pkg
RUN CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o ./s3driver ./cmd/s3driver

FROM alpine:3.17
#FROM alpine:3.17
FROM registry.cn-hangzhou.aliyuncs.com/eryajf/alpine:3.19
LABEL maintainers="Vitaliy Filippov <[email protected]>"
LABEL description="csi-s3 slim image"

RUN apk add --no-cache fuse mailcap rclone
RUN apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/community s3fs-fuse

ADD https://github.com/yandex-cloud/geesefs/releases/latest/download/geesefs-linux-amd64 /usr/bin/geesefs
#ADD https://github.com/yandex-cloud/geesefs/releases/latest/download/geesefs-linux-amd64 /usr/bin/geesefs
ADD geesefs /usr/bin/geesefs
RUN chmod 755 /usr/bin/geesefs

COPY --from=gobuild /build/s3driver /s3driver
Expand Down
Binary file added geesefs
Binary file not shown.
12 changes: 10 additions & 2 deletions pkg/mounter/mounter.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const (
rcloneMounterType = "rclone"
TypeKey = "mounter"
BucketKey = "bucket"
OptionsKey = "options"
OptionsKey = "options"
)

// New returns a new mounter depending on the mounterType parameter
Expand Down Expand Up @@ -73,7 +73,15 @@ func fuseMount(path string, command string, args []string, envs []string) error
}

func Unmount(path string) error {
if err := mount.New("").Unmount(path); err != nil {
mounter := mount.New("")
isNotMountPoint, err := mounter.IsNotMountPoint(path)

if isNotMountPoint || err != nil {
glog.Warningf("Skip Unmount since path (%s) may not a valid mount point: %v", path, err)
return nil
}

if err := mounter.Unmount(path); err != nil {
return err
}
return nil
Expand Down