@@ -341,11 +341,16 @@ async def lookup_kind(self, kind) -> tuple[str, str, bool]:
341341 """
342342 return await self .async_lookup_kind (kind )
343343
344- async def async_lookup_kind (self , kind ) -> tuple [str , str , bool ]:
344+ async def async_lookup_kind (
345+ self , kind , skip_cache : bool = False
346+ ) -> tuple [str , str , bool ]:
345347 """Lookup a Kubernetes resource kind."""
346348 from ._objects import parse_kind
347349
348- resources = await self .async_api_resources ()
350+ if skip_cache :
351+ resources = await self .async_api_resources_uncached ()
352+ else :
353+ resources = await self .async_api_resources ()
349354 kind , group , version = parse_kind (kind )
350355 if group :
351356 version = f"{ group } /{ version } "
@@ -367,6 +372,10 @@ async def async_lookup_kind(self, kind) -> tuple[str, str, bool]:
367372 resource ["name" ],
368373 resource ["namespaced" ],
369374 )
375+
376+ if not skip_cache :
377+ return await self .async_lookup_kind (kind , skip_cache = True )
378+
370379 raise ValueError (f"Kind { kind } not found." )
371380
372381 @contextlib .asynccontextmanager
@@ -635,6 +644,9 @@ async def api_resources(self) -> list[dict]:
635644 # https://github.com/kubernetes/cli-runtime/blob/980bedf450ab21617b33d68331786942227fe93a/pkg/genericclioptions/config_flags.go#L297
636645 @cached (TTLCache (1 , 60 * 60 * 6 ))
637646 async def async_api_resources (self ) -> list [dict ]:
647+ return await self .async_api_resources_uncached ()
648+
649+ async def async_api_resources_uncached (self ) -> list [dict ]:
638650 """Get the Kubernetes API resources."""
639651 resources = []
640652 async with self .call_api (method = "GET" , version = "" , base = "/api" ) as response :
0 commit comments