From f6c68908ba37dbb7af602b8f88b5f395025d2384 Mon Sep 17 00:00:00 2001 From: Lukasz Szaszkiewicz Date: Mon, 10 Jun 2024 23:01:04 +0200 Subject: [PATCH] client-go/reflector: use consistencydetector.IsDataConsistencyDetectionForWatchListEnabled --- .../tools/cache/reflector_data_consistency_detector.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/staging/src/k8s.io/client-go/tools/cache/reflector_data_consistency_detector.go b/staging/src/k8s.io/client-go/tools/cache/reflector_data_consistency_detector.go index bd857de7a51..a7e0d9c4368 100644 --- a/staging/src/k8s.io/client-go/tools/cache/reflector_data_consistency_detector.go +++ b/staging/src/k8s.io/client-go/tools/cache/reflector_data_consistency_detector.go @@ -18,20 +18,12 @@ package cache import ( "context" - "os" - "strconv" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/util/consistencydetector" ) -var dataConsistencyDetectionForWatchListEnabled = false - -func init() { - dataConsistencyDetectionForWatchListEnabled, _ = strconv.ParseBool(os.Getenv("KUBE_WATCHLIST_INCONSISTENCY_DETECTOR")) -} - // checkWatchListDataConsistencyIfRequested performs a data consistency check only when // the KUBE_WATCHLIST_INCONSISTENCY_DETECTOR environment variable was set during a binary startup. // @@ -42,7 +34,7 @@ func init() { // Note that this function will panic when data inconsistency is detected. // This is intentional because we want to catch it in the CI. func checkWatchListDataConsistencyIfRequested[T runtime.Object, U any](ctx context.Context, identity string, lastSyncedResourceVersion string, listFn consistencydetector.ListFunc[T], retrieveItemsFn consistencydetector.RetrieveItemsFunc[U]) { - if !dataConsistencyDetectionForWatchListEnabled { + if !consistencydetector.IsDataConsistencyDetectionForWatchListEnabled() { return } // for informers we pass an empty ListOptions because