Skip to content

Commit 1e39a38

Browse files
authored
Merge pull request kubernetes-sigs#2180 from shiftstack/image-adopt
🐛 Image controller: don't attempt upload when adopting
2 parents 6560f88 + 574a702 commit 1e39a38

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)