Skip to content

Commit

Permalink
enable topology support
Browse files Browse the repository at this point in the history
Signed-off-by: Mucahit Kurt <[email protected]>
  • Loading branch information
mucahitkurt committed Aug 20, 2019
1 parent a0b9f0c commit 1fb1f0b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions pkg/hostpath/identityserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ func (ids *identityServer) GetPluginCapabilities(ctx context.Context, req *csi.G
},
},
},
{
Type: &csi.PluginCapability_Service_{
Service: &csi.PluginCapability_Service{
Type: csi.PluginCapability_Service_VOLUME_ACCESSIBILITY_CONSTRAINTS,
},
},
},
},
}, nil
}
9 changes: 8 additions & 1 deletion pkg/hostpath/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import (
"k8s.io/kubernetes/pkg/volume/util/volumepathhandler"
)

const TopologyKeyNode = "topology.hostpath.csi.k8s.io/node"

type nodeServer struct {
nodeID string
ephemeral bool
Expand Down Expand Up @@ -261,8 +263,13 @@ func (ns *nodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstag

func (ns *nodeServer) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) {

topology := &csi.Topology{
Segments: map[string]string{TopologyKeyNode: ns.nodeID},
}

return &csi.NodeGetInfoResponse{
NodeId: ns.nodeID,
NodeId: ns.nodeID,
AccessibleTopology: topology,
}, nil
}

Expand Down

0 comments on commit 1fb1f0b

Please sign in to comment.