tomplus / kubernetes_asyncio

Python asynchronous client library for Kubernetes http://kubernetes.io/
Apache License 2.0
364 stars 71 forks source link

Updating Role Binding with Non Existing Resource Name Gets Success Response #294

Closed haseungyeon closed 9 months ago

haseungyeon commented 11 months ago

I used replace_namespaced_role_binding, a function that updates the role binding belonging to the RbacAuthorizationV1Api api group in version 28.2.1 of kubernetes-asyncio. I entered the name of the non-existent resource as metadata.name , but there is a bug that creates a new resource with the status code 200 response, not the 404 failed response.

haseungyeon commented 11 months ago

It also occurred in runtime class, too.

tomplus commented 11 months ago

Thanks for reporting this issue.

I've checked this method using kubectl (kubectl replace -f my-rolebinding.yaml) and I've got the same results - kubectl creates a RoleBinding instead of reporting an error (resource not found). It looks like an intentional behavior or bug, it's not connected with the library. Could you report it to the Kubernetes repo?

benedikt-bartscher commented 11 months ago

for me kubernetes_asyncio also did not throw exceptions even if the Status object indicated a failure

tomplus commented 11 months ago

for me kubernetes_asyncio also did not throw exceptions even if the Status object indicated a failure

@benedikt-bartscher could you post steps to reproduce the issue? Some internal state of K8s objects are not exposed as exceptions, it's the same as we have in kubectl. You can inspect a pod in an error state without any additional errors.