Skip to content

Commit

Permalink
Merge pull request #2257 from justinsb/force_ownership_should_work_wi…
Browse files Browse the repository at this point in the history
…th_subresource

🐛  ForceOwnership should work with subresources
  • Loading branch information
k8s-ci-robot committed Mar 31, 2023
2 parents b2c5e38 + 6d9456b commit 60af59f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/client/options.go
Expand Up @@ -788,6 +788,11 @@ func (forceOwnership) ApplyToPatch(opts *PatchOptions) {
opts.Force = &definitelyTrue
}

func (forceOwnership) ApplyToSubResourcePatch(opts *SubResourcePatchOptions) {
definitelyTrue := true
opts.Force = &definitelyTrue
}

// }}}

// {{{ DeleteAllOf Options
Expand Down
15 changes: 15 additions & 0 deletions pkg/client/options_test.go
Expand Up @@ -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))
})
})

0 comments on commit 60af59f

Please sign in to comment.