Skip to content
This repository has been archived by the owner on May 16, 2020. It is now read-only.

Implement correct DeepCopyInto methods for Istio API struct types #5

Open
nrjpoddar opened this issue Aug 2, 2018 · 2 comments
Open

Comments

@nrjpoddar
Copy link
Contributor

nrjpoddar commented Aug 2, 2018

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.

@buaafanrui
Copy link

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?

@nrjpoddar
Copy link
Contributor Author

nrjpoddar commented Jul 16, 2019

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants