Skip to content

Commit

Permalink
Merge pull request #74 from HewlettPackard/release-v0.1.1
Browse files Browse the repository at this point in the history
Release v0.1.1
  • Loading branch information
roehrich-hpe committed May 1, 2024
2 parents 252a77c + c504489 commit a165eb0
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 19 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion charts/lustre-csi-driver/templates/plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion charts/lustre-csi-driver/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

deployment:
image: "ghcr.io/hewlettpackard/lustre-csi-driver"
tag: "0.1.0"
tag: "0.1.1"
2 changes: 1 addition & 1 deletion deploy/kubernetes/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ resources:
images:
- name: controller
newName: ghcr.io/hewlettpackard/lustre-csi-driver
newTag: 0.1.0
newTag: 0.1.1
2 changes: 1 addition & 1 deletion deploy/kubernetes/base/plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
43 changes: 31 additions & 12 deletions pkg/lustre-driver/service/node.go
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -21,6 +21,7 @@ package service

import (
"os"
"strings"

log "github.com/sirupsen/logrus"
"golang.org/x/net/context"
Expand Down Expand Up @@ -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
Expand All @@ -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())
Expand Down

0 comments on commit a165eb0

Please sign in to comment.