Merge pull request #76413 from yue9944882/chore/feature-gates
Add feature gates for switching between the legacy inflight limiting Kubernetes-commit: ca0c44641feadbd184da2e347d06db6b4163875d
This commit is contained in:
commit
b100d17e16
|
|
@ -412,7 +412,7 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery",
|
||||
"Rev": "fc07cf114ac6"
|
||||
"Rev": "b789a6e6b31f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/client-go",
|
||||
|
|
|
|||
2
go.mod
2
go.mod
|
|
@ -77,7 +77,7 @@ replace (
|
|||
golang.org/x/sys => golang.org/x/sys v0.0.0-20190209173611-3b5209105503
|
||||
golang.org/x/tools => golang.org/x/tools v0.0.0-20190313210603-aa82965741a9
|
||||
k8s.io/api => k8s.io/api v0.0.0-20190417212520-7b2abe144378
|
||||
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20190417212420-fc07cf114ac6
|
||||
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20190417212420-b789a6e6b31f
|
||||
k8s.io/client-go => k8s.io/client-go v0.0.0-20190417212702-c34bf9c3f770
|
||||
k8s.io/component-base => k8s.io/component-base v0.0.0-20190417213031-bb689512437e
|
||||
)
|
||||
|
|
|
|||
2
go.sum
2
go.sum
|
|
@ -199,7 +199,7 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|||
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
|
||||
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
|
||||
k8s.io/api v0.0.0-20190417212520-7b2abe144378/go.mod h1:C9rD35vQ+H57xuIvBjlKRx1UhjSMJJ8ryh07Gout5Hw=
|
||||
k8s.io/apimachinery v0.0.0-20190417212420-fc07cf114ac6/go.mod h1:Ekkrd71Lo8MTNt3kCL62O6C15SeTtNF+gs4PD7R9pFk=
|
||||
k8s.io/apimachinery v0.0.0-20190417212420-b789a6e6b31f/go.mod h1:Ekkrd71Lo8MTNt3kCL62O6C15SeTtNF+gs4PD7R9pFk=
|
||||
k8s.io/client-go v0.0.0-20190417212702-c34bf9c3f770/go.mod h1:zhhaouI/n5ht8cnc6PbYwa07gA2P3FPhpOGlMBLoJHE=
|
||||
k8s.io/component-base v0.0.0-20190417213031-bb689512437e/go.mod h1:9lHSw36fLCpvaYiRx3bfsk7MaKbXsEOX6KDdoytzFiY=
|
||||
k8s.io/klog v0.0.0-20190306015804-8e90cee79f82 h1:SHucoAy7lRb+w5oC/hbXyZg+zX+Wftn6hD4tGzHCVqA=
|
||||
|
|
|
|||
|
|
@ -115,6 +115,13 @@ const (
|
|||
//
|
||||
// Enables support for watch bookmark events.
|
||||
WatchBookmark utilfeature.Feature = "WatchBookmark"
|
||||
|
||||
// owner: @MikeSpreitzer @yue9944882
|
||||
// alpha: v1.15
|
||||
//
|
||||
//
|
||||
// Enables managing request concurrency with prioritization and fairness at each server
|
||||
RequestManagement utilfeature.Feature = "RequestManagement"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
|
@ -137,4 +144,5 @@ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureS
|
|||
WinOverlay: {Default: false, PreRelease: utilfeature.Alpha},
|
||||
WinDSR: {Default: false, PreRelease: utilfeature.Alpha},
|
||||
WatchBookmark: {Default: false, PreRelease: utilfeature.Alpha},
|
||||
RequestManagement: {Default: false, PreRelease: utilfeature.Alpha},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ package options
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"k8s.io/apiserver/pkg/features"
|
||||
"net"
|
||||
"time"
|
||||
|
||||
|
|
@ -49,8 +50,9 @@ type ServerRunOptions struct {
|
|||
// decoded in a write request. 0 means no limit.
|
||||
// We intentionally did not add a flag for this option. Users of the
|
||||
// apiserver library can wire it to a flag.
|
||||
MaxRequestBodyBytes int64
|
||||
TargetRAMMB int
|
||||
MaxRequestBodyBytes int64
|
||||
TargetRAMMB int
|
||||
EnableInfightQuotaHandler bool
|
||||
}
|
||||
|
||||
func NewServerRunOptions() *ServerRunOptions {
|
||||
|
|
@ -104,11 +106,27 @@ func (s *ServerRunOptions) Validate() []error {
|
|||
if s.TargetRAMMB < 0 {
|
||||
errors = append(errors, fmt.Errorf("--target-ram-mb can not be negative value"))
|
||||
}
|
||||
if s.MaxRequestsInFlight < 0 {
|
||||
errors = append(errors, fmt.Errorf("--max-requests-inflight can not be negative value"))
|
||||
}
|
||||
if s.MaxMutatingRequestsInFlight < 0 {
|
||||
errors = append(errors, fmt.Errorf("--max-mutating-requests-inflight can not be negative value"))
|
||||
|
||||
if s.EnableInfightQuotaHandler {
|
||||
if !utilfeature.DefaultFeatureGate.Enabled(features.RequestManagement) {
|
||||
errors = append(errors, fmt.Errorf("--enable-inflight-quota-handler can not be set if feature "+
|
||||
"gate RequestManagement is disabled"))
|
||||
}
|
||||
if s.MaxMutatingRequestsInFlight != 0 {
|
||||
errors = append(errors, fmt.Errorf("--max-mutating-requests-inflight=%v "+
|
||||
"can not be set if enabled inflight quota handler", s.MaxMutatingRequestsInFlight))
|
||||
}
|
||||
if s.MaxRequestsInFlight != 0 {
|
||||
errors = append(errors, fmt.Errorf("--max-requests-inflight=%v "+
|
||||
"can not be set if enabled inflight quota handler", s.MaxRequestsInFlight))
|
||||
}
|
||||
} else {
|
||||
if s.MaxRequestsInFlight < 0 {
|
||||
errors = append(errors, fmt.Errorf("--max-requests-inflight can not be negative value"))
|
||||
}
|
||||
if s.MaxMutatingRequestsInFlight < 0 {
|
||||
errors = append(errors, fmt.Errorf("--max-mutating-requests-inflight can not be negative value"))
|
||||
}
|
||||
}
|
||||
|
||||
if s.RequestTimeout.Nanoseconds() < 0 {
|
||||
|
|
@ -174,5 +192,8 @@ func (s *ServerRunOptions) AddUniversalFlags(fs *pflag.FlagSet) {
|
|||
"handler, which picks a randomized value above this number as the connection timeout, "+
|
||||
"to spread out load.")
|
||||
|
||||
fs.BoolVar(&s.EnableInfightQuotaHandler, "enable-inflight-quota-handler", s.EnableInfightQuotaHandler, ""+
|
||||
"If true, replace the max-in-flight handler with an enhanced one that queues and dispatches with priority and fairness")
|
||||
|
||||
utilfeature.DefaultMutableFeatureGate.AddFlag(fs)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue