Merge pull request #135324 from p0lyn0mial/upstream-watchlist-unsupported-wl-better-docs

client-go/reflector: Improve WatchListClient disabled log message for clarity

Kubernetes-commit: 13b10dc70fb018204a4175db96889e7811093c2c
This commit is contained in:
Kubernetes Publisher
2025-12-17 20:00:54 -08:00
4 changed files with 10 additions and 8 deletions

4
go.mod
View File

@@ -24,8 +24,8 @@ require (
golang.org/x/time v0.9.0
google.golang.org/protobuf v1.36.8
gopkg.in/evanphx/json-patch.v4 v4.13.0
k8s.io/api v0.0.0-20251218022515-cc3b8d55eb43
k8s.io/apimachinery v0.0.0-20251218022201-cec5dd05301e
k8s.io/api v0.0.0-20251218062647-56ee7b10ed3f
k8s.io/apimachinery v0.0.0-20251218062152-a9de6f8b12f4
k8s.io/klog/v2 v2.130.1
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4

8
go.sum
View File

@@ -123,10 +123,10 @@ gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/api v0.0.0-20251218022515-cc3b8d55eb43 h1:3O08UsEzuxZLokQ1JfOHBklda+NOUKTX+4mEYtaLIzA=
k8s.io/api v0.0.0-20251218022515-cc3b8d55eb43/go.mod h1:OjSG925L2Qod5yd066wDJ6HLaA8lNCJRx5eAtCw5rOM=
k8s.io/apimachinery v0.0.0-20251218022201-cec5dd05301e h1:BjYcwsSdsPnDkYoRmul2c3eZyu/31+UmlhaRIfwOZWE=
k8s.io/apimachinery v0.0.0-20251218022201-cec5dd05301e/go.mod h1:jQCgFZFR1F4Ik7hvr2g84RTJSZegBc8yHgFWKn//hns=
k8s.io/api v0.0.0-20251218062647-56ee7b10ed3f h1:N4fGyAbqjSiHraQokHH8xRlIjp/0coRsXYNKPNXo4Qc=
k8s.io/api v0.0.0-20251218062647-56ee7b10ed3f/go.mod h1:oM7eVrx5llqFChHq1g9VJGls8yBZAjmDBwTWVsN9tr4=
k8s.io/apimachinery v0.0.0-20251218062152-a9de6f8b12f4 h1:6qzElS1kwIIk7oKF6tlSLLh7bQLDZ60+J406vLzB2Wg=
k8s.io/apimachinery v0.0.0-20251218062152-a9de6f8b12f4/go.mod h1:jQCgFZFR1F4Ik7hvr2g84RTJSZegBc8yHgFWKn//hns=
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 h1:Y3gxNAuB0OBLImH611+UDZcmKS3g6CthxToOb37KgwE=

View File

@@ -302,8 +302,7 @@ func NewReflectorWithOptions(lw ListerWatcher, expectedType interface{}, store R
// Using klog.TODO() here because switching to a caller-provided contextual logger
// would require an API change and updating all existing call sites.
klog.TODO().V(2).Info(
"The provided ListWatcher doesn't support WatchList semantics. The feature will be disabled. If you are using a custom client, check the documentation of watchlist.DoesClientNotSupportWatchListSemantics() method",
"listWatcherType", fmt.Sprintf("%T", lw),
"The client used to build this informer/reflector doesn't support WatchList semantics. The feature will be disabled. This is expected in unit tests but not in production. For details, see the documentation of watchlist.DoesClientNotSupportWatchListSemantics().",
"feature", clientfeatures.WatchListClient,
)
r.useWatchList = false

View File

@@ -90,6 +90,9 @@ type unSupportedWatchListSemantics interface {
//
// A client does NOT support WatchList only if
// it implements `IsWatchListSemanticsUnSupported` and that returns true.
//
// For an explanation of how WatchList works, see:
// https://kubernetes.io/docs/reference/using-api/api-concepts/#streaming-lists
func DoesClientNotSupportWatchListSemantics(client any) bool {
lw, ok := client.(unSupportedWatchListSemantics)
if !ok {