-
Notifications
You must be signed in to change notification settings - Fork 21
chore(deps): upgrade k8s.io/client-go to v0.36.2 #326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release-2.53.5-gmp
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -857,26 +857,32 @@ func (d *Discovery) newEndpointSlicesByNodeInformer(plw *cache.ListWatch, object | |||||||||||||
| return d.mustNewSharedIndexInformer(plw, object, resyncDisabled, indexers) | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| func (d *Discovery) informerWatchErrorHandler(r *cache.Reflector, err error) { | ||||||||||||||
| func (d *Discovery) informerWatchErrorHandler(ctx context.Context, r *cache.Reflector, err error) { | ||||||||||||||
| d.metrics.failuresCount.Inc() | ||||||||||||||
| cache.DefaultWatchErrorHandler(r, err) | ||||||||||||||
| cache.DefaultWatchErrorHandler(ctx, r, err) | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| func (d *Discovery) mustNewSharedInformer(lw cache.ListerWatcher, exampleObject runtime.Object, defaultEventHandlerResyncPeriod time.Duration) cache.SharedInformer { | ||||||||||||||
| if listWatch, ok := lw.(*cache.ListWatch); ok { | ||||||||||||||
| lw = cache.ToListWatcherWithWatchListSemantics(listWatch, d.client) | ||||||||||||||
| } | ||||||||||||||
|
Comment on lines
+866
to
+868
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To prevent potential nil pointer dereferences or panics in unit tests or custom environments where
Suggested change
|
||||||||||||||
| informer := cache.NewSharedInformer(lw, exampleObject, defaultEventHandlerResyncPeriod) | ||||||||||||||
| // Invoking SetWatchErrorHandler should fail only if the informer has been started beforehand. | ||||||||||||||
| // Invoking SetWatchErrorHandlerWithContext should fail only if the informer has been started beforehand. | ||||||||||||||
| // Such a scenario would suggest an incorrect use of the API, thus the panic. | ||||||||||||||
| if err := informer.SetWatchErrorHandler(d.informerWatchErrorHandler); err != nil { | ||||||||||||||
| if err := informer.SetWatchErrorHandlerWithContext(d.informerWatchErrorHandler); err != nil { | ||||||||||||||
| panic(err) | ||||||||||||||
| } | ||||||||||||||
| return informer | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| func (d *Discovery) mustNewSharedIndexInformer(lw cache.ListerWatcher, exampleObject runtime.Object, defaultEventHandlerResyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { | ||||||||||||||
| if listWatch, ok := lw.(*cache.ListWatch); ok { | ||||||||||||||
| lw = cache.ToListWatcherWithWatchListSemantics(listWatch, d.client) | ||||||||||||||
| } | ||||||||||||||
|
Comment on lines
+879
to
+881
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To prevent potential nil pointer dereferences or panics in unit tests or custom environments where
Suggested change
|
||||||||||||||
| informer := cache.NewSharedIndexInformer(lw, exampleObject, defaultEventHandlerResyncPeriod, indexers) | ||||||||||||||
| // Invoking SetWatchErrorHandler should fail only if the informer has been started beforehand. | ||||||||||||||
| // Invoking SetWatchErrorHandlerWithContext should fail only if the informer has been started beforehand. | ||||||||||||||
| // Such a scenario would suggest an incorrect use of the API, thus the panic. | ||||||||||||||
| if err := informer.SetWatchErrorHandler(d.informerWatchErrorHandler); err != nil { | ||||||||||||||
| if err := informer.SetWatchErrorHandlerWithContext(d.informerWatchErrorHandler); err != nil { | ||||||||||||||
| panic(err) | ||||||||||||||
| } | ||||||||||||||
| return informer | ||||||||||||||
|
|
||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current implementation of
WithNameis a no-op that simply returnss. This completely discards the sub-logger names configured byclient-go(e.g.,reflector,informer), making it very difficult to identify which component produced a log message.To preserve this crucial context, we should store the logger name in the
klogGokitSinkstruct, append new names inWithName, copy the name inWithValues, and include it as a"logger"key in the log output when it is not empty. Additionally, we can optimize the slice allocations inInfoandErrorby pre-allocating the slice with the correct capacity.