update informer for client-go 0.27 (#6038)

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
This commit is contained in:
Chris O'Haver
2023-04-20 13:24:06 -04:00
committed by GitHub
parent 7be03b6aeb
commit 68816a42a7
5 changed files with 49 additions and 54 deletions

View File

@@ -29,7 +29,7 @@ type RecordLatencyFunc func(meta.Object)
// DefaultProcessor is based on the Process function from cache.NewIndexerInformer except it does a conversion.
func DefaultProcessor(convert ToFunc, recordLatency *EndpointLatencyRecorder) ProcessorBuilder {
return func(clientState cache.Indexer, h cache.ResourceEventHandler) cache.ProcessFunc {
return func(obj interface{}) error {
return func(obj interface{}, isInitialList bool) error {
for _, d := range obj.(cache.Deltas) {
if recordLatency != nil {
if o, ok := d.Object.(meta.Object); ok {
@@ -51,7 +51,7 @@ func DefaultProcessor(convert ToFunc, recordLatency *EndpointLatencyRecorder) Pr
if err := clientState.Add(obj); err != nil {
return err
}
h.OnAdd(obj)
h.OnAdd(obj, isInitialList)
}
if recordLatency != nil {
recordLatency.record()