diff --git a/pkg/client/options.go b/pkg/client/options.go index 7f6f5b83ff..14578f9140 100644 --- a/pkg/client/options.go +++ b/pkg/client/options.go @@ -788,6 +788,11 @@ func (forceOwnership) ApplyToPatch(opts *PatchOptions) { opts.Force = &definitelyTrue } +func (forceOwnership) ApplyToSubResourcePatch(opts *SubResourcePatchOptions) { + definitelyTrue := true + opts.Force = &definitelyTrue +} + // }}} // {{{ DeleteAllOf Options diff --git a/pkg/client/options_test.go b/pkg/client/options_test.go index 8885ca3544..fabba6bfb8 100644 --- a/pkg/client/options_test.go +++ b/pkg/client/options_test.go @@ -277,3 +277,18 @@ var _ = Describe("FieldOwner", func() { Expect(o.FieldManager).To(Equal("foo")) }) }) + +var _ = Describe("ForceOwnership", func() { + It("Should apply to PatchOptions", func() { + o := &client.PatchOptions{} + t := client.ForceOwnership + t.ApplyToPatch(o) + Expect(o.Force).To(Equal(true)) + }) + It("Should apply to SubResourcePatchOptions", func() { + o := &client.SubResourcePatchOptions{PatchOptions: client.PatchOptions{}} + t := client.ForceOwnership + t.ApplyToSubResourcePatch(o) + Expect(o.Force).To(Equal(true)) + }) +})