mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-06 01:38:10 +00:00
pkg/naming/BuildExternal: respect namespace
Currently, the namespace is ignored for external labels. This fixes it.
This commit is contained in:
parent
4b695d4e06
commit
486324753e
1 changed files with 13 additions and 0 deletions
|
|
@ -142,6 +142,19 @@ func (q *metricsQuery) BuildExternal(seriesName string, namespace string, groupB
|
||||||
// Build up the query parts from the selector.
|
// Build up the query parts from the selector.
|
||||||
queryParts = append(queryParts, q.createQueryPartsFromSelector(metricSelector)...)
|
queryParts = append(queryParts, q.createQueryPartsFromSelector(metricSelector)...)
|
||||||
|
|
||||||
|
if namespace != "" {
|
||||||
|
namespaceLbl, err := q.resConverter.LabelForResource(NsGroupResource)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
queryParts = append(queryParts, queryPart{
|
||||||
|
labelName: string(namespaceLbl),
|
||||||
|
values: []string{namespace},
|
||||||
|
operator: selection.Equals,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// Convert our query parts into the types we need for our template.
|
// Convert our query parts into the types we need for our template.
|
||||||
exprs, valuesByName, err := q.processQueryParts(queryParts)
|
exprs, valuesByName, err := q.processQueryParts(queryParts)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue