support for querying pods metrics from the cluster level

Signed-off-by: junotx <junotx@126.com>
This commit is contained in:
junotx
2020-12-07 17:59:42 +08:00
parent 91c2e05616
commit 1df035ed06
4 changed files with 32 additions and 0 deletions

View File

@@ -349,6 +349,12 @@ func makePodMetricExpr(tmpl string, o monitoring.QueryOptions) string {
}
}
// For monitoring pods in the whole cluster
// Get /pods
if o.NamespaceName == "" && o.NodeName == "" {
podSelector = fmt.Sprintf(`pod=~"%s"`, o.ResourceFilter)
}
// For monitoring pods in the specific namespace
// GET /namespaces/{namespace}/workloads/{kind}/{workload}/pods or
// GET /namespaces/{namespace}/pods/{pod} or