@@ -30,6 +30,7 @@ import (
3030)
3131
3232var log = logf .Log .WithName ("controller_clusterstorage" )
33+ var unsupportedPlatformError = errors .New ("unsupported platform" )
3334
3435const (
3536 // OwnerLabelNamespace is the label key for the owner namespace
@@ -191,34 +192,42 @@ func (r *ReconcileClusterStorage) syncStatus(clusterOperator *configv1.ClusterOp
191192 Status : configv1 .ConditionFalse ,
192193 }
193194 v1helpers .SetStatusCondition (& clusterOperator .Status .Conditions , notProgressing )
195+ var message string
194196
197+ // if error is anything other than unsupported platform, we are failing
195198 if err != nil {
196- failing := configv1.ClusterOperatorStatusCondition {
197- Type : configv1 .OperatorFailing ,
198- Status : configv1 .ConditionTrue ,
199- Reason : "Error" ,
200- Message : err .Error (),
201- }
202- v1helpers .SetStatusCondition (& clusterOperator .Status .Conditions , failing )
199+ if err != unsupportedPlatformError {
200+ failing := configv1.ClusterOperatorStatusCondition {
201+ Type : configv1 .OperatorFailing ,
202+ Status : configv1 .ConditionTrue ,
203+ Reason : "Error" ,
204+ Message : err .Error (),
205+ }
206+ v1helpers .SetStatusCondition (& clusterOperator .Status .Conditions , failing )
203207
204- unavailable := configv1.ClusterOperatorStatusCondition {
205- Type : configv1 .OperatorAvailable ,
206- Status : configv1 .ConditionFalse ,
207- }
208- v1helpers .SetStatusCondition (& clusterOperator .Status .Conditions , unavailable )
208+ unavailable := configv1.ClusterOperatorStatusCondition {
209+ Type : configv1 .OperatorAvailable ,
210+ Status : configv1 .ConditionFalse ,
211+ }
212+ v1helpers .SetStatusCondition (& clusterOperator .Status .Conditions , unavailable )
209213
210- updateErr := r .client .Status ().Update (context .TODO (), clusterOperator )
211- if updateErr != nil {
212- log .Error (updateErr , "Failed to update ClusterOperator status" )
213- return updateErr
214+ updateErr := r .client .Status ().Update (context .TODO (), clusterOperator )
215+ if updateErr != nil {
216+ log .Error (updateErr , "Failed to update ClusterOperator status" )
217+ return updateErr
218+ }
219+ return nil
214220 }
215- return nil
221+ message = "Unsupported platform for storageclass creation"
216222 }
217223
218224 available := configv1.ClusterOperatorStatusCondition {
219225 Type : configv1 .OperatorAvailable ,
220226 Status : configv1 .ConditionTrue ,
221227 }
228+ if message != "" {
229+ available .Message = message
230+ }
222231 v1helpers .SetStatusCondition (& clusterOperator .Status .Conditions , available )
223232
224233 notFailing := configv1.ClusterOperatorStatusCondition {
@@ -247,7 +256,7 @@ func newStorageClassForCluster(cm *corev1.ConfigMap) (*storagev1.StorageClass, e
247256 return resourceread .ReadStorageClassV1OrDie (generated .MustAsset ("assets/openstack.yaml" )), nil
248257 }
249258
250- return nil , errors . New ( "unsupported platform" )
259+ return nil , unsupportedPlatformError
251260}
252261
253262func getPlatform (cm * corev1.ConfigMap ) (* installer.Platform , error ) {
0 commit comments