From 89655f7d3104fdbb8f9fc53ccf76bf986b82875f Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Tue, 10 Nov 2020 16:37:52 +0100 Subject: [PATCH] fix provisioning with no immediate topology --- pkg/controller/controller.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go index f74fc2e7b..6cb51bd44 100644 --- a/pkg/controller/controller.go +++ b/pkg/controller/controller.go @@ -1336,12 +1336,13 @@ func (p *csiProvisioner) checkCapacity(ctx context.Context, claim *v1.Persistent return false, err } - // In practice, we expect exactly one entry here. But we have - // to be prepared for more than one (=> check all, success if there - // is at least one) and none (=> check once without topology). - topologies := result.req.AccessibilityRequirements.Requisite - if len(topologies) == 0 { - topologies = []*csi.Topology{nil} + // In practice, we expect exactly one entry here once a node + // has been selected. But we have to be prepared for more than + // one (=> check all, success if there is at least one) and + // none (no node selected => check once without topology). + topologies := []*csi.Topology{nil} + if result.req.AccessibilityRequirements != nil && len(result.req.AccessibilityRequirements.Requisite) > 0 { + topologies = result.req.AccessibilityRequirements.Requisite } for _, topology := range topologies { req := &csi.GetCapacityRequest{