Optimize proxysql nill case
@@ -132,14 +132,7 @@ func (r *ReconcilePerconaXtraDBCluster) updateStatus(cr *api.PerconaXtraDBCluste
}
}
cr.Status.Status = cr.Status.PXC.Status
- case cr.Spec.ProxySQL == nil && cr.Status.PXC.Status == api.AppStateReady:
- clusterCondition = api.ClusterCondition{
- Status: api.ConditionTrue,
- Type: api.ClusterReady,
- LastTransitionTime: metav1.NewTime(time.Now()),
- }
- cr.Status.Status = cr.Status.PXC.Status
- case cr.Spec.ProxySQL != nil && cr.Spec.ProxySQL.Enabled == false && cr.Status.PXC.Status == api.AppStateReady:
+ case (cr.Spec.ProxySQL == nil || cr.Spec.ProxySQL.Enabled == false) && cr.Status.PXC.Status == api.AppStateReady:
clusterCondition = api.ClusterCondition{
Status: api.ConditionTrue,
Type: api.ClusterReady,
@@ -153,7 +146,7 @@ func (r *ReconcilePerconaXtraDBCluster) updateStatus(cr *api.PerconaXtraDBCluste
LastTransitionTime: metav1.NewTime(time.Now()),
}
cr.Status.Status = api.AppStateError
- case cr.Status.PXC.Status == api.AppStateInit || cr.Status.ProxySQL.Status == api.AppStateInit:
+ case cr.Status.PXC.Status == api.AppStateInit || cr.Spec.ProxySQL == nil || cr.Status.ProxySQL.Status == api.AppStateInit:
clusterCondition = api.ClusterCondition{
Status: api.ConditionTrue,
Type: api.ClusterInit,
