mirror of
https://github.com/weaveworks/scope.git
synced 2026-02-14 18:09:59 +00:00
Add new view for 'combined' daemonset/deployment view
The idea is that this view shows all 'pods or groups of pods' at 'the highest level of abstraction'. For now, we just show daemonsets and deployments.
This commit is contained in:
@@ -31,6 +31,7 @@ const (
|
||||
replicaSetsID = "replica-sets"
|
||||
deploymentsID = "deployments"
|
||||
daemonsetsID = "daemonsets"
|
||||
kubeCombinedID = "kube-combined"
|
||||
servicesID = "services"
|
||||
hostsID = "hosts"
|
||||
weaveID = "weave"
|
||||
@@ -120,7 +121,7 @@ func updateKubeFilters(rpt report.Report, topologies []APITopologyDesc) []APITop
|
||||
sort.Strings(ns)
|
||||
topologies = append([]APITopologyDesc{}, topologies...) // Make a copy so we can make changes safely
|
||||
for i, t := range topologies {
|
||||
if t.id == containersID || t.id == podsID || t.id == servicesID || t.id == deploymentsID || t.id == replicaSetsID || t.id == daemonsetsID {
|
||||
if t.id == containersID || t.id == podsID || t.id == servicesID || t.id == deploymentsID || t.id == replicaSetsID || t.id == daemonsetsID || t.id == kubeCombinedID {
|
||||
topologies[i] = mergeTopologyFilters(t, []APITopologyOptionGroup{
|
||||
namespaceFilters(ns, "All Namespaces"),
|
||||
})
|
||||
@@ -268,6 +269,14 @@ func MakeRegistry() *Registry {
|
||||
Options: []APITopologyOptionGroup{unmanagedFilter},
|
||||
HideIfEmpty: true,
|
||||
},
|
||||
APITopologyDesc{
|
||||
id: kubeCombinedID,
|
||||
parent: podsID,
|
||||
renderer: render.KubeCombinedRenderer,
|
||||
Name: "combined",
|
||||
Options: []APITopologyOptionGroup{unmanagedFilter},
|
||||
HideIfEmpty: true,
|
||||
},
|
||||
APITopologyDesc{
|
||||
id: servicesID,
|
||||
parent: podsID,
|
||||
|
||||
@@ -114,6 +114,13 @@ var DaemonSetRenderer = ConditionalRenderer(renderKubernetesTopologies,
|
||||
),
|
||||
)
|
||||
|
||||
// KubeCombinedRenderer is a Renderer which combines the daemonset and deployment views
|
||||
// in (for now) a very naive way.
|
||||
var KubeCombinedRenderer = MakeReduce(
|
||||
DeploymentRenderer,
|
||||
DaemonSetRenderer,
|
||||
)
|
||||
|
||||
func mapPodCounts(parent, original report.Node) report.Node {
|
||||
// When mapping ReplicaSets to Deployments, we want to propagate the Pods counter
|
||||
if count, ok := original.Counters.Lookup(report.Pod); ok {
|
||||
|
||||
Reference in New Issue
Block a user