Skip to content

Commit 807f8e0

Browse files
committed
fix(ospf): Do not wait for interfaces to become ready
OSPF would never be configured if only one member interface is down. Hence, only wait for configuration.
1 parent f26c2e5 commit 807f8e0

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

internal/conditions/conditions.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,19 @@ func IsReady(target Getter) bool {
7070
return condition.Status == metav1.ConditionTrue
7171
}
7272

73+
// IsConfigured looks at the [v1alpha1.ConfiguredCondition] condition type and returns true
74+
// if that condition is set to true and the observed generation matches the object's generation.
75+
func IsConfigured(target Getter) bool {
76+
condition := meta.FindStatusCondition(target.GetConditions(), v1alpha1.ConfiguredCondition)
77+
if condition == nil {
78+
return false
79+
}
80+
if m, ok := target.(metav1.Object); ok && condition.ObservedGeneration != m.GetGeneration() {
81+
return false
82+
}
83+
return condition.Status == metav1.ConditionTrue
84+
}
85+
7386
// GetTopLevelCondition finds and returns the top level condition (Ready Condition).
7487
func GetTopLevelCondition(target Getter) *metav1.Condition {
7588
return meta.FindStatusCondition(target.GetConditions(), v1alpha1.ReadyCondition)

internal/controller/core/ospf_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,12 @@ func (r *OSPFReconciler) reconcile(ctx context.Context, s *ospfScope) (_ ctrl.Re
252252
return ctrl.Result{}, err
253253
}
254254

255-
if !conditions.IsReady(intf) {
255+
if !conditions.IsConfigured(intf) {
256256
conditions.Set(s.OSPF, metav1.Condition{
257257
Type: v1alpha1.ReadyCondition,
258258
Status: metav1.ConditionFalse,
259259
Reason: v1alpha1.WaitingForDependenciesReason,
260-
Message: "Waiting for referenced interfaces to become ready",
260+
Message: "Waiting for referenced interfaces to be configured",
261261
})
262262
return ctrl.Result{RequeueAfter: r.RequeueInterval}, nil
263263
}

0 commit comments

Comments
 (0)