Skip to content

Commit

Permalink
Merge pull request kubernetes#125591 from p0lyn0mial/upstream-promote…
Browse files Browse the repository at this point in the history
…-watch-list-to-beta

Promote WatchList feature to Beta
  • Loading branch information
k8s-ci-robot committed Jul 1, 2024
2 parents 2e39a55 + 8250916 commit d729af9
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
13 changes: 13 additions & 0 deletions cmd/kube-controller-manager/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
utilerrors "k8s.io/apimachinery/pkg/util/errors"
apiserveroptions "k8s.io/apiserver/pkg/server/options"
utilfeature "k8s.io/apiserver/pkg/util/feature"
clientgofeaturegate "k8s.io/client-go/features"
clientset "k8s.io/client-go/kubernetes"
clientgokubescheme "k8s.io/client-go/kubernetes/scheme"
restclient "k8s.io/client-go/rest"
Expand All @@ -33,10 +34,12 @@ import (
cpnames "k8s.io/cloud-provider/names"
cpoptions "k8s.io/cloud-provider/options"
cliflag "k8s.io/component-base/cli/flag"
"k8s.io/component-base/featuregate"
"k8s.io/component-base/logs"
logsapi "k8s.io/component-base/logs/api/v1"
"k8s.io/component-base/metrics"
cmoptions "k8s.io/controller-manager/options"
"k8s.io/klog/v2"
kubectrlmgrconfigv1alpha1 "k8s.io/kube-controller-manager/config/v1alpha1"
kubecontrollerconfig "k8s.io/kubernetes/cmd/kube-controller-manager/app/config"
"k8s.io/kubernetes/cmd/kube-controller-manager/names"
Expand Down Expand Up @@ -273,6 +276,16 @@ func (s *KubeControllerManagerOptions) Flags(allControllers []string, disabledBy
fs := fss.FlagSet("misc")
fs.StringVar(&s.Master, "master", s.Master, "The address of the Kubernetes API server (overrides any value in kubeconfig).")
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).")

if !utilfeature.DefaultFeatureGate.Enabled(featuregate.Feature(clientgofeaturegate.WatchListClient)) {
if err := utilfeature.DefaultMutableFeatureGate.OverrideDefault(featuregate.Feature(clientgofeaturegate.WatchListClient), true); err != nil {
// it turns out that there are some integration tests that start multiple control plane components which
// share global DefaultFeatureGate/DefaultMutableFeatureGate variables.
// in those cases, the above call will fail (FG already registered and cannot be overridden), and the error will be logged.
klog.Errorf("unable to set %s feature gate, err: %v", clientgofeaturegate.WatchListClient, err)
}
}

utilfeature.DefaultMutableFeatureGate.AddFlag(fss.FlagSet("generic"))

return fss
Expand Down
6 changes: 3 additions & 3 deletions cmd/kube-controller-manager/app/options/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1355,8 +1355,8 @@ func TestWatchListClientFlagChange(t *testing.T) {

func assertWatchListClientFeatureDefaultValue(t *testing.T) {
watchListClientDefaultValue := clientgofeaturegate.FeatureGates().Enabled(clientgofeaturegate.WatchListClient)
if watchListClientDefaultValue {
t.Fatalf("expected %q feature gate to be disabled for KCM", clientgofeaturegate.WatchListClient)
if !watchListClientDefaultValue {
t.Fatalf("expected %q feature gate to be enabled for KCM", clientgofeaturegate.WatchListClient)
}
}

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

expectedWatchListClientString := "WatchListClient=true|false (BETA - default=false)"
expectedWatchListClientString := "WatchListClient=true|false (BETA - default=true)"
if !strings.Contains(fg.Usage, expectedWatchListClientString) {
t.Fatalf("%q flag doesn't contain the expected usage for %v feature gate.\nExpected = %v\nUsage = %v", fgFlagName, clientgofeaturegate.WatchListClient, expectedWatchListClientString, fg.Usage)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/features/kube_features.go
Original file line number Diff line number Diff line change
Expand Up @@ -1277,7 +1277,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS

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

genericfeatures.WatchList: {Default: false, PreRelease: featuregate.Alpha},
genericfeatures.WatchList: {Default: true, PreRelease: featuregate.Beta},

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

Expand Down
3 changes: 2 additions & 1 deletion staging/src/k8s.io/apiserver/pkg/features/kube_features.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ const (

// owner: @p0lyn0mial
// alpha: v1.27
// beta: v1.31
//
// Allow the API server to stream individual items instead of chunking
WatchList featuregate.Feature = "WatchList"
Expand Down Expand Up @@ -411,7 +412,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS

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

WatchList: {Default: false, PreRelease: featuregate.Alpha},
WatchList: {Default: true, PreRelease: featuregate.Beta},

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

Expand Down
3 changes: 1 addition & 2 deletions test/e2e/apimachinery/watchlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@ import (
"k8s.io/client-go/util/consistencydetector"
"k8s.io/component-base/featuregate"
featuregatetesting "k8s.io/component-base/featuregate/testing"
"k8s.io/kubernetes/test/e2e/feature"
"k8s.io/kubernetes/test/e2e/framework"
)

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

0 comments on commit d729af9

Please sign in to comment.