Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON Patch is not implemented in patch_namespaced_custom_object #2039

Open
iTaybb opened this issue Apr 10, 2023 · 8 comments · May be fixed by #2040
Open

JSON Patch is not implemented in patch_namespaced_custom_object #2039

iTaybb opened this issue Apr 10, 2023 · 8 comments · May be fixed by #2040
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@iTaybb
Copy link

iTaybb commented Apr 10, 2023

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:

  • Kubernetes version (kubectl version):
    Client Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.10", GitCommit:"5c1d2d4295f9b4eb12bfbf6429fdf989f2ca8a02", GitTreeState:"clean", BuildDate:"2023-01-18T19:15:31Z", GoVersion:"go1.19.5", Compiler:"gc", Platform:"linux/amd64"}
    Kustomize Version: v4.5.4
    Server Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.10+k3s1", GitCommit:"546a94e9ae1c3be6f9c0dcde32a6e6672b035bc8", GitTreeState:"clean", BuildDate:"2023-01-26T00:35:57Z", GoVersion:"go1.19.5", Compiler:"gc", Platform:"linux/amd64"}
  • OS (e.g., MacOS 10.13.6):
    Windows 11
  • Python version (python --version)
    Python 3.11.1
  • Python client version (pip list | grep kubernetes)
    kubernetes 24.2.0
@iTaybb iTaybb added the kind/bug Categorizes issue or PR as related to a bug. label Apr 10, 2023
@iTaybb iTaybb linked a pull request Apr 10, 2023 that will close this issue
@roycaihw
Copy link
Member

/assign @iTaybb

@k8s-triage-robot
Copy link

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

This bot triages un-triaged 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:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

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

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 9, 2023
@iTaybb
Copy link
Author

iTaybb commented Jul 10, 2023

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 10, 2023
@k8s-triage-robot
Copy link

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

This bot triages un-triaged 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:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

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

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 24, 2024
@iTaybb
Copy link
Author

iTaybb commented Jan 24, 2024

Still happens

@iTaybb
Copy link
Author

iTaybb commented Jan 24, 2024

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 24, 2024
@k8s-triage-robot
Copy link

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

This bot triages un-triaged 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:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

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

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 23, 2024
@iTaybb
Copy link
Author

iTaybb commented Apr 23, 2024

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants