Skip to content

Adding a limit on the size of request body the apiserver will decode for write operations - #73805

Merged
k8s-ci-robot merged 3 commits into
kubernetes:masterfrom
caesarxuchao:resource-size-limit
Feb 12, 2019
Merged

k8s-ci-robot merged 3 commits into
kubernetes:masterfrom
caesarxuchao:resource-size-limit

Conversation

@caesarxuchao

@caesarxuchao caesarxuchao commented Feb 7, 2019 •

Copy link
Copy Markdown
Contributor

The first two commits are #73713.

/assign
/kind bug-fix
/sig api-machinery
/release-note-none

This doesn't require a release note because request that fails the new limit has always been invalid. This patch just make it fail early in the apiserver REST handler, instead of after hitting etcd.

kube-apiserver: a request body of a CREATE/UPDATE/PATCH/DELETE resource operation larger than 100 MB will return a 413 "request entity too large" error.

Custom apiservers built with the latest apiserver library will have the 100MB limit on the body of resource requests as well. The limit can be altered via ServerRunOptions.MaxRequestBodyBytes.

The body size limit does not apply to subresources like pods/proxy that proxy request content to another server.

@k8s-ci-robot k8s-ci-robot added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/apiserver kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API sig/cli Categorizes an issue or PR as relevant to SIG CLI. sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Feb 7, 2019
@caesarxuchao caesarxuchao changed the title Adding a limit on resource body size apiserver will decode for write operations Adding a limit on the size of request body the apiserver will decode for write operations Feb 7, 2019
@caesarxuchao
caesarxuchao force-pushed the resource-size-limit branch 2 times, most recently from 3eecdaf to 0a1bf00 Compare February 7, 2019 18:50
@caesarxuchao
caesarxuchao force-pushed the resource-size-limit branch 2 times, most recently from 67a0765 to af17697 Compare February 7, 2019 22:44
@caesarxuchao

Copy link
Copy Markdown
Contributor Author

/unassign
/assign @liggitt

@k8s-ci-robot k8s-ci-robot assigned liggitt and unassigned caesarxuchao Feb 8, 2019

@liggitt liggitt Feb 8, 2019 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggest this instead to limit to 1MB to avoid needing 200MB in memory to run this test:

	stopCh := make(chan struct{})
	defer close(stopCh)
	clientSet, _ := framework.StartTestServer(t, stopCh, framework.TestServerSetup{
		ModifyServerRunOptions: func(opts *options.ServerRunOptions) {
			opts.GenericServerRunOptions.MaxRequestBodyBytes = 1024*1024
		},
	})

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Done.

@liggitt

liggitt commented Feb 8, 2019

Copy link
Copy Markdown
Member

one test comment, agree on matching json patch copy size

@caesarxuchao

Copy link
Copy Markdown
Contributor Author

@liggitt comments addressed. PTAL. Thank you.

@caesarxuchao

Copy link
Copy Markdown
Contributor Author

/retest

2 similar comments
@liggitt

liggitt commented Feb 9, 2019

Copy link
Copy Markdown
Member

/retest

@caesarxuchao

Copy link
Copy Markdown
Contributor Author

/retest

@liggitt

liggitt commented Feb 11, 2019

Copy link
Copy Markdown
Member

/test all

@liggitt

liggitt commented Feb 11, 2019

Copy link
Copy Markdown
Member

I think the new potential http status code is worth a release note

@liggitt

liggitt commented Feb 11, 2019

Copy link
Copy Markdown
Member

once it has a release note and the 10->100 test fixup is done, lgtm

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Feb 11, 2019
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 11, 2019
@caesarxuchao

Copy link
Copy Markdown
Contributor Author

Both done. PTAL. Thanks.

@liggitt

liggitt commented Feb 12, 2019

Copy link
Copy Markdown
Member

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 12, 2019
@liggitt

liggitt commented Feb 12, 2019

Copy link
Copy Markdown
Member

updated release note to clarify the limit only applies to resource requests, not proxy subresources like pods/proxy

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: caesarxuchao, liggitt

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 12, 2019
@k8s-ci-robot
k8s-ci-robot merged commit 2940317 into kubernetes:master Feb 12, 2019
k8s-ci-robot added a commit that referenced this pull request Feb 21, 2019
…#73443-#73713-#73805-#74000-upstream-release-1.12

Automated cherry pick of #73443: update json-patch to pick up bug fixes
k8s-ci-robot added a commit that referenced this pull request Feb 21, 2019
…#73443-#73713-#73805-#74000-upstream-release-1.13

Automated cherry pick of #73443: update json-patch to pick up bug fixes
k8s-ci-robot added a commit that referenced this pull request Feb 23, 2019
…#68428-#68442-#73443-#73713-#73805-#74000-upstream-release-1.11

Automated cherry pick of #68428: vendor: bump github.com/evanphx/json-patch
mhan8796 pushed a commit to mhan8796/kubernetes that referenced this pull request Jun 26, 2026
…imit

Adding a limit on the size of request body the apiserver will decode for write operations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/apiserver cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/cli Categorizes an issue or PR as relevant to SIG CLI. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants