Skip to content

Commit 7b85ab2

Browse files
authored
Merge pull request #230 from pohly/dependencies
dependency update
2 parents fbb8b3a + 87aadeb commit 7b85ab2

File tree

662 files changed

+134491
-110261
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

662 files changed

+134491
-110261
lines changed

go.mod

Lines changed: 65 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,70 @@ module github.com/kubernetes-csi/csi-driver-host-path
33
go 1.12
44

55
require (
6-
github.com/container-storage-interface/spec v1.2.0
6+
github.com/container-storage-interface/spec v1.3.0
7+
github.com/go-logr/logr v0.3.0 // indirect
78
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
8-
github.com/golang/protobuf v1.3.2
9-
github.com/google/uuid v1.0.0 // indirect
10-
github.com/kubernetes-csi/csi-lib-utils v0.3.0
11-
github.com/pborman/uuid v0.0.0-20180906182336-adf5a7427709
12-
github.com/spf13/afero v1.2.2 // indirect
13-
github.com/stretchr/testify v1.4.0 // indirect
14-
golang.org/x/net v0.0.0-20190311183353-d8887717615a
15-
google.golang.org/grpc v1.26.0
16-
k8s.io/apimachinery v0.0.0-20181110190943-2a7c93004028 // indirect
17-
k8s.io/kubernetes v1.12.2
18-
k8s.io/utils v0.0.0-20181102055113-1bd4f387aa67
9+
github.com/golang/protobuf v1.4.3
10+
github.com/kubernetes-csi/csi-lib-utils v0.9.0
11+
github.com/pborman/uuid v1.2.1
12+
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11
13+
golang.org/x/sys v0.0.0-20201207223542-d4d67f95c62d // indirect
14+
google.golang.org/genproto v0.0.0-20201209185603-f92720507ed4 // indirect
15+
google.golang.org/grpc v1.34.0
16+
k8s.io/apimachinery v0.21.0-alpha.0 // indirect
17+
k8s.io/kubernetes v1.20.0
18+
k8s.io/mount-utils v0.20.0 // indirect
19+
k8s.io/utils v0.0.0-20201110183641-67b214c5f920
1920
)
21+
22+
replace k8s.io/api => k8s.io/api v0.20.0
23+
24+
replace k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.20.0
25+
26+
replace k8s.io/apimachinery => k8s.io/apimachinery v0.21.0-alpha.0
27+
28+
replace k8s.io/apiserver => k8s.io/apiserver v0.20.0
29+
30+
replace k8s.io/cli-runtime => k8s.io/cli-runtime v0.20.0
31+
32+
replace k8s.io/client-go => k8s.io/client-go v0.20.0
33+
34+
replace k8s.io/cloud-provider => k8s.io/cloud-provider v0.20.0
35+
36+
replace k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.20.0
37+
38+
replace k8s.io/code-generator => k8s.io/code-generator v0.20.1-rc.0
39+
40+
replace k8s.io/component-base => k8s.io/component-base v0.20.0
41+
42+
replace k8s.io/component-helpers => k8s.io/component-helpers v0.20.0
43+
44+
replace k8s.io/controller-manager => k8s.io/controller-manager v0.20.0
45+
46+
replace k8s.io/cri-api => k8s.io/cri-api v0.20.1-rc.0
47+
48+
replace k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.20.0
49+
50+
replace k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.20.0
51+
52+
replace k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.20.0
53+
54+
replace k8s.io/kube-proxy => k8s.io/kube-proxy v0.20.0
55+
56+
replace k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.20.0
57+
58+
replace k8s.io/kubectl => k8s.io/kubectl v0.20.0
59+
60+
replace k8s.io/kubelet => k8s.io/kubelet v0.20.0
61+
62+
replace k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.20.0
63+
64+
replace k8s.io/metrics => k8s.io/metrics v0.20.0
65+
66+
replace k8s.io/mount-utils => k8s.io/mount-utils v0.20.1-rc.0
67+
68+
replace k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.20.0
69+
70+
replace k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.20.0
71+
72+
replace k8s.io/sample-controller => k8s.io/sample-controller v0.20.0

go.sum

Lines changed: 859 additions & 13 deletions
Large diffs are not rendered by default.

