controller-runtime icon indicating copy to clipboard operation
controller-runtime copied to clipboard

note that conversion doesn't guarantee a deepcopy

Open DirectXMan12 opened this issue 6 years ago • 9 comments

The conversion interface currently doesn't say anything about deepcopy vs no deepcopy. We should take a position on this.

cc @droot

/kind documentation

DirectXMan12 avatar Jul 30 '19 22:07 DirectXMan12

The Convertible interface requires it to be a runtime.Object which implies it implements DeepCopyObject() Object. Did I miss anything?

type Convertible interface {
	runtime.Object
	ConvertTo(dst Hub) error
	ConvertFrom(src Hub) error
}

mengqiy avatar Aug 06 '19 23:08 mengqiy

@DirectXMan12 can you elaborate more on deepcopy vs no deepcopy ?

droot avatar Aug 07 '19 18:08 droot

Right, but we don't specify if ConvertTo and ConvertFrom need to call DeepCopy themselves. Can ConvertTo and ConvertFrom safely re-use pointers to data from the source object? Is it expected that anyone who calls deepcopy doesn't care what becomes of source (this is true for conversion webhooks, but we should add a note).

TL;DR: in Rust terminology, does ConvertTo take an immutable reference to self, or does it consume self?

DirectXMan12 avatar Aug 09 '19 02:08 DirectXMan12

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale

fejta-bot avatar Nov 07 '19 02:11 fejta-bot

/remove-lifecycle stale /good-first-issue

DirectXMan12 avatar Dec 03 '19 21:12 DirectXMan12

@DirectXMan12: This request has been marked as suitable for new contributors.

Please ensure the request meets the requirements listed here.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-good-first-issue command.

In response to this:

/remove-lifecycle stale /good-first-issue

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Dec 03 '19 21:12 k8s-ci-robot

/help

Need to mostly add documentation.

vincepri avatar Feb 21 '20 17:02 vincepri

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale

fejta-bot avatar May 21 '20 17:05 fejta-bot

/lifecycle frozen

vincepri avatar May 21 '20 18:05 vincepri