support node-pod/namespace-workload sorting and paging

This commit is contained in:
Carman Zhang
2018-11-23 11:41:56 +08:00
parent c7a1011e0c
commit 9a6880bc9c
5 changed files with 147 additions and 29 deletions

View File

@@ -17,7 +17,18 @@ import (
"strings"
)
func MakeWorkloadRule(wkKind, wkName, namespace string) string {
func MakeWorkloadPromQL(metricName, nsName, wlFilter string) string {
if wlFilter == "" {
wlFilter = ".*"
}
var promql = RulePromQLTmplMap[metricName]
promql = strings.Replace(promql, "$2", nsName, -1)
promql = strings.Replace(promql, "$3", wlFilter, -1)
return promql
}
func MakeSpecificWorkloadRule(wkKind, wkName, namespace string) string {
var rule = PodInfoRule
if namespace == "" {
namespace = ".*"