Skip to content

Commit

Permalink
Fix indefinite stuck Pending pod on a deleted node
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnylovestiramisu committed Mar 9, 2023
1 parent f1f3e83 commit 1d00341
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1404,10 +1404,14 @@ func (ctrl *ProvisionController) provisionClaimOperation(ctx context.Context, cl
if nodeName, ok := getString(claim.Annotations, annSelectedNode, annAlphaSelectedNode); ok {
if ctrl.nodeLister != nil {
selectedNode, err = ctrl.nodeLister.Get(nodeName)
// if node does not exist, remove volume.kubernetes.io/selected-node annotation
if apierrs.IsNotFound(err) {
delete(claim.Annotations, annSelectedNode)
}
} else {
selectedNode, err = ctrl.client.CoreV1().Nodes().Get(ctx, nodeName, metav1.GetOptions{}) // TODO (verult) cache Nodes
}
if err != nil {
if err != nil && !apierrs.IsNotFound(err) {
err = fmt.Errorf("failed to get target node: %v", err)
ctrl.eventRecorder.Event(claim, v1.EventTypeWarning, "ProvisioningFailed", err.Error())
return ProvisioningNoChange, err
Expand Down

0 comments on commit 1d00341

Please sign in to comment.