1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00
kyverno/pkg/event/info.go
Charles-Edouard Brétéché b54e6230c5
refactor: events controller (#9236)
* refactor: make events controller shutdown graceful

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* nit

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* drain

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* refactor: events controller

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* exception

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* remove queue

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Co-authored-by: shuting <shuting@nirmata.com>
2023-12-22 11:47:22 +01:00

24 lines
507 B
Go

package event
import (
"strings"
corev1 "k8s.io/api/core/v1"
)
// Info defines the event details
type Info struct {
Regarding corev1.ObjectReference
Related *corev1.ObjectReference
Reason Reason
Message string
Action Action
Source Source
}
func (i *Info) Resource() string {
if i.Regarding.Namespace == "" {
return strings.Join([]string{i.Regarding.Kind, i.Regarding.Name}, "/")
}
return strings.Join([]string{i.Regarding.Kind, i.Regarding.Namespace, i.Regarding.Name}, "/")
}