diff --git a/cmd/plugin/node_server.go b/cmd/plugin/node_server.go index 9534a19..013fbea 100644 --- a/cmd/plugin/node_server.go +++ b/cmd/plugin/node_server.go @@ -235,3 +235,15 @@ func (n NodeServer) NodeUnstageVolume(ctx context.Context, _ *csi.NodeUnstageVol func (n NodeServer) NodeExpandVolume(ctx context.Context, _ *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error) { return nil, status.Error(codes.Unimplemented, "") } + +func (n NodeServer) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) { + nodeID := n.driver.GetNodeID() + return &csi.NodeGetInfoResponse{ + NodeId: nodeID, + AccessibleTopology: &csi.Topology{ + Segments: map[string]string{ + "kubernetes.io/hostname": nodeID, + }, + }, + }, nil +} diff --git a/pkg/csi-common/utils.go b/pkg/csi-common/utils.go index 461dfb6..5e99427 100644 --- a/pkg/csi-common/utils.go +++ b/pkg/csi-common/utils.go @@ -128,6 +128,10 @@ func NewCSIDriver(name string, v string, nodeID string) *CSIDriver { return &driver } +func (d *CSIDriver) GetNodeID() string { + return d.nodeID +} + func (d *CSIDriver) AddControllerServiceCapabilities(cl []csi.ControllerServiceCapability_RPC_Type) { var csc []*csi.ControllerServiceCapability