mirror of
https://github.com/kubernetes/sample-controller.git
synced 2026-05-19 00:00:14 +08:00
feat(sample-controller): use update status
Signed-off-by: Frank Yang <yangpoan@gmail.com> Kubernetes-commit: 01e9c80d90c5a6da8278d0785ef583e01f901c1e
This commit is contained in:
committed by
Kubernetes Publisher
parent
44e50f65ab
commit
0edb970c17
+1
-1
@@ -328,7 +328,7 @@ func (c *Controller) updateFooStatus(foo *samplev1alpha1.Foo, deployment *appsv1
|
||||
// we must use Update instead of UpdateStatus to update the Status block of the Foo resource.
|
||||
// UpdateStatus will not allow changes to the Spec of the resource,
|
||||
// which is ideal for ensuring nothing other than resource status has been updated.
|
||||
_, err := c.sampleclientset.SamplecontrollerV1alpha1().Foos(foo.Namespace).Update(context.TODO(), fooCopy, metav1.UpdateOptions{})
|
||||
_, err := c.sampleclientset.SamplecontrollerV1alpha1().Foos(foo.Namespace).UpdateStatus(context.TODO(), fooCopy, metav1.UpdateOptions{})
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user