-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalidate API resources cache #256
Comments
I noticed this kubectl behaviour aswell. If i apply a new CRD kubectls auto-completion only works after some minutes or if i interact with those crds for example with Edit: iirc kubectl does not do this. If you create a new CRD with kubectl, the cache does not get invalidated. Its your choice if kr8s should be a little "smarter" or tied to the kubectl design. |
Oh interesting, when I was poking around the |
Can I work with this one? If yes, here's a question about this issue: | When we fail to look up foo we need to invalidate the cache and try again. Is there any way to differentiate a look-up failure due to a new CRD instead of a resource that actually does not exist? I think the latter is what happens the most and it would be a bit of time and network resource waste to look-up again something that actually does not exist |
Sure that would be great. The way the Go client implements this is to have a function that looks up a resource. Then within that function, it first tries to look that up in the cache only, if it isn't found then it invalidates the cache and tries again. We might want to go down the same road of encapsulating the lookup logic into a single function where we can control the cache more directly. |
In #254 I added a cache for API resources to mimic the behaviour of
kubectl
. However it looks likekubectl
invalidates the cache if you request a resource not contained in the cache and tries again.Reproducible steps:
kr8s.get("po")
# Populates the cache and lists podsfoo
and a kr8s class for itkr8s.get("foo")
# Will not find it because "foo" is not in the cacheWhen we fail to look up
foo
we need to invalidate the cache and try again.The text was updated successfully, but these errors were encountered: