Skip to content

Commit

Permalink
UPSTREAM: <carry>: openshift: Revert "Adding config for event filtering"
Browse files Browse the repository at this point in the history
This reverts commit 6601bf0. See kubernetes#2495
  • Loading branch information
enxebre authored and elmiko committed Aug 5, 2020
1 parent 333452b commit c0bc72a
Showing 1 changed file with 3 additions and 20 deletions.
23 changes: 3 additions & 20 deletions cluster-autoscaler/utils/kubernetes/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,13 @@ import (
"k8s.io/client-go/kubernetes/scheme"
v1core "k8s.io/client-go/kubernetes/typed/core/v1"
kube_record "k8s.io/client-go/tools/record"
)

const (
// Rate of refill for the event spam filter in client go
// 1 per event key per 5 minutes.
defaultQPS = 1. / 300.
// Number of events allowed per event key before rate limiting is triggered
// Has to greater than or equal to 1.
defaultBurstSize = 1
// Number of distinct event keys in the rate limiting cache.
defaultLRUCache = 8192
klog "k8s.io/klog/v2"
)

// CreateEventRecorder creates an event recorder to send custom events to Kubernetes to be recorded for targeted Kubernetes objects
func CreateEventRecorder(kubeClient clientset.Interface) kube_record.EventRecorder {
eventBroadcaster := kube_record.NewBroadcasterWithCorrelatorOptions(getCorrelationOptions())
eventBroadcaster := kube_record.NewBroadcaster()
eventBroadcaster.StartLogging(klog.V(4).Infof)
if _, isfake := kubeClient.(*fake.Clientset); !isfake {
actualSink := &v1core.EventSinkImpl{Interface: v1core.New(kubeClient.CoreV1().RESTClient()).Events("")}
// EventBroadcaster has a StartLogging() method but the throttling options from getCorrelationOptions() get applied only to
Expand All @@ -51,11 +42,3 @@ func CreateEventRecorder(kubeClient clientset.Interface) kube_record.EventRecord
}
return eventBroadcaster.NewRecorder(scheme.Scheme, clientv1.EventSource{Component: "cluster-autoscaler"})
}

func getCorrelationOptions() kube_record.CorrelatorOptions {
return kube_record.CorrelatorOptions{
QPS: defaultQPS,
BurstSize: defaultBurstSize,
LRUCacheSize: defaultLRUCache,
}
}

0 comments on commit c0bc72a

Please sign in to comment.