fix: 🐛 fix pod mount webdav server error

fix pod mount webdav server error
dev
sys-liqian 1 year ago
parent df80de8392
commit 16e0a83b1a

@ -12,11 +12,11 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
FROM ubuntu:20.04 FROM centos:centos7.9.2009
ARG binary=./bin/webdavplugin ARG binary=./bin/webdavplugin
COPY ${binary} /webdavplugin COPY ${binary} /webdavplugin
RUN apt update && apt install -y davfs2=1.5.5-1 RUN yum install epel-release -y && yum update -y && yum install davfs2 -y
ENTRYPOINT ["/webdavplugin"] ENTRYPOINT ["/webdavplugin"]

@ -19,7 +19,6 @@ package webdav
import ( import (
"context" "context"
"os" "os"
"path/filepath"
"strings" "strings"
"github.com/container-storage-interface/spec/lib/go/csi" "github.com/container-storage-interface/spec/lib/go/csi"
@ -84,7 +83,7 @@ func (n *NodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublish
return &csi.NodePublishVolumeResponse{}, nil return &csi.NodePublishVolumeResponse{}, nil
} }
sourcePath := filepath.Join(address, subDir) sourcePath := strings.Join([]string{address, subDir}, "/")
stdin := []string{req.GetSecrets()[secretUsernameKey], req.GetSecrets()[secretPasswordKey]} stdin := []string{req.GetSecrets()[secretUsernameKey], req.GetSecrets()[secretPasswordKey]}
klog.V(2).Infof("NodePublishVolume: volumeID(%v) source(%s) targetPath(%s) mountflags(%v)", volumeID, sourcePath, targetPath, mountOptions) klog.V(2).Infof("NodePublishVolume: volumeID(%v) source(%s) targetPath(%s) mountflags(%v)", volumeID, sourcePath, targetPath, mountOptions)
err = n.mounter.MountSensitiveWithStdin(sourcePath, targetPath, fstype, mountOptions, nil, stdin) err = n.mounter.MountSensitiveWithStdin(sourcePath, targetPath, fstype, mountOptions, nil, stdin)

Loading…
Cancel
Save