Skip to content

Commit 5b2d1da

Browse files
author
Per G. da Silva
committed
initial thoughts
Signed-off-by: Per G. da Silva <pegoncal@redhat.com>
1 parent 85e8cbf commit 5b2d1da

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

api/v1/clusterextensionrevision_types.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ const (
2626
ClusterExtensionRevisionKind = "ClusterExtensionRevision"
2727

2828
// Condition Types
29-
ClusterExtensionRevisionTypeAvailable = "Available"
30-
ClusterExtensionRevisionTypeSucceeded = "Succeeded"
29+
ClusterExtensionRevisionTypeAvailable = "Available"
30+
ClusterExtensionRevisionTypeSucceeded = "Succeeded"
31+
ClusterExtensionRevisionTypeProgressing = "Progressing"
3132

3233
// Condition Reasons
3334
ClusterExtensionRevisionReasonAvailable = "Available"
@@ -40,6 +41,7 @@ const (
4041
ClusterExtensionRevisionReasonIncomplete = "Incomplete"
4142
ClusterExtensionRevisionReasonProgressing = "Progressing"
4243
ClusterExtensionRevisionReasonArchived = "Archived"
44+
ClusterExtensionRevisionReasonRolloutInProgress = "RolloutInProgress"
4345
)
4446

4547
// ClusterExtensionRevisionSpec defines the desired state of ClusterExtensionRevision.

internal/operator-controller/controllers/clusterextensionrevision_controller.go

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ func (c *ClusterExtensionRevisionReconciler) reconcile(ctx context.Context, rev
165165
if verr := rres.GetValidationError(); verr != nil {
166166
l.Info("preflight error, retrying after 10s", "err", verr.String())
167167

168+
// if we take Availability as strictly being "all availability probes pass"
169+
// we should probably be at an Unknown state (or not posted it at all here)
170+
// and post this up in the Progressing condition as False with a failed rollout reason / message
168171
meta.SetStatusCondition(&rev.Status.Conditions, metav1.Condition{
169172
Type: ocv1.ClusterExtensionRevisionTypeAvailable,
170173
Status: metav1.ConditionFalse,
@@ -179,6 +182,8 @@ func (c *ClusterExtensionRevisionReconciler) reconcile(ctx context.Context, rev
179182
if verr := pres.GetValidationError(); verr != nil {
180183
l.Info("preflight error, retrying after 10s", "err", verr.String())
181184

185+
// we probably want to either eat this error and leave Progressing as True with a rolling out reason and implement timeout
186+
// or surface this error through a Degraded-type condition that can flap as roll out continues
182187
meta.SetStatusCondition(&rev.Status.Conditions, metav1.Condition{
183188
Type: ocv1.ClusterExtensionRevisionTypeAvailable,
184189
Status: metav1.ConditionFalse,
@@ -198,14 +203,17 @@ func (c *ClusterExtensionRevisionReconciler) reconcile(ctx context.Context, rev
198203

199204
if len(collidingObjs) > 0 {
200205
l.Info("object collision error, retrying after 10s", "collisions", collidingObjs)
201-
206+
// collisions are probably stickier than phase roll out probe failures - so we'd probably want to set
207+
// Progressing to false here due to the collision
202208
meta.SetStatusCondition(&rev.Status.Conditions, metav1.Condition{
203209
Type: ocv1.ClusterExtensionRevisionTypeAvailable,
204210
Status: metav1.ConditionFalse,
205211
Reason: ocv1.ClusterExtensionRevisionReasonObjectCollisions,
206212
Message: fmt.Sprintf("revision object collisions in phase %d\n%s", i, strings.Join(collidingObjs, "\n\n")),
207213
ObservedGeneration: rev.Generation,
208214
})
215+
216+
// idk if we want to return yet or check the Availability probes on a best-effort basis
209217
return ctrl.Result{RequeueAfter: 10 * time.Second}, nil
210218
}
211219
}
@@ -224,13 +232,20 @@ func (c *ClusterExtensionRevisionReconciler) reconcile(ctx context.Context, rev
224232
}
225233

226234
// Report status.
235+
// We probably want to set Progressing to False here with a rollout success reason and message
236+
// It would be good to understand from Nico how we can distinguish between progression and availability probes
237+
// and how to best check that all Availability probes are passing
227238
meta.SetStatusCondition(&rev.Status.Conditions, metav1.Condition{
228239
Type: ocv1.ClusterExtensionRevisionTypeAvailable,
229240
Status: metav1.ConditionTrue,
230241
Reason: ocv1.ClusterExtensionRevisionReasonAvailable,
231242
Message: "Object is available and passes all probes.",
232243
ObservedGeneration: rev.Generation,
233244
})
245+
246+
// We'll probably only want to remove this once we are done updating the ClusterExtension conditions
247+
// as its one of the interfaces between the revision and the extension. If we still have the Succeeded for now
248+
// that's fine.
234249
if !meta.IsStatusConditionTrue(rev.Status.Conditions, ocv1.ClusterExtensionRevisionTypeSucceeded) {
235250
meta.SetStatusCondition(&rev.Status.Conditions, metav1.Condition{
236251
Type: ocv1.ClusterExtensionRevisionTypeSucceeded,
@@ -247,13 +262,17 @@ func (c *ClusterExtensionRevisionReconciler) reconcile(ctx context.Context, rev
247262
continue
248263
}
249264
for _, ores := range pres.GetObjects() {
265+
// we probably want an AvailabilityProbeType and run through all of them independently of whether
266+
// the revision is complete or not
250267
pr := ores.Probes()[boxcutter.ProgressProbeType]
251268
if pr.Success {
252269
continue
253270
}
254271

255272
obj := ores.Object()
256273
gvk := obj.GetObjectKind().GroupVersionKind()
274+
// I think these can be pretty large and verbose. We may want to
275+
// work a little on the formatting...?
257276
probeFailureMsgs = append(probeFailureMsgs, fmt.Sprintf(
258277
"Object %s.%s %s/%s: %v",
259278
gvk.Kind, gvk.GroupVersion().String(),
@@ -271,6 +290,7 @@ func (c *ClusterExtensionRevisionReconciler) reconcile(ctx context.Context, rev
271290
ObservedGeneration: rev.Generation,
272291
})
273292
} else {
293+
// either to nothing or set the Progressing condition to True with rolling out reason / message
274294
meta.SetStatusCondition(&rev.Status.Conditions, metav1.Condition{
275295
Type: ocv1.ClusterExtensionRevisionTypeAvailable,
276296
Status: metav1.ConditionFalse,
@@ -281,6 +301,7 @@ func (c *ClusterExtensionRevisionReconciler) reconcile(ctx context.Context, rev
281301
}
282302
}
283303
if rres.InTransistion() {
304+
// seems to be the right thing XD
284305
meta.SetStatusCondition(&rev.Status.Conditions, metav1.Condition{
285306
Type: ocv1.TypeProgressing,
286307
Status: metav1.ConditionTrue,
@@ -289,6 +310,7 @@ func (c *ClusterExtensionRevisionReconciler) reconcile(ctx context.Context, rev
289310
ObservedGeneration: rev.Generation,
290311
})
291312
} else {
313+
// we may not want to remove it but rather set it to False?
292314
meta.RemoveStatusCondition(&rev.Status.Conditions, ocv1.TypeProgressing)
293315
}
294316

0 commit comments

Comments
 (0)