Skip to content

Commit 7d0e020

Browse files
author
Chao Xu
committed
Loosing the request body size limit to 100MB to account for the size ratio between json and protobuf.
1 parent b20e8c8 commit 7d0e020

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

cmd/kube-apiserver/app/options/options_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ func TestAddFlags(t *testing.T) {
129129
MaxMutatingRequestsInFlight: 200,
130130
RequestTimeout: time.Duration(2) * time.Minute,
131131
MinRequestTimeout: 1800,
132-
JSONPatchMaxCopyBytes: int64(10 * 1024 * 1024),
133-
MaxRequestBodyBytes: int64(10 * 1024 * 1024),
132+
JSONPatchMaxCopyBytes: int64(100 * 1024 * 1024),
133+
MaxRequestBodyBytes: int64(100 * 1024 * 1024),
134134
},
135135
Admission: &kubeoptions.AdmissionOptions{
136136
GenericAdmission: &apiserveroptions.AdmissionOptions{

staging/src/k8s.io/apiserver/pkg/server/config.go

+12-8
Original file line numberDiff line numberDiff line change
@@ -274,17 +274,21 @@ func NewConfig(codecs serializer.CodecFactory) *Config {
274274
RequestTimeout: time.Duration(60) * time.Second,
275275
MinRequestTimeout: 1800,
276276
// 10MB is the recommended maximum client request size in bytes
277-
// the etcd server should accept. Thus, we set it as the limit
278-
// on the size increase the "copy" operations in a json patch
279-
// can cause. See
277+
// the etcd server should accept. See
280278
// https://github.com/etcd-io/etcd/blob/release-3.3/etcdserver/server.go#L90.
281-
JSONPatchMaxCopyBytes: int64(10 * 1024 * 1024),
279+
// A request body might be encoded in json, and is converted to
280+
// proto when persisted in etcd. Assuming the upper bound of
281+
// the size ratio is 10:1, we set 100MB as the largest size
282+
// increase the "copy" operations in a json patch may cause.
283+
JSONPatchMaxCopyBytes: int64(100 * 1024 * 1024),
282284
// 10MB is the recommended maximum client request size in bytes
283-
// the etcd server should accept. Thus, we set it as the
284-
// maximum bytes accepted to be decoded in a resource write
285-
// request. See
285+
// the etcd server should accept. See
286286
// https://github.com/etcd-io/etcd/blob/release-3.3/etcdserver/server.go#L90.
287-
MaxRequestBodyBytes: int64(10 * 1024 * 1024),
287+
// A request body might be encoded in json, and is converted to
288+
// proto when persisted in etcd. Assuming the upper bound of
289+
// the size ratio is 10:1, we set 100MB as the largest request
290+
// body size to be accepted and decoded in a write request.
291+
MaxRequestBodyBytes: int64(100 * 1024 * 1024),
288292
EnableAPIResponseCompression: utilfeature.DefaultFeatureGate.Enabled(features.APIResponseCompression),
289293

290294
// Default to treating watch as a long-running operation

0 commit comments

Comments
 (0)