Skip to content

Commit

Permalink
Image controller: don't attempt upload when adopting
Browse files Browse the repository at this point in the history
When an image is to be adopted, the controller would still attempt to
upload content when it observed the image in the queued state after
having been created externally. This didn't result in incorrect
behaviour because API validation ensures that images for adoption don't
specify a source. This meant that no upload could be attempted, but it
did result in a spurious error message reported both to the user and in
the logs.
  • Loading branch information
mdbooth committed Sep 26, 2024
1 parent 6560f88 commit 574a702
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/controllers/image/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,15 @@ func (r *orcImageReconciler) reconcileNormal(ctx context.Context, orcImage *orcv

// Newly created image, waiting for upload, or... previous upload was interrupted and has now reset
case images.ImageStatusQueued:
// Don't attempt image creation if we're only adopting
if orcImage.GetControllerOptions().GetOnCreate() == orcv1alpha1.ControllerOptionsOnCreateAdopt {
addStatus(withProgressMessage("Waiting for glance image content to be uploaded externally"))

return ctrl.Result{
RequeueAfter: waitForGlanceImageStatusUpdate,
}, err
}

if ptr.Deref(orcImage.Status.DownloadAttempts, 0) >= maxDownloadAttempts {
return ctrl.Result{}, capoerrors.Terminal(orcv1alpha1.OpenStackConditionReasonInvalidConfiguration, fmt.Sprintf("Unable to download content after %d attempts", maxDownloadAttempts))
}
Expand Down

0 comments on commit 574a702

Please sign in to comment.