Skip to content

Commit

Permalink
Merge pull request #59 from atlassian-labs/vchen2/catch-instance-in-asg
Browse files Browse the repository at this point in the history
Fix if statement in transitionHealing
  • Loading branch information
vcatlassian authored Jun 16, 2023
2 parents dc722f2 + c1d3fe7 commit b18bc00
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/controller/cyclenoderequest/transitioner/transitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ func (t *CycleNodeRequestTransitioner) transitionHealing() (reconcile.Result, er
if err != nil {
return t.transitionToFailed(err)
}

if !nodeExists {
t.rm.LogEvent(t.cycleNodeRequest,
"HealingNodes", "Node does not exist, skip healing node: %s", node.Name)
Expand All @@ -533,15 +533,16 @@ func (t *CycleNodeRequestTransitioner) transitionHealing() (reconcile.Result, er

// try and re-attach the nodes, if any were un-attached
t.rm.LogEvent(t.cycleNodeRequest, "AttachingNodes", "Attaching instances to nodes group: %v", node.Name)
// if the node is already attached, ignore the error and continue to un-cordoning, otherwise return with error
alreadyAttached, err := nodeGroups.AttachInstance(node.ProviderID, node.NodeGroupName)
if err != nil && !alreadyAttached {
return t.transitionToFailed(err)
}
if alreadyAttached {
t.rm.LogEvent(t.cycleNodeRequest,
"AttachingNodes", "Skip re-attaching instances to nodes group: %v, err: %v",
node.Name, err)
}
if err != nil {
return t.transitionToFailed(err)
}

// un-cordon after attach as well
t.rm.LogEvent(t.cycleNodeRequest, "UncordoningNodes", "Uncordoning nodes in node group: %v", node.Name)
Expand Down

0 comments on commit b18bc00

Please sign in to comment.