(ctx context.Context, foo *samplev1alpha1.Foo, deployment *appsv1.Deployment)
| 312 | } |
| 313 | |
| 314 | func (c *Controller) updateFooStatus(ctx context.Context, foo *samplev1alpha1.Foo, deployment *appsv1.Deployment) error { |
| 315 | // NEVER modify objects from the store. It's a read-only, local cache. |
| 316 | // You can use DeepCopy() to make a deep copy of original object and modify this copy |
| 317 | // Or create a copy manually for better performance |
| 318 | fooCopy := foo.DeepCopy() |
| 319 | fooCopy.Status.AvailableReplicas = deployment.Status.AvailableReplicas |
| 320 | // If the CustomResourceSubresources feature gate is not enabled, |
| 321 | // we must use Update instead of UpdateStatus to update the Status block of the Foo resource. |
| 322 | // UpdateStatus will not allow changes to the Spec of the resource, |
| 323 | // which is ideal for ensuring nothing other than resource status has been updated. |
| 324 | _, err := c.sampleclientset.SamplecontrollerV1alpha1().Foos(foo.Namespace).UpdateStatus(ctx, fooCopy, metav1.UpdateOptions{FieldManager: FieldManager}) |
| 325 | return err |
| 326 | } |
| 327 | |
| 328 | // enqueueFoo takes a Foo resource and converts it into a namespace/name |
| 329 | // string which is then put onto the work queue. This method should *not* be |
no test coverage detected