On 02/09/2025 22:12, Mathias Gibbens wrote:
Source: golang-k8s-client-go
Version: 0.33.4-1
Severity: serious
Justification: FTBFS
Affects: src:prometheus
X-Debbugs-CC: Arthur Diniz <[email protected]>

   It looks like the recent update of golang-k8s-client-go is causing
prometheus to fail to build; not sure why autopkgtests didn't catch
this.

# github.com/prometheus/prometheus/discovery/kubernetes
src/github.com/prometheus/prometheus/discovery/kubernetes/kubernetes.go:862:36: 
not enough arguments in call to cache.DefaultWatchErrorHandler
         have (*"k8s.io/client-go/tools/cache".Reflector, error)
         want (context.Context, *"k8s.io/client-go/tools/cache".Reflector, 
error)

Mathias

Hello all,


The issue comes from an upstream API change in client-go.

Until v0.32.x, `DefaultWatchErrorHandler` had the signature:

    func DefaultWatchErrorHandler(r *Reflector, err error)

Starting with v0.33.0, it was changed to include a `context.Context`:

func DefaultWatchErrorHandler(ctx context.Context, r *Reflector, err error)

This change was introduced to support context-aware logging via klog.FromContext(ctx) and improved error handling.

Prometheus implementation of informerWatchErrorHandler still calls the old two-argument version, which is why the build breaks after updating.

To fix this, I updated the call site to pass a context. The patch is available to review.

https://salsa.debian.org/go-team/packages/prometheus/-/merge_requests/9

Using context.Background() restores build compatibility with client-go ≥ v0.33.0. This is the minimal change needed.

Later on, we could improve this by threading through a request-scoped context.Context so that Prometheus can take advantage of the richer structured logging now available in client-go.

This patch is therefore required for Prometheus to continue building with the latest Kubernetes client libraries.

Best regards,
Arthur Diniz


Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to