@@ -160,7 +160,7 @@ func (uc *unstructuredClient) List(_ context.Context, obj runtime.Object, opts .
160
160
return nil
161
161
}
162
162
163
- func (uc * unstructuredClient ) UpdateStatus (_ context.Context , obj runtime.Object ) error {
163
+ func (uc * unstructuredClient ) UpdateStatus (_ context.Context , obj runtime.Object , opts ... UpdateOptionFunc ) error {
164
164
u , ok := obj .(* unstructured.Unstructured )
165
165
if ! ok {
166
166
return fmt .Errorf ("unstructured client did not understand object: %T" , obj )
@@ -169,7 +169,30 @@ func (uc *unstructuredClient) UpdateStatus(_ context.Context, obj runtime.Object
169
169
if err != nil {
170
170
return err
171
171
}
172
- i , err := r .UpdateStatus (u , metav1.UpdateOptions {})
172
+ i , err := r .UpdateStatus (u , * (& UpdateOptions {}).ApplyOptions (opts ).AsUpdateOptions ())
173
+ if err != nil {
174
+ return err
175
+ }
176
+ u .Object = i .Object
177
+ return nil
178
+ }
179
+
180
+ func (uc * unstructuredClient ) PatchStatus (_ context.Context , obj runtime.Object , patch Patch , opts ... PatchOptionFunc ) error {
181
+ u , ok := obj .(* unstructured.Unstructured )
182
+ if ! ok {
183
+ return fmt .Errorf ("unstructured client did not understand object: %T" , obj )
184
+ }
185
+ r , err := uc .getResourceInterface (u .GroupVersionKind (), u .GetNamespace ())
186
+ if err != nil {
187
+ return err
188
+ }
189
+
190
+ data , err := patch .Data (obj )
191
+ if err != nil {
192
+ return err
193
+ }
194
+
195
+ i , err := r .Patch (u .GetName (), patch .Type (), data , * (& PatchOptions {}).ApplyOptions (opts ).AsPatchOptions (), "status" )
173
196
if err != nil {
174
197
return err
175
198
}
0 commit comments