Skip to content

Commit 3f2934c

Browse files
committed
Client: Force ownership supports Apply
1 parent d20f30a commit 3f2934c

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

pkg/client/options.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -931,13 +931,15 @@ var ForceOwnership = forceOwnership{}
931931
type forceOwnership struct{}
932932

933933
func (forceOwnership) ApplyToPatch(opts *PatchOptions) {
934-
definitelyTrue := true
935-
opts.Force = &definitelyTrue
934+
opts.Force = ptr.To(true)
936935
}
937936

938937
func (forceOwnership) ApplyToSubResourcePatch(opts *SubResourcePatchOptions) {
939-
definitelyTrue := true
940-
opts.Force = &definitelyTrue
938+
opts.Force = ptr.To(true)
939+
}
940+
941+
func (forceOwnership) ApplyToApply(opts *ApplyOptions) {
942+
opts.Force = ptr.To(true)
941943
}
942944

943945
// }}}

pkg/client/options_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,12 @@ var _ = Describe("ForceOwnership", func() {
330330
t.ApplyToSubResourcePatch(o)
331331
Expect(*o.Force).To(BeTrue())
332332
})
333+
It("Should apply to ApplyOptions", func() {
334+
o := &client.ApplyOptions{}
335+
t := client.ForceOwnership
336+
t.ApplyToApply(o)
337+
Expect(*o.Force).To(BeTrue())
338+
})
333339
})
334340

335341
var _ = Describe("HasLabels", func() {

0 commit comments

Comments
 (0)