k0sproject / k0s

k0s - The Zero Friction Kubernetes
https://docs.k0sproject.io
Other
3.11k stars 353 forks source link

Unify view of the world for the fake clients #4675

Open twz123 opened 5 days ago

twz123 commented 5 days ago

Description

In order for the typed clients to share the same view of the world as the dynamic client, they all must share the same (wrapped) object tracker. Create typed clients using the dynamic client's object tracker and transform between typed and unstructured objects.

Use the auto-generated runtime schemes in the fake discovery client. The client is usually auto-detecting the list types from the scheme. By not passing a new, empty scheme, but the default scheme, there's no longer the need to manually manage the item to list type map. Support API resource discovery by taking all the GVKs out of the scheme and convert those to some API resource lists to be added to the discovery client. The conversion is just a best guess, but will suffice for testing needs.

Type of change

How Has This Been Tested?

Checklist: