-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
✨ Refactor template cloning for future use with kubeadmcontrolplane #1959
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: detiber The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/assign @chuckha |
f035616
to
299d061
Compare
- Use CloneTemplate through an interface for easier testing - Return an ObjectReference to the cloned resource rather than the resource itself - Add tests for template cloning
299d061
to
1815a45
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh this looks super nice!
/lgtm
@@ -46,8 +49,10 @@ func Get(ctx context.Context, c client.Client, ref *corev1.ObjectReference, name | |||
return obj, nil | |||
} | |||
|
|||
type TemplateCloner struct{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to add some documentation in the v1a2->v1a3 docs about this change, given that it might be used elsewhere
// CloneTemplate uses the client and the reference to create a new object from the template. | ||
func CloneTemplate(ctx context.Context, c client.Client, ref *corev1.ObjectReference, namespace string) (*unstructured.Unstructured, error) { | ||
func (tc *TemplateCloner) CloneTemplate(ctx context.Context, c client.Client, ref *corev1.ObjectReference, namespace, clusterName string, owner *metav1.OwnerReference) (*corev1.ObjectReference, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if the list of arguments needs to be simplified in a struct in a future PR
What this PR does / why we need it: