kontena / k8s-client

Ruby Kubernetes API client
Apache License 2.0
76 stars 26 forks source link

ApiClient exceptions should clear caches #82

Closed kke closed 5 years ago

kke commented 5 years ago

The find_api_resource and client_for_resource methods will raise K8s::Error::UndefinedResource when something is not found. The collections are cached indefinitely, so the error will be raised until a new client instance is created, even if the resource becomes available.

If the cache was cleared before raising the exception, then the user could do something like:

begin
  client.find_api_resource(xyz)
rescue K8s::Error::UndefinedResource
  sleep 2
  retry
end
kke commented 5 years ago

(wrong button)