mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 14:07:14 +00:00
add new flag for enabling requests mgmt handler
This commit is contained in:
parent
6630d7c587
commit
87d09301e5
@ -18,6 +18,7 @@ package options
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"k8s.io/apiserver/pkg/features"
|
||||||
"net"
|
"net"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -49,8 +50,9 @@ type ServerRunOptions struct {
|
|||||||
// decoded in a write request. 0 means no limit.
|
// decoded in a write request. 0 means no limit.
|
||||||
// We intentionally did not add a flag for this option. Users of the
|
// We intentionally did not add a flag for this option. Users of the
|
||||||
// apiserver library can wire it to a flag.
|
// apiserver library can wire it to a flag.
|
||||||
MaxRequestBodyBytes int64
|
MaxRequestBodyBytes int64
|
||||||
TargetRAMMB int
|
TargetRAMMB int
|
||||||
|
EnableInfightQuotaHandler bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewServerRunOptions() *ServerRunOptions {
|
func NewServerRunOptions() *ServerRunOptions {
|
||||||
@ -104,11 +106,27 @@ func (s *ServerRunOptions) Validate() []error {
|
|||||||
if s.TargetRAMMB < 0 {
|
if s.TargetRAMMB < 0 {
|
||||||
errors = append(errors, fmt.Errorf("--target-ram-mb can not be negative value"))
|
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.EnableInfightQuotaHandler {
|
||||||
}
|
if !utilfeature.DefaultFeatureGate.Enabled(features.RequestManagement) {
|
||||||
if s.MaxMutatingRequestsInFlight < 0 {
|
errors = append(errors, fmt.Errorf("--enable-inflight-quota-handler can not be set if feature "+
|
||||||
errors = append(errors, fmt.Errorf("--max-mutating-requests-inflight can not be negative value"))
|
"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 {
|
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, "+
|
"handler, which picks a randomized value above this number as the connection timeout, "+
|
||||||
"to spread out load.")
|
"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)
|
utilfeature.DefaultMutableFeatureGate.AddFlag(fs)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user