istio-client-go icon indicating copy to clipboard operation
istio-client-go copied to clipboard

Implement correct DeepCopyInto methods for Istio API struct types

Open nrjpoddar opened this issue 6 years ago • 2 comments

The generated Go structs for Istio API resources are missing the DeepCopyInto methods which are needed by k8s codegen to generate client code.

A poor man's version of DeepCopyInto has been implemented in this repository like this which is more of a shallow copy than deep copy.

This might cause issues related to corruption in future.

nrjpoddar avatar Aug 02 '18 01:08 nrjpoddar

I noticed this issue when I try to use it in my project. The istio CRD definition contain interfaces and I wonder how to implement deep copy for them?

What will happen if we use current shallow copy version?

buaafanrui avatar Jul 16 '19 02:07 buaafanrui

If you’re just using this package to get resources and not mutate them then you don’t need to worry about deep or shallow copy.

If you plan to copy items from the informer cache and mutate them, then using shallow copy might cause inconsistency as you end up having two entities updating the same resource.

For enabling this functionality automatically, istio’s generated go files from proto need to add the annotations for deepcopy for all relevant structure and generate deepcopy if any need special handling.

nrjpoddar avatar Jul 16 '19 17:07 nrjpoddar