@@ -92,9 +92,9 @@ func (c *ClusterExtensionRevisionReconciler) reconcile(ctx context.Context, rev
9292 tres , err := c .RevisionEngine .Teardown (ctx , * revision )
9393 if err != nil {
9494 meta .SetStatusCondition (& rev .Status .Conditions , metav1.Condition {
95- Type : "Available" ,
95+ Type : ocv1 . TypeAvailable ,
9696 Status : metav1 .ConditionFalse ,
97- Reason : "ReconcileFailure" ,
97+ Reason : ocv1 . ReasonReconcileFailure ,
9898 Message : err .Error (),
9999 ObservedGeneration : rev .Generation ,
100100 })
@@ -108,9 +108,9 @@ func (c *ClusterExtensionRevisionReconciler) reconcile(ctx context.Context, rev
108108
109109 if err := c .TrackingCache .Free (ctx , rev ); err != nil {
110110 meta .SetStatusCondition (& rev .Status .Conditions , metav1.Condition {
111- Type : "Available" ,
111+ Type : ocv1 . TypeAvailable ,
112112 Status : metav1 .ConditionFalse ,
113- Reason : "ReconcileFailure" ,
113+ Reason : ocv1 . ReasonReconcileFailure ,
114114 Message : err .Error (),
115115 ObservedGeneration : rev .Generation ,
116116 })
@@ -124,19 +124,19 @@ func (c *ClusterExtensionRevisionReconciler) reconcile(ctx context.Context, rev
124124 //
125125 if err := c .ensureFinalizer (ctx , rev , clusterExtensionRevisionTeardownFinalizer ); err != nil {
126126 meta .SetStatusCondition (& rev .Status .Conditions , metav1.Condition {
127- Type : "Available" ,
127+ Type : ocv1 . TypeAvailable ,
128128 Status : metav1 .ConditionFalse ,
129- Reason : "ReconcileFailure" ,
129+ Reason : ocv1 . ReasonReconcileFailure ,
130130 Message : err .Error (),
131131 ObservedGeneration : rev .Generation ,
132132 })
133133 return ctrl.Result {}, fmt .Errorf ("ensure finalizer: %w" , errors .Join (err , c .Client .Status ().Update (ctx , rev )))
134134 }
135135 if err := c .establishWatch (ctx , rev , revision ); err != nil {
136136 meta .SetStatusCondition (& rev .Status .Conditions , metav1.Condition {
137- Type : "Available" ,
137+ Type : ocv1 . TypeAvailable ,
138138 Status : metav1 .ConditionFalse ,
139- Reason : "ReconcileFailure" ,
139+ Reason : ocv1 . ReasonReconcileFailure ,
140140 Message : err .Error (),
141141 ObservedGeneration : rev .Generation ,
142142 })
@@ -145,9 +145,9 @@ func (c *ClusterExtensionRevisionReconciler) reconcile(ctx context.Context, rev
145145 rres , err := c .RevisionEngine .Reconcile (ctx , * revision , opts ... )
146146 if err != nil {
147147 meta .SetStatusCondition (& rev .Status .Conditions , metav1.Condition {
148- Type : "Available" ,
148+ Type : ocv1 . TypeAvailable ,
149149 Status : metav1 .ConditionFalse ,
150- Reason : "ReconcileFailure" ,
150+ Reason : ocv1 . ReasonReconcileFailure ,
151151 Message : err .Error (),
152152 ObservedGeneration : rev .Generation ,
153153 })
@@ -160,9 +160,9 @@ func (c *ClusterExtensionRevisionReconciler) reconcile(ctx context.Context, rev
160160 if verr := rres .GetValidationError (); verr != nil {
161161 l .Info ("preflight error, retrying after 10s" , "err" , verr .String ())
162162 meta .SetStatusCondition (& rev .Status .Conditions , metav1.Condition {
163- Type : "Available" ,
163+ Type : ocv1 . TypeAvailable ,
164164 Status : metav1 .ConditionFalse ,
165- Reason : "RevisionValidationFailure" ,
165+ Reason : ocv1 . ReasonRevisionValidationFailure ,
166166 Message : fmt .Sprintf ("revision validation error: %s" , verr ),
167167 ObservedGeneration : rev .Generation ,
168168 })
@@ -172,9 +172,9 @@ func (c *ClusterExtensionRevisionReconciler) reconcile(ctx context.Context, rev
172172 if verr := pres .GetValidationError (); verr != nil {
173173 l .Info ("preflight error, retrying after 10s" , "err" , verr .String ())
174174 meta .SetStatusCondition (& rev .Status .Conditions , metav1.Condition {
175- Type : "Available" ,
175+ Type : ocv1 . TypeAvailable ,
176176 Status : metav1 .ConditionFalse ,
177- Reason : "PhaseValidationError" ,
177+ Reason : ocv1 . ReasonPhaseValidationError ,
178178 Message : fmt .Sprintf ("phase %d validation error: %s" , i , verr ),
179179 ObservedGeneration : rev .Generation ,
180180 })
@@ -189,9 +189,9 @@ func (c *ClusterExtensionRevisionReconciler) reconcile(ctx context.Context, rev
189189 if len (collidingObjs ) > 0 {
190190 l .Info ("object collision error, retrying after 10s" , "collisions" , collidingObjs )
191191 meta .SetStatusCondition (& rev .Status .Conditions , metav1.Condition {
192- Type : "Available" ,
192+ Type : ocv1 . TypeAvailable ,
193193 Status : metav1 .ConditionFalse ,
194- Reason : "ObjectCollisions" ,
194+ Reason : ocv1 . ReasonObjectCollisions ,
195195 Message : fmt .Sprintf ("revision object collisions in phase %d\n %s" , i , strings .Join (collidingObjs , "\n \n " )),
196196 ObservedGeneration : rev .Generation ,
197197 })
@@ -211,17 +211,17 @@ func (c *ClusterExtensionRevisionReconciler) reconcile(ctx context.Context, rev
211211
212212 // Report status.
213213 meta .SetStatusCondition (& rev .Status .Conditions , metav1.Condition {
214- Type : "Available" ,
214+ Type : ocv1 . TypeAvailable ,
215215 Status : metav1 .ConditionTrue ,
216- Reason : "Available" ,
216+ Reason : ocv1 . ReasonObjectAvailable ,
217217 Message : "Object is available and passes all probes." ,
218218 ObservedGeneration : rev .Generation ,
219219 })
220- if ! meta .IsStatusConditionTrue (rev .Status .Conditions , "Succeeded" ) {
220+ if ! meta .IsStatusConditionTrue (rev .Status .Conditions , ocv1 . TypeSucceeded ) {
221221 meta .SetStatusCondition (& rev .Status .Conditions , metav1.Condition {
222- Type : "Succeeded" ,
222+ Type : ocv1 . TypeSucceeded ,
223223 Status : metav1 .ConditionTrue ,
224- Reason : "RolloutSuccess" ,
224+ Reason : ocv1 . ReasonRolloutSuccess ,
225225 Message : "Revision succeeded rolling out." ,
226226 ObservedGeneration : rev .Generation ,
227227 })
@@ -250,32 +250,32 @@ func (c *ClusterExtensionRevisionReconciler) reconcile(ctx context.Context, rev
250250 }
251251 if len (probeFailureMsgs ) > 0 {
252252 meta .SetStatusCondition (& rev .Status .Conditions , metav1.Condition {
253- Type : "Available" ,
253+ Type : ocv1 . TypeAvailable ,
254254 Status : metav1 .ConditionFalse ,
255- Reason : "ProbeFailure" ,
255+ Reason : ocv1 . ReasonProbeFailure ,
256256 Message : strings .Join (probeFailureMsgs , "\n " ),
257257 ObservedGeneration : rev .Generation ,
258258 })
259259 } else {
260260 meta .SetStatusCondition (& rev .Status .Conditions , metav1.Condition {
261- Type : "Available" ,
261+ Type : ocv1 . TypeAvailable ,
262262 Status : metav1 .ConditionFalse ,
263- Reason : "Incomplete" ,
263+ Reason : ocv1 . ReasonIncomplete ,
264264 Message : "Revision has not been rolled out completely." ,
265265 ObservedGeneration : rev .Generation ,
266266 })
267267 }
268268 }
269269 if rres .InTransistion () {
270270 meta .SetStatusCondition (& rev .Status .Conditions , metav1.Condition {
271- Type : "Progressing" ,
271+ Type : ocv1 . TypeProgressing ,
272272 Status : metav1 .ConditionTrue ,
273- Reason : "Progressing" ,
273+ Reason : ocv1 . ReasonProgressing ,
274274 Message : "Rollout in progress." ,
275275 ObservedGeneration : rev .Generation ,
276276 })
277277 } else {
278- meta .RemoveStatusCondition (& rev .Status .Conditions , "Progressing" )
278+ meta .RemoveStatusCondition (& rev .Status .Conditions , ocv1 . TypeProgressing )
279279 }
280280
281281 return ctrl.Result {}, c .Client .Status ().Update (ctx , rev )
@@ -412,7 +412,7 @@ func toBoxcutterRevision(rev *ocv1.ClusterExtensionRevision) (*boxcutter.Revisio
412412 return false , []string {".status.observedGeneration outdated" }
413413 }
414414 for _ , cond := range depl .Status .Conditions {
415- if cond .Type == "Available" &&
415+ if cond .Type == ocv1 . TypeAvailable &&
416416 cond .Status == corev1 .ConditionTrue &&
417417 depl .Status .UpdatedReplicas == * depl .Spec .Replicas {
418418 return true , nil
0 commit comments