added option to disable sync event creation (#8528)

* added option to disable event creation

Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>

* Re-trigger github workflows

Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>

Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
This commit is contained in:
Marcus Noble 2023-01-09 14:37:31 +00:00 committed by GitHub
parent 54dd88a5d1
commit e7bee5308e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 147 additions and 17 deletions

View file

@ -251,7 +251,8 @@ func New(
updateCh *channels.RingChannel,
disableCatchAll bool,
deepInspector bool,
icConfig *ingressclass.IngressClassConfiguration) Storer {
icConfig *ingressclass.IngressClassConfiguration,
disableSyncEvents bool) Storer {
store := &k8sStore{
informers: &Informer{},
@ -267,9 +268,11 @@ func New(
eventBroadcaster := record.NewBroadcaster()
eventBroadcaster.StartLogging(klog.Infof)
eventBroadcaster.StartRecordingToSink(&clientcorev1.EventSinkImpl{
Interface: client.CoreV1().Events(namespace),
})
if !disableSyncEvents {
eventBroadcaster.StartRecordingToSink(&clientcorev1.EventSinkImpl{
Interface: client.CoreV1().Events(namespace),
})
}
recorder := eventBroadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{
Component: "nginx-ingress-controller",
})

View file

@ -125,7 +125,8 @@ func TestStore(t *testing.T) {
updateCh,
false,
true,
DefaultClassConfig)
DefaultClassConfig,
false)
storer.Run(stopCh)
@ -206,7 +207,8 @@ func TestStore(t *testing.T) {
updateCh,
false,
true,
DefaultClassConfig)
DefaultClassConfig,
false)
storer.Run(stopCh)
ic := createIngressClass(clientSet, t, "not-k8s.io/not-ingress-nginx")
@ -310,7 +312,8 @@ func TestStore(t *testing.T) {
updateCh,
false,
true,
DefaultClassConfig)
DefaultClassConfig,
false)
storer.Run(stopCh)
validSpec := commonIngressSpec
@ -426,7 +429,8 @@ func TestStore(t *testing.T) {
updateCh,
false,
true,
ingressClassconfig)
ingressClassconfig,
false)
storer.Run(stopCh)
@ -556,7 +560,8 @@ func TestStore(t *testing.T) {
updateCh,
false,
true,
ingressClassconfig)
ingressClassconfig,
false)
storer.Run(stopCh)
validSpec := commonIngressSpec
@ -656,7 +661,8 @@ func TestStore(t *testing.T) {
updateCh,
false,
true,
DefaultClassConfig)
DefaultClassConfig,
false)
storer.Run(stopCh)
@ -750,7 +756,8 @@ func TestStore(t *testing.T) {
updateCh,
false,
true,
DefaultClassConfig)
DefaultClassConfig,
false)
storer.Run(stopCh)
invalidSpec := commonIngressSpec
@ -836,7 +843,8 @@ func TestStore(t *testing.T) {
updateCh,
false,
true,
DefaultClassConfig)
DefaultClassConfig,
false)
storer.Run(stopCh)
@ -932,7 +940,8 @@ func TestStore(t *testing.T) {
updateCh,
false,
true,
DefaultClassConfig)
DefaultClassConfig,
false)
storer.Run(stopCh)
@ -1056,7 +1065,8 @@ func TestStore(t *testing.T) {
updateCh,
false,
true,
DefaultClassConfig)
DefaultClassConfig,
false)
storer.Run(stopCh)
@ -1177,7 +1187,8 @@ func TestStore(t *testing.T) {
updateCh,
false,
true,
DefaultClassConfig)
DefaultClassConfig,
false)
storer.Run(stopCh)