Skip to content

v0.23.3 go.mod declares client-go v0.35.0 but code requires v0.36 (DoneChecker undefined with v0.35) #3508

@vivek-yadav

Description

@vivek-yadav

Summary

sigs.k8s.io/controller-runtime@v0.23.3 fails to compile against the
client-go version declared in its own go.mod.

go.mod declares:

k8s.io/client-go v0.35.0

But pkg/cache/multi_namespace_cache.go uses DoneChecker and

HasSyncedChecker which only exist in client-go v0.36:

// Line 347-349 — comment even says "added in client-go v0.36"
// HasSyncedChecker returns a DoneChecker that closes when all namespace handles have synced.
// This satisfies the ResourceEventHandlerRegistration interface added in client-go v0.36.
func (h handlerRegistration) HasSyncedChecker() toolscache.DoneChecker {

Reproduction

With client-go v0.35.x (as declared in go.mod):
pkg/cache/multi_namespace_cache.go:349:60: undefined: toolscache.DoneChecker
pkg/cache/multi_namespace_cache.go:352:38: handle.HasSyncedChecker undefined
(type "k8s.io/client-go/tools/cache".ResourceEventHandlerRegistration has
no field or method HasSyncedChecker)

With client-go v0.36.0 (what the code actually requires):

pkg/cache/multi_namespace_cache.go:363:9: cannot use handles
(variable of struct type handlerRegistration) as
"k8s.io/client-go/tools/cache".ResourceEventHandlerRegistration value:
handlerRegistration does not implement ResourceEventHandlerRegistration
(missing method HasSyncedChecker)

Expected

go.mod should declare k8s.io/client-go v0.36.0 to match the code. Or the
HasSyncedChecker / DoneChecker usage should be behind a build tag if
backwards compatibility with v0.35 is required.

Environment

  • controller-runtime: v0.23.3 (latest)
  • client-go tested: v0.35.0, v0.35.4, v0.36.0
  • Go: 1.26.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions