Skip to content

Commit d729af9

Browse files
authored
Merge pull request kubernetes#125591 from p0lyn0mial/upstream-promote-watch-list-to-beta
Promote WatchList feature to Beta
2 parents 2e39a55 + 8250916 commit d729af9

File tree

5 files changed

+20
-7
lines changed

5 files changed

+20
-7
lines changed

cmd/kube-controller-manager/app/options/options.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
utilerrors "k8s.io/apimachinery/pkg/util/errors"
2626
apiserveroptions "k8s.io/apiserver/pkg/server/options"
2727
utilfeature "k8s.io/apiserver/pkg/util/feature"
28+
clientgofeaturegate "k8s.io/client-go/features"
2829
clientset "k8s.io/client-go/kubernetes"
2930
clientgokubescheme "k8s.io/client-go/kubernetes/scheme"
3031
restclient "k8s.io/client-go/rest"
@@ -33,10 +34,12 @@ import (
3334
cpnames "k8s.io/cloud-provider/names"
3435
cpoptions "k8s.io/cloud-provider/options"
3536
cliflag "k8s.io/component-base/cli/flag"
37+
"k8s.io/component-base/featuregate"
3638
"k8s.io/component-base/logs"
3739
logsapi "k8s.io/component-base/logs/api/v1"
3840
"k8s.io/component-base/metrics"
3941
cmoptions "k8s.io/controller-manager/options"
42+
"k8s.io/klog/v2"
4043
kubectrlmgrconfigv1alpha1 "k8s.io/kube-controller-manager/config/v1alpha1"
4144
kubecontrollerconfig "k8s.io/kubernetes/cmd/kube-controller-manager/app/config"
4245
"k8s.io/kubernetes/cmd/kube-controller-manager/names"
@@ -273,6 +276,16 @@ func (s *KubeControllerManagerOptions) Flags(allControllers []string, disabledBy
273276
fs := fss.FlagSet("misc")
274277
fs.StringVar(&s.Master, "master", s.Master, "The address of the Kubernetes API server (overrides any value in kubeconfig).")
275278
fs.StringVar(&s.Generic.ClientConnection.Kubeconfig, "kubeconfig", s.Generic.ClientConnection.Kubeconfig, "Path to kubeconfig file with authorization and master location information (the master location can be overridden by the master flag).")
279+
280+
if !utilfeature.DefaultFeatureGate.Enabled(featuregate.Feature(clientgofeaturegate.WatchListClient)) {
281+
if err := utilfeature.DefaultMutableFeatureGate.OverrideDefault(featuregate.Feature(clientgofeaturegate.WatchListClient), true); err != nil {
282+
// it turns out that there are some integration tests that start multiple control plane components which
283+
// share global DefaultFeatureGate/DefaultMutableFeatureGate variables.
284+
// in those cases, the above call will fail (FG already registered and cannot be overridden), and the error will be logged.
285+
klog.Errorf("unable to set %s feature gate, err: %v", clientgofeaturegate.WatchListClient, err)
286+
}
287+
}
288+
276289
utilfeature.DefaultMutableFeatureGate.AddFlag(fss.FlagSet("generic"))
277290

278291
return fss

cmd/kube-controller-manager/app/options/options_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,8 +1355,8 @@ func TestWatchListClientFlagChange(t *testing.T) {
13551355

13561356
func assertWatchListClientFeatureDefaultValue(t *testing.T) {
13571357
watchListClientDefaultValue := clientgofeaturegate.FeatureGates().Enabled(clientgofeaturegate.WatchListClient)
1358-
if watchListClientDefaultValue {
1359-
t.Fatalf("expected %q feature gate to be disabled for KCM", clientgofeaturegate.WatchListClient)
1358+
if !watchListClientDefaultValue {
1359+
t.Fatalf("expected %q feature gate to be enabled for KCM", clientgofeaturegate.WatchListClient)
13601360
}
13611361
}
13621362

@@ -1367,7 +1367,7 @@ func assertWatchListCommandLineDefaultValue(t *testing.T, fs *pflag.FlagSet) {
13671367
t.Fatalf("didn't find %q flag", fgFlagName)
13681368
}
13691369

1370-
expectedWatchListClientString := "WatchListClient=true|false (BETA - default=false)"
1370+
expectedWatchListClientString := "WatchListClient=true|false (BETA - default=true)"
13711371
if !strings.Contains(fg.Usage, expectedWatchListClientString) {
13721372
t.Fatalf("%q flag doesn't contain the expected usage for %v feature gate.\nExpected = %v\nUsage = %v", fgFlagName, clientgofeaturegate.WatchListClient, expectedWatchListClientString, fg.Usage)
13731373
}

pkg/features/kube_features.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1277,7 +1277,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
12771277

12781278
genericfeatures.WatchFromStorageWithoutResourceVersion: {Default: false, PreRelease: featuregate.Beta},
12791279

1280-
genericfeatures.WatchList: {Default: false, PreRelease: featuregate.Alpha},
1280+
genericfeatures.WatchList: {Default: true, PreRelease: featuregate.Beta},
12811281

12821282
genericfeatures.ZeroLimitedNominalConcurrencyShares: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.32
12831283

staging/src/k8s.io/apiserver/pkg/features/kube_features.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ const (
305305

306306
// owner: @p0lyn0mial
307307
// alpha: v1.27
308+
// beta: v1.31
308309
//
309310
// Allow the API server to stream individual items instead of chunking
310311
WatchList featuregate.Feature = "WatchList"
@@ -411,7 +412,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
411412

412413
InPlacePodVerticalScaling: {Default: false, PreRelease: featuregate.Alpha},
413414

414-
WatchList: {Default: false, PreRelease: featuregate.Alpha},
415+
WatchList: {Default: true, PreRelease: featuregate.Beta},
415416

416417
ConsistentListFromCache: {Default: true, PreRelease: featuregate.Beta},
417418

test/e2e/apimachinery/watchlist.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,10 @@ import (
3939
"k8s.io/client-go/util/consistencydetector"
4040
"k8s.io/component-base/featuregate"
4141
featuregatetesting "k8s.io/component-base/featuregate/testing"
42-
"k8s.io/kubernetes/test/e2e/feature"
4342
"k8s.io/kubernetes/test/e2e/framework"
4443
)
4544

46-
var _ = SIGDescribe("API Streaming (aka. WatchList)", framework.WithSerial(), feature.WatchList, func() {
45+
var _ = SIGDescribe("API Streaming (aka. WatchList)", framework.WithSerial(), func() {
4746
f := framework.NewDefaultFramework("watchlist")
4847
ginkgo.It("should be requested by informers when WatchListClient is enabled", func(ctx context.Context) {
4948
featuregatetesting.SetFeatureGateDuringTest(ginkgo.GinkgoTB(), utilfeature.DefaultFeatureGate, featuregate.Feature(clientfeatures.WatchListClient), true)

0 commit comments

Comments
 (0)