Is there a way to generate an api for a pre-existing custom resource. #636
-
Sorry if this is a stupid question, but if I've got a pre-existing custom resource installed on the cluster, like for example an ArgoCD application -- is there a way to generate an api for that without writing out the whole struct myself if I wanted to create or modify those objects? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Yeah, that is possible. You can use one of the Api constructors with the _with suffix for dynamic types. You would have to supply it with dynamic type information typically through ApiResource (either manually or through the discovery module). There are some relevant examples on the examples folder starting with dynamic_ that would both be relevant here :-) |
Beta Was this translation helpful? Give feedback.
-
To be clear, this will let you read or write those objects, but we currently don't have a way to generate a type-safe API for CRDs. |
Beta Was this translation helpful? Give feedback.
Yeah, that is possible. You can use one of the Api constructors with the _with suffix for dynamic types. You would have to supply it with dynamic type information typically through ApiResource (either manually or through the discovery module).
There are some relevant examples on the examples folder starting with dynamic_ that would both be relevant here :-)