Skip to content

Commit b378a52

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

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
@@ -171,6 +171,9 @@ func (c *ClusterExtensionRevisionReconciler) reconcile(ctx context.Context, rev
171171
if verr := rres.GetValidationError(); verr != nil {
172172
l.Error(fmt.Errorf("%w", verr), "preflight validation failed, retrying after 10s")
173173

174+
// if we take Availability as strictly being "all availability probes pass"
175+
// we should probably be at an Unknown state (or not posted it at all here)
176+
// and post this up in the Progressing condition as False with a failed rollout reason / message
174177
meta.SetStatusCondition(&rev.Status.Conditions, metav1.Condition{
175178
Type: ocv1.ClusterExtensionRevisionTypeAvailable,
176179
Status: metav1.ConditionFalse,
@@ -185,6 +188,8 @@ func (c *ClusterExtensionRevisionReconciler) reconcile(ctx context.Context, rev
185188
if verr := pres.GetValidationError(); verr != nil {
186189
l.Error(fmt.Errorf("%w", verr), "phase preflight validation failed, retrying after 10s", "phase", i)
187190

191+
// we probably want to either eat this error and leave Progressing as True with a rolling out reason and implement timeout
192+
// or surface this error through a Degraded-type condition that can flap as roll out continues
188193
meta.SetStatusCondition(&rev.Status.Conditions, metav1.Condition{
189194
Type: ocv1.ClusterExtensionRevisionTypeAvailable,
190195
Status: metav1.ConditionFalse,
@@ -204,14 +209,17 @@ func (c *ClusterExtensionRevisionReconciler) reconcile(ctx context.Context, rev
204209

205210
if len(collidingObjs) > 0 {
206211
l.Error(fmt.Errorf("object collision detected"), "object collision, retrying after 10s", "phase", i, "collisions", collidingObjs)
207-
212+
// collisions are probably stickier than phase roll out probe failures - so we'd probably want to set
213+
// Progressing to false here due to the collision
208214
meta.SetStatusCondition(&rev.Status.Conditions, metav1.Condition{
209215
Type: ocv1.ClusterExtensionRevisionTypeAvailable,
210216
Status: metav1.ConditionFalse,
211217
Reason: ocv1.ClusterExtensionRevisionReasonObjectCollisions,
212218
Message: fmt.Sprintf("revision object collisions in phase %d\n%s", i, strings.Join(collidingObjs, "\n\n")),
213219
ObservedGeneration: rev.Generation,
214220
})
221+
222+
// idk if we want to return yet or check the Availability probes on a best-effort basis
215223
return ctrl.Result{RequeueAfter: 10 * time.Second}, nil
216224
}
217225
}
@@ -230,13 +238,20 @@ func (c *ClusterExtensionRevisionReconciler) reconcile(ctx context.Context, rev
230238
}
231239

232240
// Report status.
241+
// We probably want to set Progressing to False here with a rollout success reason and message
242+
// It would be good to understand from Nico how we can distinguish between progression and availability probes
243+
// and how to best check that all Availability probes are passing
233244
meta.SetStatusCondition(&rev.Status.Conditions, metav1.Condition{
234245
Type: ocv1.ClusterExtensionRevisionTypeAvailable,
235246
Status: metav1.ConditionTrue,
236247
Reason: ocv1.ClusterExtensionRevisionReasonAvailable,
237248
Message: "Object is available and passes all probes.",
238249
ObservedGeneration: rev.Generation,
239250
})
251+
252+
// We'll probably only want to remove this once we are done updating the ClusterExtension conditions
253+
// as its one of the interfaces between the revision and the extension. If we still have the Succeeded for now
254+
// that's fine.
240255
if !meta.IsStatusConditionTrue(rev.Status.Conditions, ocv1.ClusterExtensionRevisionTypeSucceeded) {
241256
meta.SetStatusCondition(&rev.Status.Conditions, metav1.Condition{
242257
Type: ocv1.ClusterExtensionRevisionTypeSucceeded,
@@ -253,13 +268,17 @@ func (c *ClusterExtensionRevisionReconciler) reconcile(ctx context.Context, rev
253268
continue
254269
}
255270
for _, ores := range pres.GetObjects() {
271+
// we probably want an AvailabilityProbeType and run through all of them independently of whether
272+
// the revision is complete or not
256273
pr := ores.Probes()[boxcutter.ProgressProbeType]
257274
if pr.Success {
258275
continue
259276
}
260277

261278
obj := ores.Object()
262279
gvk := obj.GetObjectKind().GroupVersionKind()
280+
// I think these can be pretty large and verbose. We may want to
281+
// work a little on the formatting...?
263282
probeFailureMsgs = append(probeFailureMsgs, fmt.Sprintf(
264283
"Object %s.%s %s/%s: %v",
265284
gvk.Kind, gvk.GroupVersion().String(),
@@ -277,6 +296,7 @@ func (c *ClusterExtensionRevisionReconciler) reconcile(ctx context.Context, rev
277296
ObservedGeneration: rev.Generation,
278297
})
279298
} else {
299+
// either to nothing or set the Progressing condition to True with rolling out reason / message
280300
meta.SetStatusCondition(&rev.Status.Conditions, metav1.Condition{
281301
Type: ocv1.ClusterExtensionRevisionTypeAvailable,
282302
Status: metav1.ConditionFalse,
@@ -287,6 +307,7 @@ func (c *ClusterExtensionRevisionReconciler) reconcile(ctx context.Context, rev
287307
}
288308
}
289309
if rres.InTransistion() {
310+
// seems to be the right thing XD
290311
meta.SetStatusCondition(&rev.Status.Conditions, metav1.Condition{
291312
Type: ocv1.TypeProgressing,
292313
Status: metav1.ConditionTrue,
@@ -295,6 +316,7 @@ func (c *ClusterExtensionRevisionReconciler) reconcile(ctx context.Context, rev
295316
ObservedGeneration: rev.Generation,
296317
})
297318
} else {
319+
// we may not want to remove it but rather set it to False?
298320
meta.RemoveStatusCondition(&rev.Status.Conditions, ocv1.TypeProgressing)
299321
}
300322

0 commit comments

Comments
 (0)