Skip to content

Commit 6cdf56f

Browse files
committed
Fix OVN condition flapping during minor updates
During minor updates, reconcileOVNControllers was called on every reconcile throughout all update phases, causing two issues: 1. OVNReadyCondition flapping: Since InitConditions() resets all conditions to Unknown on each reconcile, calling reconcileOVNControllers during later phases (RabbitMQ, Galera, etc.) could transiently flip OVNReadyCondition to False, blocking the OpenStackVersion controller from maintaining MinorUpdateOVNControlplane as True. 2. Metrics DaemonSet unnecessary restarts: reconcileOVNControllers passed an empty string for the metrics cert name, clearing the MetricsTLS fields on the OVNController CR. This changed the metrics config hash, causing two spurious DaemonSet rollouts — once when MetricsTLS was cleared during the update, and again when the normal reconcile path restored it after the update completed. Fix both by: - Skipping reconcileOVNControllers after the OVN controlplane phase completes, directly marking OVNReadyCondition True instead (needed because InitConditions() resets conditions each reconcile). - Passing the correct metrics cert name via EnsureOVNMetricsCert so MetricsTLS stays consistent when reconcileOVNControllers does run. There was another issue in ovn-operator for pre mature readiness, that is being fixed as part of openstack-k8s-operators/ovn-operator#587 Related-Issue: https://redhat.atlassian.net/browse/OSPRH-31318 Assisted-By: Claude Signed-off-by: Yatin Karel <ykarel@redhat.com>
1 parent 2e0717b commit 6cdf56f

1 file changed

Lines changed: 23 additions & 9 deletions

File tree

internal/controller/core/openstackcontrolplane_controller.go

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -315,17 +315,23 @@ func (r *OpenStackControlPlaneReconciler) Reconcile(ctx context.Context, req ctr
315315
}
316316

317317
// OVN
318-
Log.Info("Minor update OVN on the ControlPlane")
319-
ctrlResult, err = r.reconcileOVNControllers(ctx, instance, version, helper)
320-
if err != nil {
321-
return ctrl.Result{}, err
322-
} else if (ctrlResult != ctrl.Result{}) {
323-
return ctrlResult, nil
324-
}
325-
instance.Status.DeployedOVNVersion = &version.Spec.TargetVersion
318+
// Once the OVN controlplane phase is complete, skip reconcileOVNControllers to prevent
319+
// transient OVN readiness changes from flapping OVNReadyCondition during
320+
// later phases. We still need to mark OVNReadyCondition True because
321+
// InitConditions() resets all conditions to Unknown on each reconcile.
326322
if !version.Status.Conditions.IsTrue(corev1beta1.OpenStackVersionMinorUpdateOVNControlplane) {
323+
Log.Info("Minor update OVN on the ControlPlane")
324+
ctrlResult, err = r.reconcileOVNControllers(ctx, instance, version, helper)
325+
if err != nil {
326+
return ctrl.Result{}, err
327+
} else if (ctrlResult != ctrl.Result{}) {
328+
return ctrlResult, nil
329+
}
330+
instance.Status.DeployedOVNVersion = &version.Spec.TargetVersion
331+
// Wait for the OpenStackVersion controller to acknowledge OVN controlplane update
327332
return ctrlResult, nil
328333
}
334+
instance.Status.Conditions.MarkTrue(corev1beta1.OpenStackControlPlaneOVNReadyCondition, corev1beta1.OpenStackControlPlaneOVNReadyMessage)
329335

330336
// only if OVN dataplane is updated
331337
if version.Status.Conditions.IsTrue(corev1beta1.OpenStackVersionMinorUpdateOVNDataplane) {
@@ -402,7 +408,15 @@ func (r *OpenStackControlPlaneReconciler) Reconcile(ctx context.Context, req ctr
402408
}
403409

404410
func (r *OpenStackControlPlaneReconciler) reconcileOVNControllers(ctx context.Context, instance *corev1beta1.OpenStackControlPlane, version *corev1beta1.OpenStackVersion, helper *common_helper.Helper) (ctrl.Result, error) {
405-
OVNControllerReady, OVNControllerConditions, err := openstack.ReconcileOVNController(ctx, instance, version, helper, "")
411+
var ovnMetricsCertName string
412+
if instance.Spec.Ovn.Enabled && instance.Spec.TLS.PodLevel.Enabled {
413+
var err error
414+
ovnMetricsCertName, err = openstack.EnsureOVNMetricsCert(ctx, instance, helper)
415+
if err != nil {
416+
return ctrl.Result{}, err
417+
}
418+
}
419+
OVNControllerReady, OVNControllerConditions, err := openstack.ReconcileOVNController(ctx, instance, version, helper, ovnMetricsCertName)
406420
if err != nil {
407421
return ctrl.Result{}, err
408422
} else if !OVNControllerReady {

0 commit comments

Comments
 (0)