Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AmitRoushan committed Aug 19, 2021
1 parent da9091e commit f1e246f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/csi/driver/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ func (d *Driver) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (
}
log.Infof("Get NodeId %s", nodeBytes)

if d.nodeName == "" {
return &csi.NodeGetInfoResponse{
NodeId: string(nodeBytes),
}, nil
}

// Get topology info from Node labels
topology, err := d.k8sUtils.GetNodeTopology(d.nodeName)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/k8sutils/k8sutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (k *KubeClient) GetNodeTopology(nodeName string) (map[string]string, error)

topology := make(map[string]string)
for key, value := range k8sNode.Labels {
if match, err := regexp.MatchString(topologyRegx, key); err !=nil && match {
if match, err := regexp.MatchString(topologyRegx, key); err == nil && match {
topology[key] = value
}
}
Expand Down
3 changes: 3 additions & 0 deletions yamls/deploy/huawei-csi-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ rules:
- apiGroups: [""]
resources: ["events"]
verbs: ["get", "list", "watch", "create", "update", "patch"]
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get"]

---
kind: ClusterRoleBinding
Expand Down
3 changes: 3 additions & 0 deletions yamls/deploy/huawei-csi-resize-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ rules:
- apiGroups: [""]
resources: ["events"]
verbs: ["get", "list", "watch", "create", "update", "patch"]
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get"]

---
kind: ClusterRoleBinding
Expand Down
3 changes: 3 additions & 0 deletions yamls/deploy/huawei-csi-resize-snapshot-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,9 @@ rules:
- apiGroups: [""]
resources: ["events"]
verbs: ["get", "list", "watch", "create", "update", "patch"]
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get"]

---
kind: ClusterRoleBinding
Expand Down

0 comments on commit f1e246f

Please sign in to comment.