render.detailed: Add ECS topologies to detailed parents conversion

so they will correctly show up in the details view.
Currently, since ECS topologies aren't considered, the ECS parents of nodes are silently dropped.
This commit is contained in:
Mike Lang
2017-01-20 17:12:40 -08:00
parent 4d50c6950c
commit 39e735f99e

View File

@@ -3,6 +3,7 @@ package detailed
import (
"sort"
"github.com/weaveworks/scope/probe/awsecs"
"github.com/weaveworks/scope/probe/host"
"github.com/weaveworks/scope/probe/kubernetes"
"github.com/weaveworks/scope/report"
@@ -38,6 +39,8 @@ func Parents(r report.Report, n report.Node) (result []Parent) {
report.ReplicaSet: {node(r.ReplicaSet), replicaSetParent},
report.Deployment: {node(r.Deployment), deploymentParent},
report.Service: {node(r.Service), serviceParent},
report.ECSTask: {node(r.ECSTask), ecsTaskParent},
report.ECSService: {node(r.ECSService), ecsServiceParent},
report.ContainerImage: {fake, containerImageParent},
report.Host: {node(r.Host), hostParent},
}
@@ -92,6 +95,24 @@ func kubernetesParent(topology string) func(report.Node) Parent {
}
}
func ecsTaskParent(n report.Node) Parent {
family, _ := n.Latest.Lookup(awsecs.TaskFamily)
return Parent{
ID: n.ID,
Label: family,
TopologyID: "ecs-tasks",
}
}
func ecsServiceParent(n report.Node) Parent {
name, _ := report.ParseECSServiceNodeID(n.ID)
return Parent{
ID: n.ID,
Label: name,
TopologyID: "ecs-services",
}
}
func containerImageParent(n report.Node) Parent {
name, _ := report.ParseContainerImageNodeID(n.ID)
return Parent{