From c7b7ea80439ff5d40c0a87c4226f16b38d82faf5 Mon Sep 17 00:00:00 2001 From: Nic Cope Date: Wed, 12 Aug 2020 17:09:59 -0700 Subject: [PATCH] Remove reclaim policy from composite resources See https://github.com/crossplane/crossplane-runtime/issues/179 for context. Signed-off-by: Nic Cope --- .../unstructured/composite/composite.go | 11 --------- .../unstructured/composite/composite_test.go | 24 ------------------- 2 files changed, 35 deletions(-) diff --git a/pkg/resource/unstructured/composite/composite.go b/pkg/resource/unstructured/composite/composite.go index a2fcb2f..700e9ff 100644 --- a/pkg/resource/unstructured/composite/composite.go +++ b/pkg/resource/unstructured/composite/composite.go @@ -143,17 +143,6 @@ func (c *Unstructured) SetWriteConnectionSecretToReference(ref *v1alpha1.SecretR _ = fieldpath.Pave(c.Object).SetValue("spec.writeConnectionSecretToRef", ref) } -// GetReclaimPolicy of this Composite resource. -func (c *Unstructured) GetReclaimPolicy() v1alpha1.ReclaimPolicy { - s, _ := fieldpath.Pave(c.Object).GetString("spec.reclaimPolicy") - return v1alpha1.ReclaimPolicy(s) -} - -// SetReclaimPolicy of this Composite resource. -func (c *Unstructured) SetReclaimPolicy(p v1alpha1.ReclaimPolicy) { - _ = fieldpath.Pave(c.Object).SetValue("spec.reclaimPolicy", p) -} - // GetCondition of this Composite resource. func (c *Unstructured) GetCondition(ct v1alpha1.ConditionType) v1alpha1.Condition { conditioned := v1alpha1.ConditionedStatus{} diff --git a/pkg/resource/unstructured/composite/composite_test.go b/pkg/resource/unstructured/composite/composite_test.go index 783ee2d..5d22385 100644 --- a/pkg/resource/unstructured/composite/composite_test.go +++ b/pkg/resource/unstructured/composite/composite_test.go @@ -238,27 +238,3 @@ func TestWriteConnectionSecretToReference(t *testing.T) { }) } } - -func TestReclaimPolicy(t *testing.T) { - cases := map[string]struct { - u *Unstructured - set v1alpha1.ReclaimPolicy - want v1alpha1.ReclaimPolicy - }{ - "NewRef": { - u: New(), - set: v1alpha1.ReclaimRetain, - want: v1alpha1.ReclaimRetain, - }, - } - - for name, tc := range cases { - t.Run(name, func(t *testing.T) { - tc.u.SetReclaimPolicy(tc.set) - got := tc.u.GetReclaimPolicy() - if diff := cmp.Diff(tc.want, got); diff != "" { - t.Errorf("\nu.GetReclaimPolicy(): -want, +got:\n%s", diff) - } - }) - } -}