mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 09:22:44 +00:00
apiserver: set APF featuregate to ga
This commit is contained in:
parent
84fb7b5ce0
commit
c7fcef1875
@ -51,7 +51,7 @@ func validateTokenRequest(options *Options) []error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func validateAPIPriorityAndFairness(options *Options) []error {
|
func validateAPIPriorityAndFairness(options *Options) []error {
|
||||||
if utilfeature.DefaultFeatureGate.Enabled(genericfeatures.APIPriorityAndFairness) && options.Features.EnablePriorityAndFairness {
|
if options.Features.EnablePriorityAndFairness {
|
||||||
// If none of the following runtime config options are specified,
|
// If none of the following runtime config options are specified,
|
||||||
// APF is assumed to be turned on. The internal APF controller uses
|
// APF is assumed to be turned on. The internal APF controller uses
|
||||||
// v1 so it should be enabled.
|
// v1 so it should be enabled.
|
||||||
@ -59,7 +59,7 @@ func validateAPIPriorityAndFairness(options *Options) []error {
|
|||||||
testConfigs := []string{"flowcontrol.apiserver.k8s.io/v1", "api/ga", "api/all"} // in the order of precedence
|
testConfigs := []string{"flowcontrol.apiserver.k8s.io/v1", "api/ga", "api/all"} // in the order of precedence
|
||||||
for _, testConfig := range testConfigs {
|
for _, testConfig := range testConfigs {
|
||||||
if strings.Contains(enabledAPIString, fmt.Sprintf("%s=false", testConfig)) {
|
if strings.Contains(enabledAPIString, fmt.Sprintf("%s=false", testConfig)) {
|
||||||
return []error{fmt.Errorf("--runtime-config=%s=false conflicts with --enable-priority-and-fairness=true and --feature-gates=APIPriorityAndFairness=true", testConfig)}
|
return []error{fmt.Errorf("--runtime-config=%s=false conflicts with --enable-priority-and-fairness=true", testConfig)}
|
||||||
}
|
}
|
||||||
if strings.Contains(enabledAPIString, fmt.Sprintf("%s=true", testConfig)) {
|
if strings.Contains(enabledAPIString, fmt.Sprintf("%s=true", testConfig)) {
|
||||||
return nil
|
return nil
|
||||||
|
@ -33,7 +33,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestValidateAPIPriorityAndFairness(t *testing.T) {
|
func TestValidateAPIPriorityAndFairness(t *testing.T) {
|
||||||
const conflict = "conflicts with --enable-priority-and-fairness=true and --feature-gates=APIPriorityAndFairness=true"
|
const conflict = "conflicts with --enable-priority-and-fairness=true"
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
runtimeConfig string
|
runtimeConfig string
|
||||||
errShouldContain string
|
errShouldContain string
|
||||||
|
@ -1195,7 +1195,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
|
|||||||
|
|
||||||
genericfeatures.APIListChunking: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.32
|
genericfeatures.APIListChunking: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.32
|
||||||
|
|
||||||
genericfeatures.APIPriorityAndFairness: {Default: true, PreRelease: featuregate.Beta},
|
genericfeatures.APIPriorityAndFairness: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.31
|
||||||
|
|
||||||
genericfeatures.APIResponseCompression: {Default: true, PreRelease: featuregate.Beta},
|
genericfeatures.APIResponseCompression: {Default: true, PreRelease: featuregate.Beta},
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@ const (
|
|||||||
// owner: @MikeSpreitzer @yue9944882
|
// owner: @MikeSpreitzer @yue9944882
|
||||||
// alpha: v1.18
|
// alpha: v1.18
|
||||||
// beta: v1.20
|
// beta: v1.20
|
||||||
|
// stable: 1.29
|
||||||
//
|
//
|
||||||
// Enables managing request concurrency with prioritization and fairness at each server.
|
// Enables managing request concurrency with prioritization and fairness at each server.
|
||||||
// The FeatureGate was introduced in release 1.15 but the feature
|
// The FeatureGate was introduced in release 1.15 but the feature
|
||||||
@ -276,7 +277,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
|
|||||||
|
|
||||||
APIListChunking: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.32
|
APIListChunking: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.32
|
||||||
|
|
||||||
APIPriorityAndFairness: {Default: true, PreRelease: featuregate.Beta},
|
APIPriorityAndFairness: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.31
|
||||||
|
|
||||||
APIResponseCompression: {Default: true, PreRelease: featuregate.Beta},
|
APIResponseCompression: {Default: true, PreRelease: featuregate.Beta},
|
||||||
|
|
||||||
|
@ -1084,7 +1084,7 @@ func installAPI(s *GenericAPIServer, c *Config) {
|
|||||||
s.Handler.GoRestfulContainer.Add(s.DiscoveryGroupManager.WebService())
|
s.Handler.GoRestfulContainer.Add(s.DiscoveryGroupManager.WebService())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if c.FlowControl != nil && utilfeature.DefaultFeatureGate.Enabled(genericfeatures.APIPriorityAndFairness) {
|
if c.FlowControl != nil {
|
||||||
c.FlowControl.Install(s.Handler.NonGoRestfulMux)
|
c.FlowControl.Install(s.Handler.NonGoRestfulMux)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,9 +22,7 @@ import (
|
|||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
|
|
||||||
"k8s.io/apimachinery/pkg/runtime/serializer"
|
"k8s.io/apimachinery/pkg/runtime/serializer"
|
||||||
"k8s.io/apiserver/pkg/features"
|
|
||||||
"k8s.io/apiserver/pkg/server"
|
"k8s.io/apiserver/pkg/server"
|
||||||
"k8s.io/apiserver/pkg/util/feature"
|
|
||||||
utilflowcontrol "k8s.io/apiserver/pkg/util/flowcontrol"
|
utilflowcontrol "k8s.io/apiserver/pkg/util/flowcontrol"
|
||||||
"k8s.io/client-go/informers"
|
"k8s.io/client-go/informers"
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
@ -60,7 +58,7 @@ func (o *FeatureOptions) AddFlags(fs *pflag.FlagSet) {
|
|||||||
fs.StringVar(&o.DebugSocketPath, "debug-socket-path", o.DebugSocketPath,
|
fs.StringVar(&o.DebugSocketPath, "debug-socket-path", o.DebugSocketPath,
|
||||||
"Use an unprotected (no authn/authz) unix-domain socket for profiling with the given path")
|
"Use an unprotected (no authn/authz) unix-domain socket for profiling with the given path")
|
||||||
fs.BoolVar(&o.EnablePriorityAndFairness, "enable-priority-and-fairness", o.EnablePriorityAndFairness, ""+
|
fs.BoolVar(&o.EnablePriorityAndFairness, "enable-priority-and-fairness", o.EnablePriorityAndFairness, ""+
|
||||||
"If true and the APIPriorityAndFairness feature gate is enabled, replace the max-in-flight handler with an enhanced one that queues and dispatches with priority and fairness")
|
"If true, replace the max-in-flight handler with an enhanced one that queues and dispatches with priority and fairness")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *FeatureOptions) ApplyTo(c *server.Config, clientset kubernetes.Interface, informers informers.SharedInformerFactory) error {
|
func (o *FeatureOptions) ApplyTo(c *server.Config, clientset kubernetes.Interface, informers informers.SharedInformerFactory) error {
|
||||||
@ -72,7 +70,7 @@ func (o *FeatureOptions) ApplyTo(c *server.Config, clientset kubernetes.Interfac
|
|||||||
c.DebugSocketPath = o.DebugSocketPath
|
c.DebugSocketPath = o.DebugSocketPath
|
||||||
c.EnableContentionProfiling = o.EnableContentionProfiling
|
c.EnableContentionProfiling = o.EnableContentionProfiling
|
||||||
|
|
||||||
if o.EnablePriorityAndFairness && feature.DefaultFeatureGate.Enabled(features.APIPriorityAndFairness) {
|
if o.EnablePriorityAndFairness {
|
||||||
if c.MaxRequestsInFlight+c.MaxMutatingRequestsInFlight <= 0 {
|
if c.MaxRequestsInFlight+c.MaxMutatingRequestsInFlight <= 0 {
|
||||||
return fmt.Errorf("invalid configuration: MaxRequestsInFlight=%d and MaxMutatingRequestsInFlight=%d; they must add up to something positive", c.MaxRequestsInFlight, c.MaxMutatingRequestsInFlight)
|
return fmt.Errorf("invalid configuration: MaxRequestsInFlight=%d and MaxMutatingRequestsInFlight=%d; they must add up to something positive", c.MaxRequestsInFlight, c.MaxMutatingRequestsInFlight)
|
||||||
|
|
||||||
|
@ -31,11 +31,8 @@ import (
|
|||||||
flowcontrol "k8s.io/api/flowcontrol/v1"
|
flowcontrol "k8s.io/api/flowcontrol/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
genericfeatures "k8s.io/apiserver/pkg/features"
|
|
||||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
"k8s.io/client-go/rest"
|
"k8s.io/client-go/rest"
|
||||||
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
|
||||||
"k8s.io/kubernetes/cmd/kube-apiserver/app/options"
|
"k8s.io/kubernetes/cmd/kube-apiserver/app/options"
|
||||||
"k8s.io/kubernetes/test/integration/framework"
|
"k8s.io/kubernetes/test/integration/framework"
|
||||||
"k8s.io/kubernetes/test/utils/ktesting"
|
"k8s.io/kubernetes/test/utils/ktesting"
|
||||||
@ -71,8 +68,6 @@ func setup(t testing.TB, maxReadonlyRequestsInFlight, maxMutatingRequestsInFligh
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestPriorityLevelIsolation(t *testing.T) {
|
func TestPriorityLevelIsolation(t *testing.T) {
|
||||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.APIPriorityAndFairness, true)()
|
|
||||||
// NOTE: disabling the feature should fail the test
|
|
||||||
ctx, kubeConfig, closeFn := setup(t, 1, 1)
|
ctx, kubeConfig, closeFn := setup(t, 1, 1)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
|
@ -31,10 +31,7 @@ import (
|
|||||||
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apiserver/pkg/authorization/authorizer"
|
"k8s.io/apiserver/pkg/authorization/authorizer"
|
||||||
genericfeatures "k8s.io/apiserver/pkg/features"
|
|
||||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
|
||||||
"k8s.io/kubernetes/cmd/kube-apiserver/app/options"
|
"k8s.io/kubernetes/cmd/kube-apiserver/app/options"
|
||||||
"k8s.io/kubernetes/pkg/controlplane"
|
"k8s.io/kubernetes/pkg/controlplane"
|
||||||
"k8s.io/kubernetes/test/integration/framework"
|
"k8s.io/kubernetes/test/integration/framework"
|
||||||
@ -152,9 +149,6 @@ func TestConcurrencyIsolation(t *testing.T) {
|
|||||||
ctx, cancel := context.WithCancel(ctx)
|
ctx, cancel := context.WithCancel(ctx)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.APIPriorityAndFairness, true)()
|
|
||||||
// NOTE: disabling the feature should fail the test
|
|
||||||
|
|
||||||
_, kubeConfig, closeFn := framework.StartTestServer(ctx, t, framework.TestServerSetup{
|
_, kubeConfig, closeFn := framework.StartTestServer(ctx, t, framework.TestServerSetup{
|
||||||
ModifyServerRunOptions: func(opts *options.ServerRunOptions) {
|
ModifyServerRunOptions: func(opts *options.ServerRunOptions) {
|
||||||
// Ensure all clients are allowed to send requests.
|
// Ensure all clients are allowed to send requests.
|
||||||
|
@ -26,8 +26,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
flowcontrol "k8s.io/api/flowcontrol/v1"
|
flowcontrol "k8s.io/api/flowcontrol/v1"
|
||||||
genericfeatures "k8s.io/apiserver/pkg/features"
|
|
||||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
|
||||||
utilfc "k8s.io/apiserver/pkg/util/flowcontrol"
|
utilfc "k8s.io/apiserver/pkg/util/flowcontrol"
|
||||||
fqtesting "k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/testing"
|
fqtesting "k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/testing"
|
||||||
"k8s.io/apiserver/pkg/util/flowcontrol/metrics"
|
"k8s.io/apiserver/pkg/util/flowcontrol/metrics"
|
||||||
@ -35,7 +33,6 @@ import (
|
|||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
"k8s.io/client-go/rest"
|
"k8s.io/client-go/rest"
|
||||||
"k8s.io/client-go/tools/cache"
|
"k8s.io/client-go/tools/cache"
|
||||||
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
|
||||||
"k8s.io/utils/clock"
|
"k8s.io/utils/clock"
|
||||||
testclocks "k8s.io/utils/clock/testing"
|
testclocks "k8s.io/utils/clock/testing"
|
||||||
)
|
)
|
||||||
@ -170,7 +167,6 @@ func (ft *fightTest) evaluate(tBeforeCreate, tAfterCreate time.Time) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
func TestConfigConsumerFight(t *testing.T) {
|
func TestConfigConsumerFight(t *testing.T) {
|
||||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.APIPriorityAndFairness, true)()
|
|
||||||
_, kubeConfig, closeFn := setup(t, 100, 100)
|
_, kubeConfig, closeFn := setup(t, 100, 100)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
const teamSize = 3
|
const teamSize = 3
|
||||||
|
@ -26,17 +26,12 @@ import (
|
|||||||
machinerytypes "k8s.io/apimachinery/pkg/types"
|
machinerytypes "k8s.io/apimachinery/pkg/types"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
fcboot "k8s.io/apiserver/pkg/apis/flowcontrol/bootstrap"
|
fcboot "k8s.io/apiserver/pkg/apis/flowcontrol/bootstrap"
|
||||||
genericfeatures "k8s.io/apiserver/pkg/features"
|
|
||||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
|
||||||
flowcontrolapply "k8s.io/client-go/applyconfigurations/flowcontrol/v1"
|
flowcontrolapply "k8s.io/client-go/applyconfigurations/flowcontrol/v1"
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestConditionIsolation(t *testing.T) {
|
func TestConditionIsolation(t *testing.T) {
|
||||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.APIPriorityAndFairness, true)()
|
|
||||||
// NOTE: disabling the feature should fail the test
|
|
||||||
ctx, kubeConfig, closeFn := setup(t, 10, 10)
|
ctx, kubeConfig, closeFn := setup(t, 10, 10)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user