mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Merge pull request #32000 from pmorie/node-update-status
Automatic merge from submit-queue Update node status instead of node in kubelet #31730 added code for the Kubelet to reconcile the existing and new nodes in order to annotate existing nodes with the annotation for controller-managed attach-detach. However, it used `Update` instead of `UpdateStatus`, which changes the operations the node's token needs to be permitted to use. Using `UpdateStatus` is functionally equivalent and maintains the same set of permissions nodes need to have today. I'm adding this with the 1.4 milestone because it is a follow-on to a 1.4 PR and fixes a downstream bug (which won't surface to Kube).
This commit is contained in:
commit
ffc12b349f
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user