Skip to content

Commit

Permalink
Fix failing imageio test
Browse files Browse the repository at this point in the history
Always enable scratch space for imageio imports.

Signed-off-by: Alexander Wels <awels@redhat.com>
  • Loading branch information
awels committed Feb 9, 2022
1 parent 307b075 commit bee890a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions pkg/controller/import-controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,21 @@ func (r *ImportReconciler) createImporterPod(pvc *corev1.PersistentVolumeClaim)
vddkImageName: vddkImageName,
priorityClassName: getPriorityClass(pvc),
}

// Check for old terminating scratch spaces
if requiresScratch && podArgs.scratchPvcName != nil {
r.log.V(1).Info("Checking for old scratch pvcs")
scratchPvc := &corev1.PersistentVolumeClaim{}
err := r.client.Get(context.TODO(), types.NamespacedName{Namespace: pvc.GetNamespace(), Name: *podArgs.scratchPvcName}, scratchPvc)
if IgnoreNotFound(err) != nil {
return err
}
if scratchPvc.DeletionTimestamp != nil {
// Old scratch space with same name is still being cleaned up, return error.
return errors.New("Waiting for scratch space to be deleted.")
}
}

pod, err := createImporterPod(r.log, r.client, podArgs, r.installerLabels)
if err != nil {
return err
Expand Down Expand Up @@ -725,6 +740,8 @@ func (r *ImportReconciler) requiresScratchSpace(pvc *corev1.PersistentVolumeClai
switch getSource(pvc) {
case SourceGlance:
scratchRequired = true
case SourceImageio:
scratchRequired = true
case SourceRegistry:
scratchRequired = pvc.Annotations[AnnRegistryImportMethod] != string(cdiv1.RegistryPullNode)
}
Expand Down

0 comments on commit bee890a

Please sign in to comment.