controllers topology: Map metrics for single nodes

* Maps metrics if there is a single pod in the controller, as per all other views.
* Also added heavy commenting on the increasingly-complex render chain
This commit is contained in:
Mike Lang
2017-06-26 11:31:27 -07:00
parent ec2a7fc753
commit f101f83c3d

View File

@@ -101,20 +101,33 @@ var ReplicaSetRenderer = ConditionalRenderer(renderKubernetesTopologies,
// have connections to each other.
var KubeControllerRenderer = ConditionalRenderer(renderKubernetesTopologies,
MakeReduce(
// Include full deployment topology
MakeFilter(
// Filter out any remaining unmatched replica sets
Complement(IsTopology(report.ReplicaSet)),
MakeMap(
Map2Parent([]string{report.Deployment}, NoParentsKeep, "", mapPodCounts),
MakeReduce(
MakeMap(
Map2Parent([]string{
report.ReplicaSet,
report.DaemonSet,
}, NoParentsPseudo, UnmanagedID, nil),
PodRenderer,
// Include pod metrics previously mapped to replica sets, in deployments
PropagateSingleMetrics(report.ReplicaSet),
MakeMap(
// Map replica sets to deployments, leaving unmatched replica sets and anything else unchanged
Map2Parent([]string{report.Deployment}, NoParentsKeep, "", mapPodCounts),
MakeReduce(
// Include full replica set and daemonset topologies
MakeMap(
// Include pod metrics in mapped nodes
PropagateSingleMetrics(report.Pod),
MakeMap(
// Transform pods to replica sets, daemonsets and 'unmanaged'
Map2Parent([]string{
report.ReplicaSet,
report.DaemonSet,
}, NoParentsPseudo, UnmanagedID, nil),
PodRenderer,
),
),
SelectReplicaSet,
SelectDaemonSet,
),
SelectReplicaSet,
SelectDaemonSet,
),
),
),