Skip to content

Commit 45a0c5c

Browse files
committed
fix CSI plugin load issue
Signed-off-by: Boris Bliznioukov <[email protected]>
1 parent ea1a7ce commit 45a0c5c

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

manager/csi/fakes_test.go

+7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package csi
33
import (
44
"context"
55
"fmt"
6+
"net"
67
"strings"
78
"sync"
89

@@ -209,6 +210,7 @@ func (fpm *fakePluginMaker) newFakePlugin(pa mobyplugin.AddrPlugin, provider Sec
209210
p := &fakePlugin{
210211
name: pa.Name(),
211212
socket: pa.Addr().String(),
213+
addr: pa.Addr(),
212214
swarmToCSI: map[string]string{},
213215
volumesCreated: map[string]*api.Volume{},
214216
volumesDeleted: []string{},
@@ -223,6 +225,7 @@ func (fpm *fakePluginMaker) newFakePlugin(pa mobyplugin.AddrPlugin, provider Sec
223225
type fakePlugin struct {
224226
name string
225227
socket string
228+
addr net.Addr
226229
swarmToCSI map[string]string
227230
// removedIDs is a set of node IDs for which RemoveNode has been called.
228231
removedIDs map[string]struct{}
@@ -287,3 +290,7 @@ func (f *fakePlugin) AddNode(swarmID, csiID string) {
287290
func (f *fakePlugin) RemoveNode(swarmID string) {
288291
f.removedIDs[swarmID] = struct{}{}
289292
}
293+
294+
func (f *fakePlugin) Addr() net.Addr {
295+
return f.addr
296+
}

manager/csi/plugin.go

+8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"errors"
66
"fmt"
7+
"net"
78

89
"google.golang.org/grpc"
910
"google.golang.org/grpc/codes"
@@ -30,6 +31,7 @@ type Plugin interface {
3031
UnpublishVolume(context.Context, *api.Volume, string) error
3132
AddNode(swarmID, csiID string)
3233
RemoveNode(swarmID string)
34+
Addr() net.Addr
3335
}
3436

3537
// plugin represents an individual CSI controller plugin
@@ -40,6 +42,7 @@ type plugin struct {
4042

4143
// socket is the unix socket to connect to this plugin at.
4244
socket string
45+
addr net.Addr
4346

4447
// provider is the SecretProvider, which allows retrieving secrets for CSI
4548
// calls.
@@ -80,6 +83,7 @@ func NewPlugin(p mobyplugin.AddrPlugin, provider SecretProvider) Plugin {
8083
// TODO(dperny): verify that we do not need to include the Network()
8184
// portion of the Addr.
8285
socket: fmt.Sprintf("%s://%s", p.Addr().Network(), p.Addr().String()),
86+
addr: p.Addr(),
8387
provider: provider,
8488
swarmToCSI: map[string]string{},
8589
csiToSwarm: map[string]string{},
@@ -341,3 +345,7 @@ func (p *plugin) makeControllerUnpublishVolumeRequest(v *api.Volume, nodeID stri
341345
Secrets: secrets,
342346
}
343347
}
348+
349+
func (p *plugin) Addr() net.Addr {
350+
return p.addr
351+
}

0 commit comments

Comments
 (0)