Update node status instead of node in kubelet

This commit is contained in:
Paul Morie 2016-09-02 16:24:39 -04:00
parent 0cdaf1028e
commit 67387632dc
2 changed files with 6 additions and 3 deletions

View File

@ -107,7 +107,7 @@ func (kl *Kubelet) tryRegisterWithApiServer(node *api.Node) bool {
// annotation.
requiresUpdate := kl.reconcileCMADAnnotationWithExistingNode(node, existingNode)
if requiresUpdate {
if _, err := kl.kubeClient.Core().Nodes().Update(existingNode); err != nil {
if _, err := kl.kubeClient.Core().Nodes().UpdateStatus(existingNode); err != nil {
glog.Errorf("Unable to reconcile node %q with API server: error updating node: %v", kl.nodeName, err)
return false
}

View File

@ -1028,8 +1028,11 @@ func TestTryRegisterWithApiServer(t *testing.T) {
// Return an existing (matching) node on get.
return true, tc.existingNode, tc.getError
})
kubeClient.AddReactor("update", "nodes", func(action core.Action) (bool, runtime.Object, error) {
return true, nil, tc.updateError
kubeClient.AddReactor("update", "*", func(action core.Action) (bool, runtime.Object, error) {
if action.GetResource().Resource == "nodes" && action.GetSubresource() == "status" {
return true, nil, tc.updateError
}
return true, nil, fmt.Errorf("no reaction implemented for %s", action)
})
kubeClient.AddReactor("delete", "nodes", func(action core.Action) (bool, runtime.Object, error) {
return true, nil, tc.deleteError