mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 22:46:12 +00:00
Merge pull request #5994 from dchen1107/clean
Fixed an issue on searching events by a given fieldSelector. The issue b...
This commit is contained in:
commit
f2e47a29e1
@ -146,12 +146,17 @@ func (e *events) Search(objOrRef runtime.Object) (*api.EventList, error) {
|
|||||||
if e.namespace != "" && ref.Namespace != e.namespace {
|
if e.namespace != "" && ref.Namespace != e.namespace {
|
||||||
return nil, fmt.Errorf("won't be able to find any events of namespace '%v' in namespace '%v'", ref.Namespace, e.namespace)
|
return nil, fmt.Errorf("won't be able to find any events of namespace '%v' in namespace '%v'", ref.Namespace, e.namespace)
|
||||||
}
|
}
|
||||||
|
stringRefKind := string(ref.Kind)
|
||||||
|
var refKind *string
|
||||||
|
if stringRefKind != "" {
|
||||||
|
refKind = &stringRefKind
|
||||||
|
}
|
||||||
stringRefUID := string(ref.UID)
|
stringRefUID := string(ref.UID)
|
||||||
var refUID *string
|
var refUID *string
|
||||||
if stringRefUID != "" {
|
if stringRefUID != "" {
|
||||||
refUID = &stringRefUID
|
refUID = &stringRefUID
|
||||||
}
|
}
|
||||||
fieldSelector := e.GetFieldSelector(&ref.Name, &ref.Namespace, &ref.Kind, refUID)
|
fieldSelector := e.GetFieldSelector(&ref.Name, &ref.Namespace, refKind, refUID)
|
||||||
return e.List(labels.Everything(), fieldSelector)
|
return e.List(labels.Everything(), fieldSelector)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user