The following PR[1] fixes bounds checking of large JSON patches in KubeAPI server. Before that sending/applying large (1 MB) patches were not possible[2]. The PR has been already backported to the master branch [3] [1]https://github.com/kubernetes/kubernetes/pull/84963/files [2]https://github.com/kubernetes/kubernetes/issues/84908 [3]https://github.com/openshift/origin/pull/24183
In 4.2.0-0.nightly-2019-11-25-200935 env, like bug 1687691#c9, prepare >1M file and verified: for i in {1..1024}; do echo -n a >> bytes-1k.txt; done for i in {1..1034}; do cat bytes-1k.txt >> bytes-1m-more.txt; done cat > mypod-a.part << EOF { "kind": "Pod", "apiVersion": "v1", "metadata": { "name": "mypod" }, "spec": { "containers": [ { "name": "mypod", "image": "openshift/hello-openshift", "env": [ { "name": "ENV0", "value": EOF cat > mypod-b.part << EOF } ] } ] } } EOF echo -n "`cat mypod-a.part`" > mypod-a1.part echo -n ' "' >> mypod-a1.part cat bytes-1m-more.txt >> mypod-a1.part echo '"' >> mypod-a1.part cat mypod-b.part >> mypod-a1.part mv mypod-a1.part mypod-final.json ls -lh bytes-1m-more.txt -rw-rw-r--. 1 xxia qe 1.1M Nov 26 18:53 bytes-1m-more.txt oc create -f mypod-final.json pod/mypod created
From PR, verify json patch > 1M: oc create deployment hello-openshift --image=openshift/hello-openshift oc set env deployment hello-openshift ENV0=abc echo -n '[{"op": "replace", "path": "/spec/template/spec/containers/0/env/0/value", "value": "' > patch.json cat bytes-1m-more.txt >> patch-part1.json echo -n '"}]' >> patch-part1.json ls -lh patch.json -rw-rw-r--. 1 xxia qe 1.1M Nov 26 21:59 patch.json # > 1M curl -k -X PATCH https://...:6443/apis/extensions/v1beta1/namespaces/xxia-proj/deployments/hello-openshift -H "Content-Type: application/json-patch+json" -H "Authorization: Bearer $TOKEN" -d @patch.json # succeeded
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2019:3953