From 02f21344ac89b3cc5357db50e931f68222c187b0 Mon Sep 17 00:00:00 2001 From: Nilekh Chaudhari <1626598+nilekhc@users.noreply.github.com> Date: Thu, 4 Jan 2024 19:34:05 +0000 Subject: [PATCH] feat: implements svm controller Signed-off-by: Nilekh Chaudhari <1626598+nilekhc@users.noreply.github.com> Kubernetes-commit: 9161302e7fd3a5fb055b2f2572c6e1228240bb51 --- features/known_features.go | 7 ++++++- tools/cache/shared_informer.go | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/features/known_features.go b/features/known_features.go index 329eed72..0c972a46 100644 --- a/features/known_features.go +++ b/features/known_features.go @@ -37,6 +37,10 @@ const ( // The feature is disabled in Beta by default because // it will only be turned on for selected control plane component(s). WatchListClient Feature = "WatchListClient" + + // owner: @nilekhc + // alpha: v1.30 + InformerResourceVersion Feature = "InformerResourceVersion" ) // defaultKubernetesFeatureGates consists of all known Kubernetes-specific feature keys. @@ -45,5 +49,6 @@ const ( // After registering with the binary, the features are, by default, controllable using environment variables. // For more details, please see envVarFeatureGates implementation. var defaultKubernetesFeatureGates = map[Feature]FeatureSpec{ - WatchListClient: {Default: false, PreRelease: Beta}, + WatchListClient: {Default: false, PreRelease: Beta}, + InformerResourceVersion: {Default: false, PreRelease: Alpha}, } diff --git a/tools/cache/shared_informer.go b/tools/cache/shared_informer.go index a06df6e6..c805030b 100644 --- a/tools/cache/shared_informer.go +++ b/tools/cache/shared_informer.go @@ -31,6 +31,8 @@ import ( "k8s.io/utils/clock" "k8s.io/klog/v2" + + clientgofeaturegate "k8s.io/client-go/features" ) // SharedInformer provides eventually consistent linkage of its @@ -409,6 +411,10 @@ func (v *dummyController) HasSynced() bool { } func (v *dummyController) LastSyncResourceVersion() string { + if clientgofeaturegate.FeatureGates().Enabled(clientgofeaturegate.InformerResourceVersion) { + return v.informer.LastSyncResourceVersion() + } + return "" }