Skip to content

Commit

Permalink
Fix installation on usupported platforms like oVirt
Browse files Browse the repository at this point in the history
The operator should mark itself as Available when on a platform that does
not have a default StorageClass (yet).
  • Loading branch information
jsafrane committed Jul 20, 2020
1 parent 81aca48 commit 017180d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
11 changes: 9 additions & 2 deletions pkg/operator/defaultstorageclass/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,17 @@ func (c *Controller) sync(ctx context.Context, syncCtx factory.SyncContext) erro
Reason: "UnsupportedPlatform",
Message: syncErr.Error(),
}
// Set Available=true, Progressing=false - everything is OK and
// there is nothing to do. ClusterOperatorStatusController needs
// at least one Available/Pogressing condition set to mark the
// ClusterOperator as Available + notPogressing.
availableCnd.Message = "No default StorageClass for this platform"
availableCnd.Status = operatorapi.ConditionTrue

_, _, updateErr := v1helpers.UpdateStatus(c.operatorClient,
v1helpers.UpdateConditionFn(disabledCnd),
removeConditionFn(conditionsPrefix+operatorapi.OperatorStatusTypeAvailable),
removeConditionFn(conditionsPrefix+operatorapi.OperatorStatusTypeProgressing),
v1helpers.UpdateConditionFn(availableCnd),
v1helpers.UpdateConditionFn(progressingCnd),
)
return updateErr
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/operator/defaultstorageclass/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ func TestSync(t *testing.T) {
},
expectedObjects: testObjects{
storage: getCR(
withTrueConditions(conditionsPrefix + "Disabled"),
withTrueConditions(conditionsPrefix+"Disabled", conditionsPrefix+opv1.OperatorStatusTypeAvailable),
withFalseConditions(conditionsPrefix+opv1.OperatorStatusTypeProgressing),
),
},
expectErr: false,
Expand Down

0 comments on commit 017180d

Please sign in to comment.