mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-07 02:07:58 +00:00
Update custom-metrics-apiserver and metrics-server
This commit is contained in:
parent
4c673534f2
commit
b480e45a67
915 changed files with 63694 additions and 106514 deletions
29
vendor/k8s.io/apiserver/pkg/storage/selection_predicate.go
generated
vendored
29
vendor/k8s.io/apiserver/pkg/storage/selection_predicate.go
generated
vendored
|
|
@ -74,6 +74,7 @@ type SelectionPredicate struct {
|
|||
Label labels.Selector
|
||||
Field fields.Selector
|
||||
GetAttrs AttrFunc
|
||||
IndexLabels []string
|
||||
IndexFields []string
|
||||
Limit int64
|
||||
Continue string
|
||||
|
|
@ -128,3 +129,31 @@ func (s *SelectionPredicate) MatchesSingle() (string, bool) {
|
|||
func (s *SelectionPredicate) Empty() bool {
|
||||
return s.Label.Empty() && s.Field.Empty()
|
||||
}
|
||||
|
||||
// For any index defined by IndexFields, if a matcher can match only (a subset)
|
||||
// of objects that return <value> for a given index, a pair (<index name>, <value>)
|
||||
// wil be returned.
|
||||
func (s *SelectionPredicate) MatcherIndex() []MatchValue {
|
||||
var result []MatchValue
|
||||
for _, field := range s.IndexFields {
|
||||
if value, ok := s.Field.RequiresExactMatch(field); ok {
|
||||
result = append(result, MatchValue{IndexName: FieldIndex(field), Value: value})
|
||||
}
|
||||
}
|
||||
for _, label := range s.IndexLabels {
|
||||
if value, ok := s.Label.RequiresExactMatch(label); ok {
|
||||
result = append(result, MatchValue{IndexName: LabelIndex(label), Value: value})
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// LabelIndex add prefix for label index.
|
||||
func LabelIndex(label string) string {
|
||||
return "l:" + label
|
||||
}
|
||||
|
||||
// FiledIndex add prefix for field index.
|
||||
func FieldIndex(field string) string {
|
||||
return "f:" + field
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue