Skip to content

Commit

Permalink
Implement NodeGetInfo()
Browse files Browse the repository at this point in the history
  • Loading branch information
mugdha-adhav committed Mar 6, 2025
1 parent 76634be commit e47ce45
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cmd/plugin/node_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
4 changes: 4 additions & 0 deletions pkg/csi-common/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit e47ce45

Please sign in to comment.