Update NodeStatus use subresources.

This commit is contained in:
gmarek
2015-04-08 11:32:47 +02:00
parent b12d75d0ee
commit ccc56d3c3c
11 changed files with 80 additions and 17 deletions

View File

@@ -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().