mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-05 17:27:51 +00:00
Update metrics apiserver to support filtering by labels
This commit is contained in:
parent
03bc47e9fb
commit
d091fff18b
11 changed files with 331 additions and 187 deletions
|
|
@ -26,6 +26,7 @@ import (
|
|||
corev1 "k8s.io/api/core/v1"
|
||||
apimeta "k8s.io/apimachinery/pkg/api/meta"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
apitypes "k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/klog"
|
||||
|
|
@ -347,10 +348,10 @@ func (p *resourceProvider) runQuery(now pmodel.Time, queryInfo resourceQuery, re
|
|||
|
||||
// build the query, which needs the special "container" group by if this is for pod metrics
|
||||
if resource == nodeResource {
|
||||
query, err = queryInfo.nodeQuery.Build("", resource, namespace, nil, names...)
|
||||
query, err = queryInfo.nodeQuery.Build("", resource, namespace, nil, labels.Everything(), names...)
|
||||
} else {
|
||||
extraGroupBy := []string{queryInfo.containerLabel}
|
||||
query, err = queryInfo.contQuery.Build("", resource, namespace, extraGroupBy, names...)
|
||||
query, err = queryInfo.contQuery.Build("", resource, namespace, extraGroupBy, labels.Everything(), names...)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to construct query: %v", err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue