Namespace should not be filterd for Cluster Gateway

Signed-off-by: Roland.Ma <rolandma@kubesphere.io>
This commit is contained in:
Roland.Ma
2021-11-18 03:49:44 +00:00
committed by ks-ci-bot
parent f1a99bd1d8
commit 7a8712bda1

View File

@@ -17,6 +17,7 @@ import (
"fmt"
"strings"
"kubesphere.io/kubesphere/pkg/constants"
"kubesphere.io/kubesphere/pkg/simple/client/monitoring"
)
@@ -482,13 +483,20 @@ func makeIngressMetricExpr(tmpl string, o monitoring.QueryOptions) string {
// For monitoring ingress in the specific namespace
// GET /namespaces/{namespace}/ingress/{ingress} or
// GET /namespaces/{namespace}/ingress
if o.NamespaceName != "" {
if o.NamespaceName != constants.KubeSphereNamespace {
if o.Ingress != "" {
ingressSelector = fmt.Sprintf(`exported_namespace="%s", ingress="%s"`, o.NamespaceName, o.Ingress)
} else {
ingressSelector = fmt.Sprintf(`exported_namespace="%s", ingress=~"%s"`, o.NamespaceName, o.ResourceFilter)
}
} else {
if o.Ingress != "" {
ingressSelector = fmt.Sprintf(`ingress="%s"`, o.Ingress)
} else {
ingressSelector = fmt.Sprintf(`ingress=~"%s"`, o.ResourceFilter)
}
}
// job is a reqiuried filter
// GET /namespaces/{namespace}/ingress?job=xxx&pod=xxx
if o.Job != "" {