Skip to content

Commit 574a702

Browse files
committed
Image controller: don't attempt upload when adopting
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.
1 parent 6560f88 commit 574a702

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

internal/controllers/image/reconcile.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,15 @@ func (r *orcImageReconciler) reconcileNormal(ctx context.Context, orcImage *orcv
143143

144144
// Newly created image, waiting for upload, or... previous upload was interrupted and has now reset
145145
case images.ImageStatusQueued:
146+
// Don't attempt image creation if we're only adopting
147+
if orcImage.GetControllerOptions().GetOnCreate() == orcv1alpha1.ControllerOptionsOnCreateAdopt {
148+
addStatus(withProgressMessage("Waiting for glance image content to be uploaded externally"))
149+
150+
return ctrl.Result{
151+
RequeueAfter: waitForGlanceImageStatusUpdate,
152+
}, err
153+
}
154+
146155
if ptr.Deref(orcImage.Status.DownloadAttempts, 0) >= maxDownloadAttempts {
147156
return ctrl.Result{}, capoerrors.Terminal(orcv1alpha1.OpenStackConditionReasonInvalidConfiguration, fmt.Sprintf("Unable to download content after %d attempts", maxDownloadAttempts))
148157
}

0 commit comments

Comments
 (0)