Skip to content

Make runtime.descriptor and v2.descriptor DeepCopyable #762

@fabianburth

Description

@fabianburth

Description
The transformation requires all data structures used in a transformation specification to be DeepCopyable.

This is because we want to reuse our existing type system for transformations. Thereby - to convert a generic transformation to a typed transformation - we have to construct a new object from a prototype.

During the prototype implementation, we noticed that v2.descriptor is not easily deep copy able (apparently, it was not sufficient to simply add the deep copy annotation). We patched this by directly implementing the DeepCopy method as an ugly workaround in the prototype.

Starting Point:
Adding the deep copy annotation to component did not work.

type Component struct {
	ComponentMeta `json:",inline"`
	RepositoryContexts []*runtime.Raw `json:"repositoryContexts"`
	Provider string `json:"provider"`
	Resources []Resource `json:"resources"`
	Sources []Source `json:"sources"`
	References []Reference `json:"componentReferences"`
}

I suspect this has something to do with the embedded ComponentMeta which already implements DeepCopy

// +k8s:deepcopy-gen=true
type ComponentMeta struct {
	ObjectMeta `json:",inline"`
	CreationTime string `json:"creationTime,omitempty"`
}

Scope

  • Find a solution to enable deep copy for v2.descriptors
  • Confirm the finding described above (DO NOT BLINDLY RELY ON THE DESCRIPTION HERE)

Done Criteria

  • Code has been reviewed by other team members
  • Analysis of existing tests (Unit and Integration)
  • Unit Tests created for new code or existing Unit Tests updated
  • Integration Test Suite updated (includes deletion of existing unnecessary Integration Test and/or creation of new ones if required)
  • Enduser Documentation updated (if applicable)
  • Internal technical Documentation created/updated (if applicable)
  • Successful demonstration in Review

Metadata

Metadata

Assignees

Labels

area/ipceiImportant Project of Common European Interestkind/tasksmall task, normally part of feature or epic

Type

No fields configured for Task.

Projects

Status
🍺 Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions