From d485bbeccb93bc48a6af5239095a8388d216552b Mon Sep 17 00:00:00 2001 From: Amim Knabben Date: Tue, 3 Jan 2023 16:42:54 -0300 Subject: [PATCH] Removing CloneTemplate and CloneTemplateInput --- controllers/external/util.go | 59 ------------------- .../src/developer/providers/v1.3-to-v1.4.md | 1 + 2 files changed, 1 insertion(+), 59 deletions(-) diff --git a/controllers/external/util.go b/controllers/external/util.go index 2d0e409cb5e0..89647454417d 100644 --- a/controllers/external/util.go +++ b/controllers/external/util.go @@ -59,65 +59,6 @@ func Delete(ctx context.Context, c client.Writer, ref *corev1.ObjectReference) e return nil } -// CloneTemplateInput is the input to CloneTemplate. -// -// Deprecated: use CreateFromTemplateInput instead. This type will be removed in a future release. -type CloneTemplateInput struct { - // Client is the controller runtime client. - Client client.Client - - // TemplateRef is a reference to the template that needs to be cloned. - TemplateRef *corev1.ObjectReference - - // Namespace is the Kubernetes namespace the cloned object should be created into. - Namespace string - - // ClusterName is the cluster this object is linked to. - ClusterName string - - // OwnerRef is an optional OwnerReference to attach to the cloned object. - // +optional - OwnerRef *metav1.OwnerReference - - // Labels is an optional map of labels to be added to the object. - // +optional - Labels map[string]string - - // Annotations is an optional map of annotations to be added to the object. - // +optional - Annotations map[string]string -} - -// CloneTemplate uses the client and the reference to create a new object from the template. -// -// Deprecated: use CreateFromTemplate instead. This function will be removed in a future release. -func CloneTemplate(ctx context.Context, in *CloneTemplateInput) (*corev1.ObjectReference, error) { - from, err := Get(ctx, in.Client, in.TemplateRef, in.Namespace) - if err != nil { - return nil, err - } - generateTemplateInput := &GenerateTemplateInput{ - Template: from, - TemplateRef: in.TemplateRef, - Namespace: in.Namespace, - ClusterName: in.ClusterName, - OwnerRef: in.OwnerRef, - Labels: in.Labels, - Annotations: in.Annotations, - } - to, err := GenerateTemplate(generateTemplateInput) - if err != nil { - return nil, err - } - - // Create the external clone. - if err := in.Client.Create(ctx, to); err != nil { - return nil, err - } - - return GetObjectReference(to), nil -} - // CreateFromTemplateInput is the input to CreateFromTemplate. type CreateFromTemplateInput struct { // Client is the controller runtime client. diff --git a/docs/book/src/developer/providers/v1.3-to-v1.4.md b/docs/book/src/developer/providers/v1.3-to-v1.4.md index 5b9e6e365a59..90c4262780cb 100644 --- a/docs/book/src/developer/providers/v1.3-to-v1.4.md +++ b/docs/book/src/developer/providers/v1.3-to-v1.4.md @@ -22,6 +22,7 @@ maintainers of providers and consumers of our Go API. - `clusterctl backup` has been removed. - `MachineHealthCheckSuccededCondition` condition type has been removed. +- `CloneTemplate` and `CloneTemplateInput` has been removed. ### API Changes