-
Notifications
You must be signed in to change notification settings - Fork 101
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
FederatedObject.spec.template
should have type map[string]interface{}
?
#284
Comments
How often do we need to unmarshal the template? It saves the cost of deserializing them every time federated object is updated (especially status-only updates), and it reduces memory footprint. Any benchmarks to support the argument that late deserializations are more frequent than informer deserializations? |
No benchmarks, but you do have a valid point. |
FederatedObject.spec.template
should have type map[string]interface{}
for more efficient accessFederatedObject.spec.template
should have type map[string]interface{}
?
Let's review the
For resource interpreter cases: If we support interpreter plugins written in Go, they'd better be deserialized into their native types. If we support interpreter plugins in some dynamic library or scripting language (WASM, Lua, etc, whatever), passing the object in JSON is probably the most efficient way to cross language boundaries. Allocating it into So given these use cases, the only reasonable use cases would be sync and statusaggregator, which most likely reconcile much less frequently than informer updates. |
FederatedObject.spec.template
is currently of typek8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1.JSON
which stores the raw json bytes. This type was used becausecontroller-gen
refuses to implement support formap[string]interface{}
fields for CRD generation as discussed in kubernetes-sigs/controller-tools#636. However,map[string]interface{}
would be more efficient and ergonomic as it avoids the unmarshaling whenever we need to access the template. We'd like to usemap[string]interface{}
if we can find a way to hackcontroller-gen
to generate CRDs nonetheless.We could start by looking at post-gen patches (which is already done in
config/crds/patches
). Maybe we could askcontroller-gen
to ignore thetemplate
field and let the post-gen patches add it?The text was updated successfully, but these errors were encountered: