diff --git a/README.md b/README.md index 75bbadf..5ea668d 100644 --- a/README.md +++ b/README.md @@ -22,10 +22,11 @@ frameworks to mount and unmount Lustre filesystems to/from containers in their p ## Kubernetes Compatibility Matrix -| Lustre CSI Driver / Kubernetes Version | v1.13-1.18 | v1.25 | v1.27 | -|----------------------------------------|------------|-------|-------| -| v0.0.1 | yes | yes | yes | +| Lustre CSI Driver / Kubernetes Version | v1.13-1.18 | v1.25 | v1.27 | v1.28 | v1.29 +|----------------------------------------|------------|-------|-------|------|------ | v0.0.10 | yes | yes | yes | +| v0.1.0 | | | | yes | yes + ## Deployment diff --git a/charts/lustre-csi-driver/templates/plugin.yaml b/charts/lustre-csi-driver/templates/plugin.yaml index 0c0ba59..df56c4b 100644 --- a/charts/lustre-csi-driver/templates/plugin.yaml +++ b/charts/lustre-csi-driver/templates/plugin.yaml @@ -77,7 +77,7 @@ spec: # node-driver-registrar registers your CSI driver with Kubelet so that it knows which Unix # domain socket to issue the CSI calls on. - name: csi-node-driver-registrar - image: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.6.3 + image: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.10.0 args: - --v=5 - --csi-address=/csi/csi.sock diff --git a/charts/lustre-csi-driver/values.yaml b/charts/lustre-csi-driver/values.yaml index 7716767..0ae5183 100644 --- a/charts/lustre-csi-driver/values.yaml +++ b/charts/lustre-csi-driver/values.yaml @@ -4,4 +4,4 @@ deployment: image: "ghcr.io/hewlettpackard/lustre-csi-driver" - tag: "0.1.0" + tag: "0.1.1" diff --git a/deploy/kubernetes/base/kustomization.yaml b/deploy/kubernetes/base/kustomization.yaml index ccdcb79..25e3829 100644 --- a/deploy/kubernetes/base/kustomization.yaml +++ b/deploy/kubernetes/base/kustomization.yaml @@ -13,4 +13,4 @@ resources: images: - name: controller newName: ghcr.io/hewlettpackard/lustre-csi-driver - newTag: 0.1.0 + newTag: 0.1.1 diff --git a/deploy/kubernetes/base/plugin.yaml b/deploy/kubernetes/base/plugin.yaml index df0ee02..e4e843d 100644 --- a/deploy/kubernetes/base/plugin.yaml +++ b/deploy/kubernetes/base/plugin.yaml @@ -80,7 +80,7 @@ spec: # node-driver-registrar registers your CSI driver with Kubelet so that it knows which Unix # domain socket to issue the CSI calls on. - name: csi-node-driver-registrar - image: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.6.3 + image: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.10.0 args: - --v=5 - --csi-address=/csi/csi.sock diff --git a/pkg/lustre-driver/service/node.go b/pkg/lustre-driver/service/node.go index ca150d1..b5f5137 100644 --- a/pkg/lustre-driver/service/node.go +++ b/pkg/lustre-driver/service/node.go @@ -1,5 +1,5 @@ /* - * Copyright 2021, 2022 Hewlett Packard Enterprise Development LP + * Copyright 2021, 2022, 2024 Hewlett Packard Enterprise Development LP * Other additional copyright holders may be indicated within. * * The entirety of this work is licensed under the Apache License, @@ -21,6 +21,7 @@ package service import ( "os" + "strings" log "github.com/sirupsen/logrus" "golang.org/x/net/context" @@ -73,18 +74,34 @@ func (s *service) NodePublishVolume( return nil, status.Errorf(codes.Internal, "NodePublishVolume - Mountpoint mkdir Failed: Error %v", err) } - // 2. Perform the mount + // 2. Verify that it's not yet mounted. mounter := mount.New("") - err = mounter.Mount( - req.GetVolumeId(), - req.GetTargetPath(), - req.GetVolumeCapability().GetMount().GetFsType(), - req.GetVolumeCapability().GetMount().GetMountFlags()) - + isMounted := false + mountpoints, err := mounter.List() if err != nil { - return nil, status.Errorf(codes.Internal, "NodePublishVolume - Mount Failed: Error %v", err) - } else { - log.WithField("source", req.GetVolumeId()).WithField("target", req.GetTargetPath()).Info("Mounted") + return nil, status.Errorf(codes.Internal, "NodePublishVolume - List mounts failed: Error %v", err) + } + for idx := range mountpoints { + if mountpoints[idx].Path == req.GetTargetPath() && mountpoints[idx].Device == req.GetVolumeId() { + log.WithField("source", req.GetVolumeId()).WithField("target", req.GetTargetPath()).Info("Already mounted") + isMounted = true + break + } + } + + // 3. Perform the mount. + if !isMounted { + err := mounter.Mount( + req.GetVolumeId(), + req.GetTargetPath(), + req.GetVolumeCapability().GetMount().GetFsType(), + req.GetVolumeCapability().GetMount().GetMountFlags()) + + if err != nil { + return nil, status.Errorf(codes.Internal, "NodePublishVolume - Mount Failed: Error %v", err) + } else { + log.WithField("source", req.GetVolumeId()).WithField("target", req.GetTargetPath()).Info("Mounted") + } } return &csi.NodePublishVolumeResponse{}, nil @@ -105,7 +122,9 @@ func (s *service) NodeUnpublishVolume( mounter := mount.New("") notMountPoint, err := mount.IsNotMountPoint(mounter, req.GetTargetPath()) - if err != nil { + if err != nil && strings.Contains(err.Error(), "no such") { + // consider it unmounted + } else if err != nil { return nil, status.Errorf(codes.Internal, "NodeUnpublishVolume - Mount point check Failed: Error %v", err) } else if !notMountPoint { err := mounter.Unmount(req.GetTargetPath())