Skip to content

Commit b8c078b

Browse files
authored
Merge pull request #1438 from DataDog/fricounet/reschedule-node-not-exist
[controller] Reschedule provisioning if node is missing
2 parents 1b71152 + 3db8770 commit b8c078b

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

pkg/controller/controller.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,10 @@ func (p *csiProvisioner) prepareProvision(ctx context.Context, claim *v1.Persist
701701
p.csiNodeLister,
702702
p.nodeLister,
703703
p.pvcNodeStore)
704-
if err != nil {
704+
if apierrors.IsNotFound(err) {
705+
// The node or CSINode object can't be found, ask the scheduler for a reschedule
706+
return nil, controller.ProvisioningReschedule, err
707+
} else if err != nil {
705708
return nil, controller.ProvisioningNoChange, fmt.Errorf("error generating accessibility requirements: %v", err)
706709
}
707710
req.AccessibilityRequirements = requirements

pkg/controller/controller_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2503,6 +2503,29 @@ func provisionTestcases() (int64, map[string]provisioningTestcase) {
25032503
expectErr: true,
25042504
expectState: controller.ProvisioningFinished,
25052505
},
2506+
"fail with selected node but node doesn't exist": {
2507+
pluginCapabilities: provisionWithTopologyCapabilities,
2508+
volOpts: controller.ProvisionOptions{
2509+
SelectedNodeName: nodeBar.Name,
2510+
StorageClass: &storagev1.StorageClass{
2511+
ObjectMeta: metav1.ObjectMeta{
2512+
Name: fakeSCName,
2513+
},
2514+
ReclaimPolicy: &deletePolicy,
2515+
Parameters: map[string]string{
2516+
"fstype": "ext3",
2517+
},
2518+
},
2519+
PVName: "test-name",
2520+
PVC: func() *v1.PersistentVolumeClaim {
2521+
claim := createFakePVC(requestedBytes)
2522+
claim.Annotations[annSelectedNode] = nodeBar.Name
2523+
return claim
2524+
}(),
2525+
},
2526+
expectErr: true,
2527+
expectState: controller.ProvisioningReschedule,
2528+
},
25062529
}
25072530
}
25082531

0 commit comments

Comments
 (0)