Remove `create_or_update_` in favour of `update_` in KubeClient
Summary
When creating or updating Kubernetes resources via KubeClient we use a pattern which first checks if the resource exists, followed by calling create_[resource]
or update_[resource]
based on the result of the initial request.
As shown in this thread, just a single update_[resource]
call will have the same effect, and will also remove an unnecessary request to the cluster.
Update (2020-05-05): As discovered in !29010 (comment 330693659):
it turns out this behaviour does not in fact work for all types of resource! I found a couple of old discussions in https://github.com/kubernetes/community/issues/876 and https://github.com/kubernetes/kubernetes/issues/2114 where others had observed the same problem, and it looks like it is still unresolved.
[...] it doesn't appear to work for
Secret
orServiceAccount
resources, it seems that we can still use this approach forClusterRole
andClusterRoleBinding