Check Pod and PVC namespace while rendering

- Name of the PVC can be same in different namespaces, in this
scenario an application pod is connected to multiple PVC.

Signed-off-by: Akash Srivastava <akashsrivastava4927@gmail.com>
This commit is contained in:
Akash Srivastava
2018-12-08 19:34:30 +05:30
parent feaf8c3d7b
commit 00168819c5

View File

@@ -57,9 +57,11 @@ func (v podToVolumesRenderer) Render(ctx context.Context, rpt report.Report) Nod
if !found {
continue
}
podNamespace, _ := podNode.Latest.Lookup(kubernetes.Namespace)
for _, pvcNode := range rpt.PersistentVolumeClaim.Nodes {
pvcName, _ := pvcNode.Latest.Lookup(kubernetes.Name)
if pvcName == ClaimName {
pvcNamespace, _ := pvcNode.Latest.Lookup(kubernetes.Namespace)
if (pvcName == ClaimName) && (podNamespace == pvcNamespace) {
podNode.Adjacency = podNode.Adjacency.Add(pvcNode.ID)
podNode.Children = podNode.Children.Add(pvcNode)
}