@@ -3716,6 +3716,77 @@ var _ = Describe("OpenStackOperator controller", func() {
37163716 // Template-level takes precedence over top-level.
37173717 })
37183718
3719+ // The minor update waits on the control plane's MariaDBReady condition and
3720+ // MariadbImage status, which must reflect all of the Galeras together.
3721+ When ("A OpenStackControlPlane has more than one Galera" , func () {
3722+ setGaleraStatus := func (name types.NamespacedName , generationObserved bool , ready bool ) {
3723+ Eventually (func (g Gomega ) {
3724+ db := & mariadbv1.Galera {}
3725+ g .Expect (th .K8sClient .Get (th .Ctx , name , db )).Should (Succeed ())
3726+ db .Status .ObservedGeneration = db .Generation
3727+ if ! generationObserved {
3728+ db .Status .ObservedGeneration = db .Generation - 1
3729+ }
3730+ db .Status .Conditions = condition.Conditions {}
3731+ if ready {
3732+ db .Status .Conditions .MarkTrue (condition .ReadyCondition , condition .ReadyMessage )
3733+ db .Status .Conditions .MarkTrue (condition .DeploymentReadyCondition , condition .DeploymentReadyMessage )
3734+ } else {
3735+ db .Status .Conditions .Set (condition .FalseCondition (
3736+ condition .ReadyCondition , condition .RequestedReason , condition .SeverityInfo , "upgrading" ))
3737+ db .Status .Conditions .Set (condition .FalseCondition (
3738+ condition .DeploymentReadyCondition , condition .RequestedReason , condition .SeverityInfo , "upgrading" ))
3739+ }
3740+ g .Expect (th .K8sClient .Status ().Update (th .Ctx , db )).To (Succeed ())
3741+ }, timeout , interval ).Should (Succeed ())
3742+ }
3743+
3744+ expectMariaDBNotReported := func () {
3745+ Consistently (func (g Gomega ) {
3746+ OSCtlplane := GetOpenStackControlPlane (names .OpenStackControlplaneName )
3747+ g .Expect (OSCtlplane .Status .Conditions .IsTrue (
3748+ corev1 .OpenStackControlPlaneMariaDBReadyCondition )).To (BeFalse ())
3749+ g .Expect (OSCtlplane .Status .ContainerImages .MariadbImage ).To (BeNil ())
3750+ }, "5s" , interval ).Should (Succeed ())
3751+ }
3752+
3753+ BeforeEach (func () {
3754+ spec := GetDefaultOpenStackControlPlaneSpec ()
3755+ spec ["tls" ] = GetTLSPublicSpec ()
3756+ DeferCleanup (
3757+ th .DeleteInstance ,
3758+ CreateOpenStackControlPlane (names .OpenStackControlplaneName , spec ),
3759+ )
3760+ Eventually (func (g Gomega ) {
3761+ db := & mariadbv1.Galera {}
3762+ g .Expect (th .K8sClient .Get (th .Ctx , names .DBName , db )).Should (Succeed ())
3763+ g .Expect (th .K8sClient .Get (th .Ctx , names .DBCell1Name , db )).Should (Succeed ())
3764+ }, timeout , interval ).Should (Succeed ())
3765+ })
3766+
3767+ It ("does not report MariaDB ready until all of them are ready" , func () {
3768+ setGaleraStatus (names .DBCell1Name , true , true )
3769+ setGaleraStatus (names .DBName , true , false )
3770+ expectMariaDBNotReported ()
3771+
3772+ setGaleraStatus (names .DBName , true , true )
3773+ Eventually (func (g Gomega ) {
3774+ OSCtlplane := GetOpenStackControlPlane (names .OpenStackControlplaneName )
3775+ version := GetOpenStackVersion (names .OpenStackVersionName )
3776+ g .Expect (OSCtlplane .Status .Conditions .IsTrue (
3777+ corev1 .OpenStackControlPlaneMariaDBReadyCondition )).To (BeTrue ())
3778+ g .Expect (OSCtlplane .Status .ContainerImages .MariadbImage ).To (
3779+ Equal (version .Status .ContainerImages .MariadbImage ))
3780+ }, timeout , interval ).Should (Succeed ())
3781+ })
3782+
3783+ It ("does not report MariaDB ready from a Galera with stale status" , func () {
3784+ setGaleraStatus (names .DBCell1Name , true , true )
3785+ setGaleraStatus (names .DBName , false , true )
3786+ expectMariaDBNotReported ()
3787+ })
3788+ })
3789+
37193790 //
37203791 // MariaDB major version upgrade (ServiceDefaults.MariadbVersion -> Galera TargetVersion)
37213792 //
0 commit comments