Create patch to update DefaultWatchErrorHandler call for client-go
After bumping k8s.io/client-go
, Prometheus started failing to build in the Kubernetes discovery package.
The error looks like this:
# github.com/prometheus/prometheus/discovery/kubernetes
.../kubernetes.go:862:36: not enough arguments in call to cache.DefaultWatchErrorHandler
have (*cache.Reflector, error)
want (context.Context, *cache.Reflector, error)
The signature of cache.DefaultWatchErrorHandler
in k8s.io/client-go
changed in v0.33.0:
- Before:
func(r *cache.Reflector, err error)
- After:
func(ctx context.Context, r *cache.Reflector, err error)
Prometheus Kubernetes discovery still called the old variant, which breaks the build after bumping client-go.
This patch updates informerWatchErrorHandler
to pass a context to DefaultWatchErrorHandler
. For now, we use context.Background()
, which restores compatibility and aligns with the new function signature.
This change is required to build Prometheus with client-go >= v0.33.0.
Bug: https://bugs-devel.debian.org/cgi-bin/bugreport.cgi?bug=1113806
cc @gibmat
Edited by Arthur Diniz