Skip to content

Commit 2ffe592

Browse files
committed
Client updates due to controller-runtime
Status is now updated using SubResource methods and options Signed-off-by: Todd Short <[email protected]>
1 parent e72c306 commit 2ffe592

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Diff for: pkg/lib/controller-runtime/client/fake_ssa.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ type fakeStatusWriter struct {
3535
k8scontrollerclient.StatusWriter
3636
}
3737

38-
func (c fakeStatusWriter) Patch(ctx context.Context, obj k8scontrollerclient.Object, patch k8scontrollerclient.Patch, opts ...k8scontrollerclient.PatchOption) error {
39-
patch, opts = convertApplyToMergePatch(patch, opts...)
38+
func (c fakeStatusWriter) Patch(ctx context.Context, obj k8scontrollerclient.Object, patch k8scontrollerclient.Patch, opts ...k8scontrollerclient.SubResourcePatchOption) error {
4039
return c.StatusWriter.Patch(ctx, obj, patch, opts...)
4140
}
4241

Diff for: pkg/lib/controller-runtime/client/ssa.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,10 @@ func (c *ServerSideApplier) Apply(ctx context.Context, obj Object, changeFunc in
183183
return err
184184
}
185185

186-
if err := c.client.Status().Patch(ctx, cp, k8scontrollerclient.Apply, k8scontrollerclient.ForceOwnership, c.Owner); err != nil {
186+
pos := &k8scontrollerclient.SubResourcePatchOptions{}
187+
k8scontrollerclient.ForceOwnership.ApplyToPatch(&pos.PatchOptions)
188+
189+
if err := c.client.Status().Patch(ctx, cp, k8scontrollerclient.Apply, pos, c.Owner); err != nil {
187190
fmt.Printf("second patch error: %s\n", err)
188191
return err
189192
}

0 commit comments

Comments
 (0)