kubernetes: Kubectl patch does not support patching status of resource
Is this a BUG REPORT or FEATURE REQUEST?:
Uncomment only one, leave it on its own line:
/kind feature
What happened:
kubectl patch
does not support patching status of resource.
For instance:
kubectl -v=9 patch nodes/goodnode.abc --type='json' -p='[{"op": "add", "path": "/status/capacity/example~1foo", "value": "101"}]'
will lead to
I0816 03:03:04.224440 30621 request.go:897] Request Body: [{"op":"add","path":"/status/capacity/example~1foo","value":"101"}]
I0816 03:03:04.224485 30621 round_trippers.go:386] curl -k -v -XPATCH -H "Content-Type: application/json-patch+json" -H "Accept: application/json" -H "User-Agent: kubectl/v1.13.0 (linux/amd64) kubernetes/1ab4d89" 'https://10.11.12.13:6443/api/v1/nodes/goodnode.abc'
I0816 03:03:04.226477 30621 round_trippers.go:405] PATCH https://10.11.12.13/api/v1/nodes/goodnode.abc 200 OK in 1 milliseconds
node/goodnode.abc patched (no change)
What you expected to happen: node/goodnode.abc patched
How to reproduce it (as minimally and precisely as possible):
kubectl -v=9 patch nodes/goodnode.abc --type='json' -p='[{"op": "add", "path": "/status/capacity/example~1foo", "value": "101"}]'
will get node/goodnode.abc patched (no change)
Anything else we need to know?:
Environment:
- Kubernetes version (use
kubectl version
): v1.13.0 (i thought it should be 1.12.0 though) - Cloud provider or hardware configuration: local
- OS (e.g. from /etc/os-release): centos 7.2
- Kernel (e.g.
uname -a
): - Install tools: build from source
- Others:
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 22
- Comments: 29 (9 by maintainers)
Commits related to this issue
- [EPMDEDP-5982]: Remove status subresource section from codebasebranch CRD Patch doesn't work with this section. Related issues: https://github.com/kubernetes/kubectl/issues/564 https://github.com/ku... — committed to epam/edp-codebase-operator by deleted user 3 years ago
- [EPMDEDP-5982]: Remove status subresource section from codebasebranch CRD Bump version Patch doesn't work with this section. Related issues: https://github.com/kubernetes/kubectl/issues/564 https://g... — committed to epam/edp-codebase-operator by deleted user 3 years ago
This code works well.
Then
kubectl describe node/your-node-name
, you will see Capacity resource localpv.hello.com=100kRemoving resource is also simple
Don’t know if this is relevant for the issue, but when I tried to do something similar directly via curl
I got the same behaviour (patch “applied” but nothing changed).
When I switched to patching against the /status subresource, it suddenly worked
@jaibheem: You can’t reopen an issue/PR unless you authored it or you are a collaborator.
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
/reopen