Skip to content

Commit

Permalink
Merge pull request #7839 from knabben/drop-clone-template
Browse files Browse the repository at this point in the history
⚠️ Removing CloneTemplate and CloneTemplateInput
  • Loading branch information
k8s-ci-robot committed Jan 4, 2023
2 parents aebde5b + d485bbe commit 7bf3ea6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 59 deletions.
59 changes: 0 additions & 59 deletions controllers/external/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions docs/book/src/developer/providers/v1.3-to-v1.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 7bf3ea6

Please sign in to comment.