Skip to content

Commit 9f8a255

Browse files
committed
ensure that .status.latestrevision is always accurate
1 parent ed1ef13 commit 9f8a255

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

pkg/operator/revisioncontroller/revision_controller.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,11 +364,10 @@ func (c RevisionController) sync(ctx context.Context, syncCtx factory.SyncContex
364364
return nil
365365
}
366366

367-
if shouldCreateNewRevision, err := c.revisionPrecondition(ctx); err != nil || !shouldCreateNewRevision {
368-
return err
369-
}
370-
371367
// If the operator status's latest available revision is not the same as the observed latest revision, update the operator.
368+
// This needs to be done even if the revision precondition is not required because it ensures our operator status is
369+
// correct for all consumers.
370+
// This is what is going to allow us to move where the state is stored in authentications.openshift.io.
372371
latestObservedRevision, err := c.getLatestAvailableRevision(ctx)
373372
if err != nil {
374373
return err
@@ -389,6 +388,10 @@ func (c RevisionController) sync(ctx context.Context, syncCtx factory.SyncContex
389388
return factory.SyntheticRequeueError
390389
}
391390

391+
if shouldCreateNewRevision, err := c.revisionPrecondition(ctx); err != nil || !shouldCreateNewRevision {
392+
return err
393+
}
394+
392395
wroteStatus, requeue, syncErr := c.createRevisionIfNeeded(ctx, syncCtx.Recorder(), operatorStatus.LatestAvailableRevision)
393396
switch {
394397
case requeue && syncErr == nil:

0 commit comments

Comments
 (0)