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
Summary
sigs.k8s.io/controller-runtime@v0.23.3fails to compile against theclient-goversion declared in its owngo.mod.go.mod declares:
k8s.io/client-go v0.35.0
But
pkg/cache/multi_namespace_cache.gousesDoneCheckerandHasSyncedCheckerwhich only exist inclient-go v0.36: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