mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #106530 from FrankYang0529/sample-controller/use-update-status
feat(sample-controller): use UpdateStatus
This commit is contained in:
commit
d4c57acbb7
@ -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.
|
// 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,
|
// UpdateStatus will not allow changes to the Spec of the resource,
|
||||||
// which is ideal for ensuring nothing other than resource status has been updated.
|
// 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
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,9 +236,7 @@ func (f *fixture) expectUpdateDeploymentAction(d *apps.Deployment) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (f *fixture) expectUpdateFooStatusAction(foo *samplecontroller.Foo) {
|
func (f *fixture) expectUpdateFooStatusAction(foo *samplecontroller.Foo) {
|
||||||
action := core.NewUpdateAction(schema.GroupVersionResource{Resource: "foos"}, foo.Namespace, foo)
|
action := core.NewUpdateSubresourceAction(schema.GroupVersionResource{Resource: "foos"}, "status", foo.Namespace, foo)
|
||||||
// TODO: Until #38113 is merged, we can't use Subresource
|
|
||||||
//action.Subresource = "status"
|
|
||||||
f.actions = append(f.actions, action)
|
f.actions = append(f.actions, action)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user