Skip to content

Commit

Permalink
Initialize node ahead in case we need to refer to it in error cases. …
Browse files Browse the repository at this point in the history
…This is a backport of kubernetes#58186. We cannot intact backport to it due to a refactor PR kubernetes#56352.
  • Loading branch information
jingax10 committed Jan 20, 2018
1 parent d5a77a4 commit 1cd74c2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/controller/node/ipam/cloud_cidr_allocator.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,14 @@ func (ca *cloudCIDRAllocator) AllocateOrOccupyCIDR(node *v1.Node) error {

// updateCIDRAllocation assigns CIDR to Node and sends an update to the API server.
func (ca *cloudCIDRAllocator) updateCIDRAllocation(nodeName string) error {
var err error
var node *v1.Node
defer ca.removeNodeFromProcessing(nodeName)

node, err := ca.nodeLister.Get(nodeName)
if err != nil {
glog.Errorf("Failed while getting node %v for updating Node.Spec.PodCIDR: %v", nodeName, err)
return err
}

cidrs, err := ca.cloud.AliasRanges(types.NodeName(nodeName))
if err != nil {
util.RecordNodeStatusChange(ca.recorder, node, "CIDRNotAvailable")
Expand Down

0 comments on commit 1cd74c2

Please sign in to comment.