Update NodeStatus use subresources.
This commit is contained in:
@@ -35,6 +35,7 @@ type NodeInterface interface {
|
||||
List(selector labels.Selector) (*api.NodeList, error)
|
||||
Delete(name string) error
|
||||
Update(*api.Node) (*api.Node, error)
|
||||
UpdateStatus(*api.Node) (*api.Node, error)
|
||||
Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
|
||||
}
|
||||
|
||||
@@ -94,6 +95,16 @@ func (c *nodes) Update(node *api.Node) (*api.Node, error) {
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (c *nodes) UpdateStatus(node *api.Node) (*api.Node, error) {
|
||||
result := &api.Node{}
|
||||
if len(node.ResourceVersion) == 0 {
|
||||
err := fmt.Errorf("invalid update object, missing resource version: %v", node)
|
||||
return nil, err
|
||||
}
|
||||
err := c.r.Put().Resource(c.resourceName()).Name(node.Name).SubResource("status").Body(node).Do().Into(result)
|
||||
return result, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested nodes.
|
||||
func (c *nodes) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) {
|
||||
return c.r.Get().
|
||||
|
Reference in New Issue
Block a user