diff --git a/docs/cluster_spec.md b/docs/cluster_spec.md index 8b6688f2c1e23..65778090fa791 100644 --- a/docs/cluster_spec.md +++ b/docs/cluster_spec.md @@ -230,6 +230,14 @@ spec: maxRequestsInflight: 1000 ``` +The maximum number of mutating requests in flight at a given time. When the server exceeds this, it rejects requests. Zero for no limit. (default 200) + +```yaml +spec: + kubeAPIServer: + maxMutatingRequestsInflight: 450 +``` + #### runtimeConfig Keys and values here are translated into `--runtime-config` values for `kube-apiserver`, separated by commas. diff --git a/nodeup/pkg/model/kube_apiserver_test.go b/nodeup/pkg/model/kube_apiserver_test.go index 840d9f25f35d8..0b08b0139c08b 100644 --- a/nodeup/pkg/model/kube_apiserver_test.go +++ b/nodeup/pkg/model/kube_apiserver_test.go @@ -45,6 +45,12 @@ func Test_KubeAPIServer_BuildFlags(t *testing.T) { }, "--insecure-port=0 --max-requests-inflight=1000 --secure-port=0", }, + { + kops.KubeAPIServerConfig{ + MaxMutatingRequestsInflight: 900, + }, + "--insecure-port=0 --max-mutating-requests-inflight=900 --secure-port=0", + }, { kops.KubeAPIServerConfig{ InsecurePort: 8080, @@ -60,6 +66,14 @@ func Test_KubeAPIServer_BuildFlags(t *testing.T) { }, "--insecure-port=8080 --max-requests-inflight=1000 --secure-port=443", }, + { + kops.KubeAPIServerConfig{ + InsecurePort: 8080, + SecurePort: 443, + MaxMutatingRequestsInflight: 900, + }, + "--insecure-port=8080 --max-mutating-requests-inflight=900 --secure-port=443", + }, { kops.KubeAPIServerConfig{ InsecurePort: 8080, diff --git a/pkg/apis/kops/componentconfig.go b/pkg/apis/kops/componentconfig.go index 5b469925c3483..bd4aabe0631e1 100644 --- a/pkg/apis/kops/componentconfig.go +++ b/pkg/apis/kops/componentconfig.go @@ -345,6 +345,8 @@ type KubeAPIServerConfig struct { FeatureGates map[string]string `json:"featureGates,omitempty" flag:"feature-gates"` // MaxRequestsInflight The maximum number of non-mutating requests in flight at a given time. MaxRequestsInflight int32 `json:"maxRequestsInflight,omitempty" flag:"max-requests-inflight" flag-empty:"0"` + // MaxMutatingRequestsInflight The maximum number of mutating requests in flight at a given time. Defaults to 200 + MaxMutatingRequestsInflight int32 `json:"maxMutatingRequestsInflight,omitempty" flag:"max-mutating-requests-inflight" flag-empty:"0"` // EtcdQuorumRead configures the etcd-quorum-read flag, which forces consistent reads from etcd EtcdQuorumRead *bool `json:"etcdQuorumRead,omitempty" flag:"etcd-quorum-read"` diff --git a/pkg/apis/kops/v1alpha1/componentconfig.go b/pkg/apis/kops/v1alpha1/componentconfig.go index e83bfc2d44a5a..0a3631816c5f5 100644 --- a/pkg/apis/kops/v1alpha1/componentconfig.go +++ b/pkg/apis/kops/v1alpha1/componentconfig.go @@ -345,6 +345,8 @@ type KubeAPIServerConfig struct { FeatureGates map[string]string `json:"featureGates,omitempty" flag:"feature-gates"` // MaxRequestsInflight The maximum number of non-mutating requests in flight at a given time. MaxRequestsInflight int32 `json:"maxRequestsInflight,omitempty" flag:"max-requests-inflight" flag-empty:"0"` + // MaxMutatingRequestsInflight The maximum number of mutating requests in flight at a given time. Defaults to 200 + MaxMutatingRequestsInflight int32 `json:"maxMutatingRequestsInflight,omitempty" flag:"max-mutating-requests-inflight" flag-empty:"0"` // EtcdQuorumRead configures the etcd-quorum-read flag, which forces consistent reads from etcd EtcdQuorumRead *bool `json:"etcdQuorumRead,omitempty" flag:"etcd-quorum-read"` diff --git a/pkg/apis/kops/v1alpha1/zz_generated.conversion.go b/pkg/apis/kops/v1alpha1/zz_generated.conversion.go index fd7e664de668b..a637cba2d2c61 100644 --- a/pkg/apis/kops/v1alpha1/zz_generated.conversion.go +++ b/pkg/apis/kops/v1alpha1/zz_generated.conversion.go @@ -2218,6 +2218,7 @@ func autoConvert_v1alpha1_KubeAPIServerConfig_To_kops_KubeAPIServerConfig(in *Ku out.RequestheaderAllowedNames = in.RequestheaderAllowedNames out.FeatureGates = in.FeatureGates out.MaxRequestsInflight = in.MaxRequestsInflight + out.MaxMutatingRequestsInflight = in.MaxMutatingRequestsInflight out.EtcdQuorumRead = in.EtcdQuorumRead out.MinRequestTimeout = in.MinRequestTimeout return nil @@ -2289,6 +2290,7 @@ func autoConvert_kops_KubeAPIServerConfig_To_v1alpha1_KubeAPIServerConfig(in *ko out.RequestheaderAllowedNames = in.RequestheaderAllowedNames out.FeatureGates = in.FeatureGates out.MaxRequestsInflight = in.MaxRequestsInflight + out.MaxMutatingRequestsInflight = in.MaxMutatingRequestsInflight out.EtcdQuorumRead = in.EtcdQuorumRead out.MinRequestTimeout = in.MinRequestTimeout return nil diff --git a/pkg/apis/kops/v1alpha2/componentconfig.go b/pkg/apis/kops/v1alpha2/componentconfig.go index ad8a5e8251e16..cffd6b5148a4e 100644 --- a/pkg/apis/kops/v1alpha2/componentconfig.go +++ b/pkg/apis/kops/v1alpha2/componentconfig.go @@ -345,6 +345,8 @@ type KubeAPIServerConfig struct { FeatureGates map[string]string `json:"featureGates,omitempty" flag:"feature-gates"` // MaxRequestsInflight The maximum number of non-mutating requests in flight at a given time. MaxRequestsInflight int32 `json:"maxRequestsInflight,omitempty" flag:"max-requests-inflight" flag-empty:"0"` + // MaxMutatingRequestsInflight The maximum number of mutating requests in flight at a given time. Defaults to 200 + MaxMutatingRequestsInflight int32 `json:"maxMutatingRequestsInflight,omitempty" flag:"max-mutating-requests-inflight" flag-empty:"0"` // EtcdQuorumRead configures the etcd-quorum-read flag, which forces consistent reads from etcd EtcdQuorumRead *bool `json:"etcdQuorumRead,omitempty" flag:"etcd-quorum-read"` diff --git a/pkg/apis/kops/v1alpha2/zz_generated.conversion.go b/pkg/apis/kops/v1alpha2/zz_generated.conversion.go index da61915b1e094..7eb58b000f6ac 100644 --- a/pkg/apis/kops/v1alpha2/zz_generated.conversion.go +++ b/pkg/apis/kops/v1alpha2/zz_generated.conversion.go @@ -2482,6 +2482,7 @@ func autoConvert_v1alpha2_KubeAPIServerConfig_To_kops_KubeAPIServerConfig(in *Ku out.RequestheaderAllowedNames = in.RequestheaderAllowedNames out.FeatureGates = in.FeatureGates out.MaxRequestsInflight = in.MaxRequestsInflight + out.MaxMutatingRequestsInflight = in.MaxMutatingRequestsInflight out.EtcdQuorumRead = in.EtcdQuorumRead out.MinRequestTimeout = in.MinRequestTimeout return nil @@ -2553,6 +2554,7 @@ func autoConvert_kops_KubeAPIServerConfig_To_v1alpha2_KubeAPIServerConfig(in *ko out.RequestheaderAllowedNames = in.RequestheaderAllowedNames out.FeatureGates = in.FeatureGates out.MaxRequestsInflight = in.MaxRequestsInflight + out.MaxMutatingRequestsInflight = in.MaxMutatingRequestsInflight out.EtcdQuorumRead = in.EtcdQuorumRead out.MinRequestTimeout = in.MinRequestTimeout return nil