Skip to content

Instantly share code, notes, and snippets.

@anubhakushwaha
Last active April 13, 2018 08:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anubhakushwaha/2095176d8b9733be1658c42fdef0ea68 to your computer and use it in GitHub Desktop.
Save anubhakushwaha/2095176d8b9733be1658c42fdef0ea68 to your computer and use it in GitHub Desktop.
Fixing #47668 Test API error return when attempting to {POST, PUT} an object that is too large

Issue link

PR link

Github flow

Testing

Files changed

  • k8s.io/kubernetes/test/integration/master/synthetic_master_test.go

Command to test

  • make test-integration WHAT=./test/integration/master GOFLAGS="-v" KUBE_TEST_ARGS="-run ^TestObjectSizeResponses$"

New Topics/Reads

Iterations (early to last)

Tried to make that deployment really really big (fill in big annotation for example), so that the error is triggered

**Result**
* Failed to create deployment: Deployment.apps "test" is invalid: metadata.annotations : Too long : must have at most 262144 characters 
* Turned out their is already a validation on complete annotations [here](https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/validation/objectmeta.go#L57)

Tried to find out the upper limit of etcd 3 on it's value size limit

 **Result**
* The upper limit turned out to be 1MB
* got `error: 413 - Request Entity Too Large` on trying values above 1MB (10^6)

Next up the limit of etcd is known(1MB), tried to make other possible places to make the object huge.

**Result**
* So incase of `labels` there is a validation of specific label values to be <63 characters
But no upper limit on the total size of all labels combined (edited)
* So I noticed the following errors while changing the sizes :
 * request size > 1MB `etcdserver: request is too large`
 * request size > 2MB `rpc error: code = ResourceExhausted desc = grpc: trying to send message larger than max (3489421 vs.   2097152)`

Created a test in test/integration/master/synthetic_master_test.go for the labels, annotations and finalizers

#Result
* `finalizers` too have an upper limit of `253` for each value [here](https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/util/validation/validation.go#L136) but no validation on the whole string array size
* Finally the following was concluded :
    * annotations have a limit of 256kb
    * labels have individual limit of 63 characters
    * finalizers too have an individual limit of 253 characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment