@@ -36,6 +36,7 @@ import (
36
36
autoscaling_v1 "k8s.io/api/autoscaling/v1"
37
37
batch_v1 "k8s.io/api/batch/v1"
38
38
api_v1 "k8s.io/api/core/v1"
39
+ events_v1 "k8s.io/api/events/v1"
39
40
networking_v1 "k8s.io/api/networking/v1"
40
41
rbac_v1 "k8s.io/api/rbac/v1"
41
42
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -56,6 +57,7 @@ const APPS_V1 = "apps/v1"
56
57
const BATCH_V1 = "batch/v1"
57
58
const RBAC_V1 = "rbac.authorization.k8s.io/v1"
58
59
const NETWORKING_V1 = "networking.k8s.io/v1"
60
+ const EVENTS_V1 = "events.k8s.io/v1"
59
61
60
62
var serverStartTime time.Time
61
63
@@ -95,8 +97,8 @@ func Start(conf *config.Config, eventHandler handlers.Handler) {
95
97
}
96
98
97
99
// User Configured Events
98
- if conf .Resource .Event {
99
- allEventsInformer := cache .NewSharedIndexInformer (
100
+ if conf .Resource .CoreEvent {
101
+ allCoreEventsInformer := cache .NewSharedIndexInformer (
100
102
& cache.ListWatch {
101
103
ListFunc : func (options meta_v1.ListOptions ) (runtime.Object , error ) {
102
104
options .FieldSelector = ""
@@ -112,7 +114,31 @@ func Start(conf *config.Config, eventHandler handlers.Handler) {
112
114
cache.Indexers {},
113
115
)
114
116
115
- allEventsController := newResourceController (kubeClient , eventHandler , allEventsInformer , objName (api_v1.Event {}), V1 )
117
+ allCoreEventsController := newResourceController (kubeClient , eventHandler , allCoreEventsInformer , objName (api_v1.Event {}), V1 )
118
+ stopAllCoreEventsCh := make (chan struct {})
119
+ defer close (stopAllCoreEventsCh )
120
+
121
+ go allCoreEventsController .Run (stopAllCoreEventsCh )
122
+ }
123
+
124
+ if conf .Resource .Event {
125
+ allEventsInformer := cache .NewSharedIndexInformer (
126
+ & cache.ListWatch {
127
+ ListFunc : func (options meta_v1.ListOptions ) (runtime.Object , error ) {
128
+ options .FieldSelector = ""
129
+ return kubeClient .EventsV1 ().Events (conf .Namespace ).List (context .Background (), options )
130
+ },
131
+ WatchFunc : func (options meta_v1.ListOptions ) (watch.Interface , error ) {
132
+ options .FieldSelector = ""
133
+ return kubeClient .EventsV1 ().Events (conf .Namespace ).Watch (context .Background (), options )
134
+ },
135
+ },
136
+ & events_v1.Event {},
137
+ 0 , //Skip resync
138
+ cache.Indexers {},
139
+ )
140
+
141
+ allEventsController := newResourceController (kubeClient , eventHandler , allEventsInformer , objName (events_v1.Event {}), EVENTS_V1 )
116
142
stopAllEventsCh := make (chan struct {})
117
143
defer close (stopAllEventsCh )
118
144
0 commit comments