Closed k-wall closed 5 years ago
Ack, I think you are hitting this logic bug in the underlying library https://github.com/evanphx/json-patch/issues/69.
@lucab thanks, indeed, that looks very likely to be our issue. I think https://github.com/openshift/origin/commit/6eeaa8ded2ae8537aa78f002c9916411e4392857 means that this change is already in OpenShift 4.1, is that right? (Unfortunately, I can't easily test on on 4.1 at the moment but should be able to soon).
Do you know if there is a plan to backport to 3.11?
I don't know, but someone across @deads2k @sttts @soltysh may.
@lucab yes, looks like it is fixed in 4.1 with https://github.com/openshift/origin/pull/22267.
Based on previous comment I'm going to close this issue since it's solved with the current release. /close
@soltysh: Closing this issue.
The OpenShift server side appears to be incorrectly applying valid RFC 6902 JSON PATCH documents when patching existing statefulset resources. This leads to resources in an unexpected state and in some cases, this is leading the server rejecting the request with errors such as:
io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: PATCH at: https://172.30.0.1/apis/apps/v1/namespaces/xxxxxx-infra/statefulsets/broker-mdh1f76xc7-mqv7. Message: Unable to access invalid index: 20.
We have investigated the issue, and believe the issue is the implementation of the RFC 6902
move
operation within OpenShift. Instead of inserting the moved value back into the document, OpenShift's implementation is overwriting the value at the target. This leads to an incorrect result document. Subsequent processing of following operations may also end in error, such as the one above.I believe the OpenShift implementation is not compliant with the RFC.
RFC 6092, 4.4. Move, says:
it then goes on to say:
section 4.1 defines add like this:
Version
oc v3.11.0+0cbc58b kubernetes v1.11.0+d4cacc0 features: Basic-Auth GSSAPI Kerberos SPNEGO
Server https://127.0.0.1:8443 kubernetes v1.11.0+d4cacc0
Steps To Reproduce
See: https://github.com/k-wall/rfc6902-json-patch/blob/master/README.md
I've provided a simple example. This example provides a statefulstate and a patch to mutate the environment variables of a statefulset using the following PATCH:
Current Result
B has replaced D. This is incorrect.
Expected Result
B is moved to after C.