pkg/hostpath/controllerserver.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ func (cs *controllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS
314314
Snapshot: &csi.Snapshot{
315315
SnapshotId: exSnap.Id,
316316
SourceVolumeId: exSnap.VolID,
317-
CreationTime: &exSnap.CreationTime,
317+
CreationTime: exSnap.CreationTime,
318318
SizeBytes: exSnap.SizeBytes,
319319
ReadyToUse: exSnap.ReadyToUse,
320320
},
@@ -354,7 +354,7 @@ func (cs *controllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS
354354
snapshot.Id = snapshotID
355355
snapshot.VolID = volumeID
356356
snapshot.Path = file
357-
snapshot.CreationTime = *creationTime
357+
snapshot.CreationTime = creationTime
358358
snapshot.SizeBytes = hostPathVolume.VolSize
359359
snapshot.ReadyToUse = true
360360

@@ -364,7 +364,7 @@ func (cs *controllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS
364364
Snapshot: &csi.Snapshot{
365365
SnapshotId: snapshot.Id,
366366
SourceVolumeId: snapshot.VolID,
367-
CreationTime: &snapshot.CreationTime,
367+
CreationTime: snapshot.CreationTime,
368368
SizeBytes: snapshot.SizeBytes,
369369
ReadyToUse: snapshot.ReadyToUse,
370370
},
@@ -425,7 +425,7 @@ func (cs *controllerServer) ListSnapshots(ctx context.Context, req *csi.ListSnap
425425
snapshot := csi.Snapshot{
426426
SnapshotId: snap.Id,
427427
SourceVolumeId: snap.VolID,
428-
CreationTime: &snap.CreationTime,
428+
CreationTime: snap.CreationTime,
429429
SizeBytes: snap.SizeBytes,
430430
ReadyToUse: snap.ReadyToUse,
431431
}
@@ -527,13 +527,17 @@ func (cs *controllerServer) ControllerExpandVolume(ctx context.Context, req *csi
527527
}, nil
528528
}
529529

530+
func (cs *controllerServer) ControllerGetVolume(context.Context, *csi.ControllerGetVolumeRequest) (*csi.ControllerGetVolumeResponse, error) {
531+
return nil, status.Error(codes.Unimplemented, "")
532+
}
533+
530534
func convertSnapshot(snap hostPathSnapshot) *csi.ListSnapshotsResponse {
531535
entries := []*csi.ListSnapshotsResponse_Entry{
532536
{
533537
Snapshot: &csi.Snapshot{
534538
SnapshotId: snap.Id,
535539
SourceVolumeId: snap.VolID,
536-
CreationTime: &snap.CreationTime,
540+
CreationTime: snap.CreationTime,
537541
SizeBytes: snap.SizeBytes,
538542
ReadyToUse: snap.ReadyToUse,
539543
},

pkg/hostpath/hostpath.go

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ type hostPathVolume struct {
6868
}
6969

7070
type hostPathSnapshot struct {
71-
Name string `json:"name"`
72-
Id string `json:"id"`
73-
VolID string `json:"volID"`
74-
Path string `json:"path"`
75-
CreationTime timestamp.Timestamp `json:"creationTime"`
76-
SizeBytes int64 `json:"sizeBytes"`
77-
ReadyToUse bool `json:"readyToUse"`
71+
Name string `json:"name"`
72+
Id string `json:"id"`
73+
VolID string `json:"volID"`
74+
Path string `json:"path"`
75+
CreationTime *timestamp.Timestamp `json:"creationTime"`
76+
SizeBytes int64 `json:"sizeBytes"`
77+
ReadyToUse bool `json:"readyToUse"`
7878
}
7979

8080
var (
@@ -280,18 +280,10 @@ func deleteHostpathVolume(volID string) error {
280280

281281
if vol.VolAccessType == blockAccess {
282282
volPathHandler := volumepathhandler.VolumePathHandler{}
283-
// Get the associated loop device.
284-
device, err := volPathHandler.GetLoopDevice(getVolumePath(volID))
285-
if err != nil {
286-
return fmt.Errorf("failed to get the loop device: %v", err)
287-
}
288-
289-
if device != "" {
290-
// Remove any associated loop device.
291-
glog.V(4).Infof("deleting loop device %s", device)
292-
if err := volPathHandler.RemoveLoopDevice(device); err != nil {
293-
return fmt.Errorf("failed to remove loop device %v: %v", device, err)
294-
}
283+
path := getVolumePath(volID)
284+
glog.V(4).Infof("deleting loop device for file %s if it exists", path)
285+
if err := volPathHandler.DetachFileDevice(path); err != nil {
286+
return fmt.Errorf("failed to remove loop device for file %s: %v", path, err)
295287
}
296288
}
297289

pkg/hostpath/nodeserver.go

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ import (
2727
"github.com/container-storage-interface/spec/lib/go/csi"
2828
"google.golang.org/grpc/codes"
2929
"google.golang.org/grpc/status"
30-
"k8s.io/kubernetes/pkg/util/mount"
3130
"k8s.io/kubernetes/pkg/volume/util/volumepathhandler"
31+
"k8s.io/utils/mount"
3232
)
3333

3434
const TopologyKeyNode = "topology.hostpath.csi/node"
@@ -104,7 +104,7 @@ func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
104104
// Check if the target path exists. Create if not present.
105105
_, err = os.Lstat(targetPath)
106106
if os.IsNotExist(err) {
107-
if err = mounter.MakeFile(targetPath); err != nil {
107+
if err = makeFile(targetPath); err != nil {
108108
return nil, status.Error(codes.Internal, fmt.Sprintf("failed to create target path: %s: %v", targetPath, err))
109109
}
110110
}
@@ -113,7 +113,7 @@ func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
113113
}
114114

115115
// Check if the target path is already mounted. Prevent remounting.
116-
notMount, err := mounter.IsNotMountPoint(targetPath)
116+
notMount, err := mount.IsNotMountPoint(mounter, targetPath)
117117
if err != nil {
118118
if !os.IsNotExist(err) {
119119
return nil, status.Errorf(codes.Internal, "error checking path %s for mount: %s", targetPath, err)
@@ -135,7 +135,7 @@ func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
135135
return nil, status.Error(codes.InvalidArgument, "cannot publish a non-mount volume as mount volume")
136136
}
137137

138-
notMnt, err := mount.New("").IsNotMountPoint(targetPath)
138+
notMnt, err := mount.IsNotMountPoint(mount.New(""), targetPath)
139139
if err != nil {
140140
if os.IsNotExist(err) {
141141
if err = os.MkdirAll(targetPath, 0750); err != nil {
@@ -341,3 +341,16 @@ func (ns *nodeServer) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandV
341341

342342
return &csi.NodeExpandVolumeResponse{}, nil
343343
}
344+
345+
// makeFile ensures that the file exists, creating it if necessary.
346+
// The parent directory must exist.
347+
func makeFile(pathname string) error {
348+
f, err := os.OpenFile(pathname, os.O_CREATE, os.FileMode(0644))
349+
defer f.Close()
350+
if err != nil {
351+
if !os.IsExist(err) {
352+
return err
353+
}
354+
}
355+
return nil
356+
}

0 commit comments

Comments
 (0)