Skip to content

Commit

Permalink
Render replica set and deployment parents
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbellamy committed May 9, 2016
1 parent 9c7be4d commit 94ddc30
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion render/detailed/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ var (
{
topologyID: report.Service,
NodeSummaryGroup: NodeSummaryGroup{
TopologyID: "pods-by-service",
TopologyID: "services",
Label: "Services",
Columns: []Column{
{ID: report.Pod, Label: "# Pods"},
Expand Down
2 changes: 1 addition & 1 deletion render/detailed/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ func TestMakeDetailedPodNode(t *testing.T) {
{
ID: fixture.ServiceNodeID,
Label: fixture.ServiceName,
TopologyID: "pods-by-service",
TopologyID: "services",
},
},
Connections: []detailed.ConnectionsSummary{
Expand Down
30 changes: 16 additions & 14 deletions render/detailed/parents.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ func Parents(r report.Report, n report.Node) (result []Parent) {
}{
report.Container: {r.Container, containerParent},
report.Pod: {r.Pod, podParent},
report.ReplicaSet: {r.ReplicaSet, replicaSetParent},
report.Deployment: {r.Deployment, deploymentParent},
report.Service: {r.Service, serviceParent},
report.ContainerImage: {r.ContainerImage, containerImageParent},
report.Host: {r.Host, hostParent},
Expand Down Expand Up @@ -62,21 +64,21 @@ func containerParent(n report.Node) Parent {
}
}

func podParent(n report.Node) Parent {
podName, _ := n.Latest.Lookup(kubernetes.Name)
return Parent{
ID: n.ID,
Label: podName,
TopologyID: "pods",
}
}
var (
podParent = kubernetesParent("pods")
replicaSetParent = kubernetesParent("replica-sets")
deploymentParent = kubernetesParent("deployments")
serviceParent = kubernetesParent("services")
)

func serviceParent(n report.Node) Parent {
serviceName, _ := n.Latest.Lookup(kubernetes.Name)
return Parent{
ID: n.ID,
Label: serviceName,
TopologyID: "pods-by-service",
func kubernetesParent(topology string) func(report.Node) Parent {
return func(n report.Node) Parent {
name, _ := n.Latest.Lookup(kubernetes.Name)
return Parent{
ID: n.ID,
Label: name,
TopologyID: topology,
}
}
}

Expand Down

0 comments on commit 94ddc30

Please sign in to comment.