Namespace should not be filterd for Cluster Gateway
Signed-off-by: Roland.Ma <rolandma@kubesphere.io>
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"kubesphere.io/kubesphere/pkg/constants"
|
||||||
"kubesphere.io/kubesphere/pkg/simple/client/monitoring"
|
"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
|
// For monitoring ingress in the specific namespace
|
||||||
// GET /namespaces/{namespace}/ingress/{ingress} or
|
// GET /namespaces/{namespace}/ingress/{ingress} or
|
||||||
// GET /namespaces/{namespace}/ingress
|
// GET /namespaces/{namespace}/ingress
|
||||||
if o.NamespaceName != "" {
|
if o.NamespaceName != constants.KubeSphereNamespace {
|
||||||
if o.Ingress != "" {
|
if o.Ingress != "" {
|
||||||
ingressSelector = fmt.Sprintf(`exported_namespace="%s", ingress="%s"`, o.NamespaceName, o.Ingress)
|
ingressSelector = fmt.Sprintf(`exported_namespace="%s", ingress="%s"`, o.NamespaceName, o.Ingress)
|
||||||
} else {
|
} else {
|
||||||
ingressSelector = fmt.Sprintf(`exported_namespace="%s", ingress=~"%s"`, o.NamespaceName, o.ResourceFilter)
|
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
|
// job is a reqiuried filter
|
||||||
// GET /namespaces/{namespace}/ingress?job=xxx&pod=xxx
|
// GET /namespaces/{namespace}/ingress?job=xxx&pod=xxx
|
||||||
if o.Job != "" {
|
if o.Job != "" {
|
||||||
|
|||||||
Reference in New Issue
Block a user