405 response code on updating 3rd part kind object #39737

Closed
sbezverk opened this Issue Jan 11, 2017 · 2 comments

Projects

None yet

2 participants

@sbezverk

Here is the description of the issue I am experiencing running kubernetes 1.5.1 on baremetal.
I need to update 1 value of 3rd party kind created object: here is the json of this object.

{
"kind":"MemcachedOperatorList",
"items":[
{
"apiVersion":"openstack.kolla/v1",
"description":"memcachedoperator",
"kind":"MemcachedOperator",
"metadata":
{
"name":"memcached-operator",
"namespace":"kube-system",
"selfLink":"/apis/openstack.kolla/v1/namespaces/kube-system/memcachedoperators/memcached-operator",
"uid":"a81aff33-d6ce-11e6-933f-525400d5e439",
"resourceVersion":"2983637",
"creationTimestamp":"2017-01-10T00:49:35Z"
},
"spec":
{
"port":"13131",
"service":"memcached",
"state":"deploy",
"version":"3.0.0-1"
}
}
],"metadata":{"selfLink":"/apis/openstack.kolla/v1/memcachedoperators","resourceVersion":"2984353"},"apiVersion":"openstack.kolla/v1"}

I need to update “state” field for another value. So I am using this json command:
[
{
"op": "replace", "path": "/spec/state", "value": "standby"
}
]

And then run curl:

curl -sSk --request PATCH --data "$(cat patch.json)" -H "Authorization: Bearer $KUBE_TOKEN" -H "Content-Type:application/json-patch+json"
https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_PORT_443_TCP_PORT/apis/openstack.kolla/v1/memcachedoperators

I am constantly getting 405 error. I would greatly appreciate if you could let me know your thoughts about this issue.

{
"kind": "Status",
"apiVersion": "v1",
"metadata": {},
"status": "Failure",
"message": "the server does not allow this method on the requested resource",
"reason": "MethodNotAllowed",
"details": {},
"code": 405
}curl (https://10.57.160.1:443/apis/openstack.kolla/v1/memcachedoperators): response: 405, time: 0.082, size: 229

@k82cn
Member
k82cn commented Jan 11, 2017

PATH is not supported by TPR. Try PUT with ResourceVersion is 0.

Here's my example: https://github.com/k82cn/kube-arbitrator/blob/master/pkg/util/consumer_control.go#L72 .

@sbezverk

switching to PUT and correcting path solved this issue. Thank you very much for help..

@sbezverk sbezverk closed this Jan 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment