Skip to content

Commit 62e4071

Browse files
Merge pull request openstack-k8s-operators#1966 from karelyatin/OSPRH-31318
Fix OVN condition flapping during minor updates
2 parents 92f2398 + 6cdf56f commit 62e4071

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)