kubernetes-client / python

Official Python client library for kubernetes
http://kubernetes.io/
Apache License 2.0
6.73k stars 3.26k forks source link

JSON Patch is not implemented in patch_namespaced_custom_object #2039

Closed iTaybb closed 2 weeks ago

iTaybb commented 1 year ago

What happened (please include outputs or screenshots): JSON Patch is not implemented in patch_namespaced_custom_object. When trying to pass JSON Patch lists as the body to patch_namespaced_custom_object, You'll get the following error:

<class 'kubernetes.client.exceptions.ApiException'>: (422) ││ Reason: Unprocessable Entity ││ HTTP response headers: HTTPHeaderDict({'Audit-Id': 'eb09ccb7-4389-4426-9335-5710fd4e280d', 'Cache-Control': 'no-cache, private', 'Content-Type': 'applic ││ ation/json', 'X-Kubernetes-Pf-Flowschema-Uid': 'a17bb138-39f2-47bd-9f64-afa2a8d965d9', 'X-Kubernetes-Pf-Prioritylevel-Uid': '6a07914b-de41-434d-9f5b-9fe ││ 24c420bee', 'Date': 'Mon, 10 Apr 2023 09:28:15 GMT', 'Content-Length': '842'}) ││ HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":" \"\" is invalid: patch: Invalid value: \"[{\\\"op\\\ ││ ":\\\"replace\\\",\\\"path\\\":\\\"/spec/values\\\",\\\"value\\\":8080}]\": couldn't get version/kind; json parse error: json: cannot unmarshal array in ││ to Go value of type struct { APIVersion string \"json:\\\"apiVersion,omitempty\\\"\"; Kind string \"json:\\\"kind,omitempty\\\"\" }","reason":"Invalid", ││ "details":{"causes":[{"reason":"FieldValueInvalid","message":"Invalid value: \"[{\\\"op\\\":\\\"replace\\\",\\\"path\\\":\\\"/spec/values\\\",\\\"value\ ││ \\":8080}]\": couldn't get version/kind; json parse error: json: cannot unmarshal array into Go value of type struct { APIVersion string \"json:\\\"apiV ││ ersion,omitempty\\\"\"; Kind string \"json:\\\"kind,omitempty\\\"\" }","field":"patch"}]},"code":422}

This fails because the kubernetes python module attempts to patch is as a strategic merge instead of JSONPatch. Other function, patch_namespaced_service, for example, works as expected.

Environment:

roycaihw commented 1 year ago

/assign @iTaybb

k8s-triage-robot commented 1 year ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

iTaybb commented 1 year ago

/remove-lifecycle stale

k8s-triage-robot commented 8 months ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

iTaybb commented 8 months ago

Still happens

iTaybb commented 8 months ago

/remove-lifecycle stale

k8s-triage-robot commented 5 months ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

iTaybb commented 5 months ago

/remove-lifecycle stale

k8s-triage-robot commented 2 months ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 1 month ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot commented 2 weeks ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

k8s-ci-robot commented 2 weeks ago

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to [this](https://github.com/kubernetes-client/python/issues/2039#issuecomment-2363907549): >The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. > >This bot triages issues according to the following rules: >- After 90d of inactivity, `lifecycle/stale` is applied >- After 30d of inactivity since `lifecycle/stale` was applied, `lifecycle/rotten` is applied >- After 30d of inactivity since `lifecycle/rotten` was applied, the issue is closed > >You can: >- Reopen this issue with `/reopen` >- Mark this issue as fresh with `/remove-lifecycle rotten` >- Offer to help out with [Issue Triage][1] > >Please send feedback to sig-contributor-experience at [kubernetes/community](https://github.com/kubernetes/community). > >/close not-planned > >[1]: https://www.kubernetes.dev/docs/guide/issue-triage/ Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.