From a5810fe7a77ae10314f6c1917fc8203d00b7b1b3 Mon Sep 17 00:00:00 2001 From: Rory Z <16801068+Rory-Z@users.noreply.github.com> Date: Tue, 3 Sep 2024 16:19:15 +0800 Subject: [PATCH] WIP Signed-off-by: Rory Z <16801068+Rory-Z@users.noreply.github.com> --- apis/apps/v2beta1/status.go | 8 ++--- apis/apps/v2beta1/zz_generated.deepcopy.go | 12 +++++-- controllers/apps/v2beta1/add_emqx_core.go | 4 +++ .../apps/v2beta1/add_emqx_core_suite_test.go | 1 + .../apps/v2beta1/add_emqx_core_test.go | 2 +- controllers/apps/v2beta1/add_emqx_repl.go | 9 ++++- .../apps/v2beta1/add_emqx_repl_suite_test.go | 2 +- .../apps/v2beta1/add_emqx_repl_test.go | 2 +- .../apps/v2beta1/sync_pods_suite_test.go | 6 ++-- .../apps/v2beta1/update_emqx_status.go | 7 ++++ controllers/apps/v2beta1/util.go | 15 ++++---- e2e/v2beta1/e2e_test.go | 36 +++++++++---------- 12 files changed, 67 insertions(+), 37 deletions(-) diff --git a/apis/apps/v2beta1/status.go b/apis/apps/v2beta1/status.go index cf8528dc5..25af00acf 100644 --- a/apis/apps/v2beta1/status.go +++ b/apis/apps/v2beta1/status.go @@ -28,11 +28,11 @@ type EMQXStatus struct { // Represents the latest available observations of a EMQX Custom Resource current state. Conditions []metav1.Condition `json:"conditions,omitempty"` - CoreNodes []EMQXNode `json:"coreNodes,omitempty"` - CoreNodesStatus EMQXNodesStatus `json:"coreNodesStatus,omitempty"` + CoreNodes []EMQXNode `json:"coreNodes,omitempty"` + CoreNodesStatus *EMQXNodesStatus `json:"coreNodesStatus,omitempty"` - ReplicantNodes []EMQXNode `json:"replicantNodes,omitempty"` - ReplicantNodesStatus EMQXNodesStatus `json:"replicantNodesStatus,omitempty"` + ReplicantNodes []EMQXNode `json:"replicantNodes,omitempty"` + ReplicantNodesStatus *EMQXNodesStatus `json:"replicantNodesStatus,omitempty"` NodeEvacuationsStatus []NodeEvacuationStatus `json:"nodEvacuationsStatus,omitempty"` } diff --git a/apis/apps/v2beta1/zz_generated.deepcopy.go b/apis/apps/v2beta1/zz_generated.deepcopy.go index 77fed49ac..2bfee1a00 100644 --- a/apis/apps/v2beta1/zz_generated.deepcopy.go +++ b/apis/apps/v2beta1/zz_generated.deepcopy.go @@ -412,13 +412,21 @@ func (in *EMQXStatus) DeepCopyInto(out *EMQXStatus) { *out = make([]EMQXNode, len(*in)) copy(*out, *in) } - in.CoreNodesStatus.DeepCopyInto(&out.CoreNodesStatus) + if in.CoreNodesStatus != nil { + in, out := &in.CoreNodesStatus, &out.CoreNodesStatus + *out = new(EMQXNodesStatus) + (*in).DeepCopyInto(*out) + } if in.ReplicantNodes != nil { in, out := &in.ReplicantNodes, &out.ReplicantNodes *out = make([]EMQXNode, len(*in)) copy(*out, *in) } - in.ReplicantNodesStatus.DeepCopyInto(&out.ReplicantNodesStatus) + if in.ReplicantNodesStatus != nil { + in, out := &in.ReplicantNodesStatus, &out.ReplicantNodesStatus + *out = new(EMQXNodesStatus) + (*in).DeepCopyInto(*out) + } if in.NodeEvacuationsStatus != nil { in, out := &in.NodeEvacuationsStatus, &out.NodeEvacuationsStatus *out = make([]NodeEvacuationStatus, len(*in)) diff --git a/controllers/apps/v2beta1/add_emqx_core.go b/controllers/apps/v2beta1/add_emqx_core.go index 2c364e860..31c25befc 100644 --- a/controllers/apps/v2beta1/add_emqx_core.go +++ b/controllers/apps/v2beta1/add_emqx_core.go @@ -27,6 +27,10 @@ type addCore struct { } func (a *addCore) reconcile(ctx context.Context, logger logr.Logger, instance *appsv2beta1.EMQX, _ innerReq.RequesterInterface) subResult { + if instance.Status.CoreNodesStatus == nil { + instance.Status.CoreNodesStatus = &appsv2beta1.EMQXNodesStatus{} + } + preSts := getNewStatefulSet(instance) preStsHash := preSts.Labels[appsv2beta1.LabelsPodTemplateHashKey] updateSts, _, _ := getStateFulSetList(ctx, a.Client, instance) diff --git a/controllers/apps/v2beta1/add_emqx_core_suite_test.go b/controllers/apps/v2beta1/add_emqx_core_suite_test.go index 47f493b63..32936660b 100644 --- a/controllers/apps/v2beta1/add_emqx_core_suite_test.go +++ b/controllers/apps/v2beta1/add_emqx_core_suite_test.go @@ -46,6 +46,7 @@ var _ = Describe("Check add core controller", Ordered, Label("core"), func() { LastTransitionTime: metav1.Time{Time: time.Now().AddDate(0, 0, -1)}, }, } + instance.Status.CoreNodesStatus = &appsv2beta1.EMQXNodesStatus{} }) It("create namespace", func() { diff --git a/controllers/apps/v2beta1/add_emqx_core_test.go b/controllers/apps/v2beta1/add_emqx_core_test.go index 82d429135..46b9c9047 100644 --- a/controllers/apps/v2beta1/add_emqx_core_test.go +++ b/controllers/apps/v2beta1/add_emqx_core_test.go @@ -37,7 +37,7 @@ func TestGetNewStatefulSet(t *testing.T) { }, } instance.Spec.CoreTemplate.Spec.Replicas = ptr.To(int32(3)) - instance.Status.CoreNodesStatus = appsv2beta1.EMQXNodesStatus{ + instance.Status.CoreNodesStatus = &appsv2beta1.EMQXNodesStatus{ CollisionCount: ptr.To(int32(0)), } diff --git a/controllers/apps/v2beta1/add_emqx_repl.go b/controllers/apps/v2beta1/add_emqx_repl.go index 8b38dc491..79ce42281 100644 --- a/controllers/apps/v2beta1/add_emqx_repl.go +++ b/controllers/apps/v2beta1/add_emqx_repl.go @@ -33,6 +33,10 @@ func (a *addRepl) reconcile(ctx context.Context, logger logr.Logger, instance *a return subResult{} } + if instance.Status.ReplicantNodesStatus == nil { + instance.Status.ReplicantNodesStatus = &appsv2beta1.EMQXNodesStatus{} + } + preRs := getNewReplicaSet(instance) preRsHash := preRs.Labels[appsv2beta1.LabelsPodTemplateHashKey] updateRs, _, _ := getReplicaSetList(ctx, a.Client, instance) @@ -124,7 +128,10 @@ func getNewReplicaSet(instance *appsv2beta1.EMQX) *appsv1.ReplicaSet { svcPorts, _ := appsv2beta1.GetDashboardServicePort(instance.Spec.Config.Data) preRs := generateReplicaSet(instance) - podTemplateSpecHash := computeHash(preRs.Spec.Template.DeepCopy(), instance.Status.ReplicantNodesStatus.CollisionCount) + podTemplateSpecHash := computeHash(preRs.Spec.Template.DeepCopy(), nil) + if instance.Status.ReplicantNodesStatus != nil { + podTemplateSpecHash = computeHash(preRs.Spec.Template.DeepCopy(), instance.Status.ReplicantNodesStatus.CollisionCount) + } preRs.Name = preRs.Name + "-" + podTemplateSpecHash preRs.Labels = appsv2beta1.CloneAndAddLabel(preRs.Labels, appsv2beta1.LabelsPodTemplateHashKey, podTemplateSpecHash) preRs.Spec.Selector = appsv2beta1.CloneSelectorAndAddLabel(preRs.Spec.Selector, appsv2beta1.LabelsPodTemplateHashKey, podTemplateSpecHash) diff --git a/controllers/apps/v2beta1/add_emqx_repl_suite_test.go b/controllers/apps/v2beta1/add_emqx_repl_suite_test.go index 63eb3b082..05b3d27d7 100644 --- a/controllers/apps/v2beta1/add_emqx_repl_suite_test.go +++ b/controllers/apps/v2beta1/add_emqx_repl_suite_test.go @@ -39,7 +39,7 @@ var _ = Describe("Check add repl controller", Ordered, Label("repl"), func() { }, } instance.Status = appsv2beta1.EMQXStatus{ - ReplicantNodesStatus: appsv2beta1.EMQXNodesStatus{ + ReplicantNodesStatus: &appsv2beta1.EMQXNodesStatus{ Replicas: 3, }, Conditions: []metav1.Condition{ diff --git a/controllers/apps/v2beta1/add_emqx_repl_test.go b/controllers/apps/v2beta1/add_emqx_repl_test.go index 2752f6747..1e3ce8869 100644 --- a/controllers/apps/v2beta1/add_emqx_repl_test.go +++ b/controllers/apps/v2beta1/add_emqx_repl_test.go @@ -40,7 +40,7 @@ func TestGetNewReplicaSet(t *testing.T) { Replicas: ptr.To(int32(3)), }, } - instance.Status.ReplicantNodesStatus = appsv2beta1.EMQXNodesStatus{ + instance.Status.ReplicantNodesStatus = &appsv2beta1.EMQXNodesStatus{ CollisionCount: ptr.To(int32(0)), } diff --git a/controllers/apps/v2beta1/sync_pods_suite_test.go b/controllers/apps/v2beta1/sync_pods_suite_test.go index 32864d336..0843661a4 100644 --- a/controllers/apps/v2beta1/sync_pods_suite_test.go +++ b/controllers/apps/v2beta1/sync_pods_suite_test.go @@ -64,7 +64,7 @@ var _ = Describe("Check sync pods controller", Ordered, Label("node"), func() { LastTransitionTime: metav1.Time{Time: time.Now().AddDate(0, 0, -1)}, }, }, - CoreNodesStatus: appsv2beta1.EMQXNodesStatus{ + CoreNodesStatus: &appsv2beta1.EMQXNodesStatus{ UpdateRevision: "update", UpdateReplicas: 1, CurrentRevision: "current", @@ -72,7 +72,7 @@ var _ = Describe("Check sync pods controller", Ordered, Label("node"), func() { ReadyReplicas: 2, Replicas: 1, }, - ReplicantNodesStatus: appsv2beta1.EMQXNodesStatus{ + ReplicantNodesStatus: &appsv2beta1.EMQXNodesStatus{ UpdateRevision: "update", UpdateReplicas: 1, CurrentRevision: "current", @@ -334,7 +334,7 @@ var _ = Describe("check can be scale down", func() { Replicas: ptr.To(int32(3)), }, } - instance.Status.ReplicantNodesStatus = appsv2beta1.EMQXNodesStatus{ + instance.Status.ReplicantNodesStatus = &appsv2beta1.EMQXNodesStatus{ UpdateRevision: "update", CurrentRevision: "current", } diff --git a/controllers/apps/v2beta1/update_emqx_status.go b/controllers/apps/v2beta1/update_emqx_status.go index 3bff86a91..5eca02859 100644 --- a/controllers/apps/v2beta1/update_emqx_status.go +++ b/controllers/apps/v2beta1/update_emqx_status.go @@ -21,8 +21,15 @@ type updateStatus struct { } func (u *updateStatus) reconcile(ctx context.Context, logger logr.Logger, instance *appsv2beta1.EMQX, r innerReq.RequesterInterface) subResult { + if instance.Status.CoreNodesStatus == nil { + instance.Status.CoreNodesStatus = &appsv2beta1.EMQXNodesStatus{} + } instance.Status.CoreNodesStatus.Replicas = *instance.Spec.CoreTemplate.Spec.Replicas + if instance.Spec.ReplicantTemplate != nil { + if instance.Status.ReplicantNodesStatus == nil { + instance.Status.ReplicantNodesStatus = &appsv2beta1.EMQXNodesStatus{} + } instance.Status.ReplicantNodesStatus.Replicas = *instance.Spec.ReplicantTemplate.Spec.Replicas } diff --git a/controllers/apps/v2beta1/util.go b/controllers/apps/v2beta1/util.go index 0fee0ef3e..d0226eb7d 100644 --- a/controllers/apps/v2beta1/util.go +++ b/controllers/apps/v2beta1/util.go @@ -62,6 +62,9 @@ func getRsPodMap(ctx context.Context, k8sClient client.Client, instance *appsv2b } func getStateFulSetList(ctx context.Context, k8sClient client.Client, instance *appsv2beta1.EMQX) (updateSts, currentSts *appsv1.StatefulSet, oldStsList []*appsv1.StatefulSet) { + if instance.Status.CoreNodesStatus == nil { + return + } list := &appsv1.StatefulSetList{} _ = k8sClient.List(ctx, list, client.InNamespace(instance.Namespace), @@ -69,13 +72,13 @@ func getStateFulSetList(ctx context.Context, k8sClient client.Client, instance * ) for _, sts := range list.Items { if hash, ok := sts.Labels[appsv2beta1.LabelsPodTemplateHashKey]; ok { - if hash == instance.Status.CoreNodesStatus.UpdateRevision { + if instance.Status.CoreNodesStatus == nil && hash == instance.Status.CoreNodesStatus.UpdateRevision { updateSts = sts.DeepCopy() } - if hash == instance.Status.CoreNodesStatus.CurrentRevision { + if instance.Status.CoreNodesStatus == nil && hash == instance.Status.CoreNodesStatus.CurrentRevision { currentSts = sts.DeepCopy() } - if hash != instance.Status.CoreNodesStatus.UpdateRevision && hash != instance.Status.CoreNodesStatus.CurrentRevision { + if instance.Status.CoreNodesStatus != nil || (hash != instance.Status.CoreNodesStatus.UpdateRevision && hash != instance.Status.CoreNodesStatus.CurrentRevision) { oldStsList = append(oldStsList, sts.DeepCopy()) } } @@ -96,13 +99,13 @@ func getReplicaSetList(ctx context.Context, k8sClient client.Client, instance *a for _, rs := range list.Items { if hash, ok := rs.Labels[appsv2beta1.LabelsPodTemplateHashKey]; ok { - if hash == instance.Status.ReplicantNodesStatus.UpdateRevision { + if instance.Status.ReplicantNodesStatus != nil && hash == instance.Status.ReplicantNodesStatus.UpdateRevision { updateRs = rs.DeepCopy() } - if hash == instance.Status.ReplicantNodesStatus.CurrentRevision { + if instance.Status.ReplicantNodesStatus != nil && hash == instance.Status.ReplicantNodesStatus.CurrentRevision { currentRs = rs.DeepCopy() } - if hash != instance.Status.ReplicantNodesStatus.UpdateRevision && hash != instance.Status.ReplicantNodesStatus.CurrentRevision { + if instance.Status.ReplicantNodesStatus == nil || (hash != instance.Status.ReplicantNodesStatus.UpdateRevision && hash != instance.Status.ReplicantNodesStatus.CurrentRevision) { oldRsList = append(oldRsList, rs.DeepCopy()) } } diff --git a/e2e/v2beta1/e2e_test.go b/e2e/v2beta1/e2e_test.go index 661b0b610..d5de4d905 100644 --- a/e2e/v2beta1/e2e_test.go +++ b/e2e/v2beta1/e2e_test.go @@ -68,7 +68,7 @@ var _ = Describe("E2E Test", Label("base"), Ordered, func() { return instance.Status.CoreNodes }, HaveLen(int(*instance.Spec.CoreTemplate.Spec.Replicas))), WithTransform(func(instance *appsv2beta1.EMQX) appsv2beta1.EMQXNodesStatus { - return instance.Status.CoreNodesStatus + return *instance.Status.CoreNodesStatus }, And( HaveField("Replicas", Equal(int32(*instance.Spec.CoreTemplate.Spec.Replicas))), HaveField("ReadyReplicas", Equal(int32(*instance.Spec.CoreTemplate.Spec.Replicas))), @@ -81,7 +81,7 @@ var _ = Describe("E2E Test", Label("base"), Ordered, func() { return instance.Status.ReplicantNodes }, BeNil()), WithTransform(func(instance *appsv2beta1.EMQX) appsv2beta1.EMQXNodesStatus { - return instance.Status.ReplicantNodesStatus + return *instance.Status.ReplicantNodesStatus }, And( HaveField("Replicas", Equal(int32(0))), HaveField("ReadyReplicas", Equal(int32(0))), @@ -126,7 +126,7 @@ var _ = Describe("E2E Test", Label("base"), Ordered, func() { return instance.Status.CoreNodes }, HaveLen(int(*instance.Spec.CoreTemplate.Spec.Replicas))), WithTransform(func(instance *appsv2beta1.EMQX) appsv2beta1.EMQXNodesStatus { - return instance.Status.CoreNodesStatus + return *instance.Status.CoreNodesStatus }, And( HaveField("Replicas", Equal(int32(*instance.Spec.CoreTemplate.Spec.Replicas))), HaveField("ReadyReplicas", Equal(int32(*instance.Spec.CoreTemplate.Spec.Replicas))), @@ -139,7 +139,7 @@ var _ = Describe("E2E Test", Label("base"), Ordered, func() { return instance.Status.ReplicantNodes }, BeNil()), WithTransform(func(instance *appsv2beta1.EMQX) appsv2beta1.EMQXNodesStatus { - return instance.Status.ReplicantNodesStatus + return *instance.Status.ReplicantNodesStatus }, And( HaveField("Replicas", Equal(int32(0))), HaveField("ReadyReplicas", Equal(int32(0))), @@ -184,7 +184,7 @@ var _ = Describe("E2E Test", Label("base"), Ordered, func() { return instance.Status.CoreNodes }, HaveLen(int(*instance.Spec.CoreTemplate.Spec.Replicas))), WithTransform(func(instance *appsv2beta1.EMQX) appsv2beta1.EMQXNodesStatus { - return instance.Status.CoreNodesStatus + return *instance.Status.CoreNodesStatus }, And( HaveField("Replicas", Equal(int32(*instance.Spec.CoreTemplate.Spec.Replicas))), HaveField("ReadyReplicas", Equal(int32(*instance.Spec.CoreTemplate.Spec.Replicas))), @@ -197,7 +197,7 @@ var _ = Describe("E2E Test", Label("base"), Ordered, func() { return instance.Status.ReplicantNodes }, BeNil()), WithTransform(func(instance *appsv2beta1.EMQX) appsv2beta1.EMQXNodesStatus { - return instance.Status.ReplicantNodesStatus + return *instance.Status.ReplicantNodesStatus }, And( HaveField("Replicas", Equal(int32(0))), HaveField("ReadyReplicas", Equal(int32(0))), @@ -239,7 +239,7 @@ var _ = Describe("E2E Test", Label("base"), Ordered, func() { return instance.Status.IsConditionTrue(appsv2beta1.Ready) }, BeTrue()), WithTransform(func(instance *appsv2beta1.EMQX) appsv2beta1.EMQXNodesStatus { - return instance.Status.CoreNodesStatus + return *instance.Status.CoreNodesStatus }, And( HaveField("Replicas", Equal(int32(*instance.Spec.CoreTemplate.Spec.Replicas))), HaveField("ReadyReplicas", Equal(int32(*instance.Spec.CoreTemplate.Spec.Replicas))), @@ -249,7 +249,7 @@ var _ = Describe("E2E Test", Label("base"), Ordered, func() { HaveField("UpdateReplicas", Equal(int32(*instance.Spec.CoreTemplate.Spec.Replicas))), )), WithTransform(func(instance *appsv2beta1.EMQX) appsv2beta1.EMQXNodesStatus { - return instance.Status.ReplicantNodesStatus + return *instance.Status.ReplicantNodesStatus }, And( HaveField("Replicas", Equal(int32(0))), HaveField("ReadyReplicas", Equal(int32(0))), @@ -358,7 +358,7 @@ var _ = Describe("E2E Test", Label("base"), Ordered, func() { return instance.Status.IsConditionTrue(appsv2beta1.Ready) }, BeTrue()), WithTransform(func(instance *appsv2beta1.EMQX) appsv2beta1.EMQXNodesStatus { - return instance.Status.CoreNodesStatus + return *instance.Status.CoreNodesStatus }, And( HaveField("Replicas", Equal(int32(*instance.Spec.CoreTemplate.Spec.Replicas))), HaveField("ReadyReplicas", Equal(int32(*instance.Spec.CoreTemplate.Spec.Replicas))), @@ -368,7 +368,7 @@ var _ = Describe("E2E Test", Label("base"), Ordered, func() { HaveField("UpdateReplicas", Equal(int32(*instance.Spec.CoreTemplate.Spec.Replicas))), )), WithTransform(func(instance *appsv2beta1.EMQX) appsv2beta1.EMQXNodesStatus { - return instance.Status.ReplicantNodesStatus + return *instance.Status.ReplicantNodesStatus }, And( HaveField("Replicas", Equal(int32(*instance.Spec.ReplicantTemplate.Spec.Replicas))), HaveField("ReadyReplicas", Equal(int32(*instance.Spec.ReplicantTemplate.Spec.Replicas))), @@ -413,7 +413,7 @@ var _ = Describe("E2E Test", Label("base"), Ordered, func() { return instance.Status.CoreNodes }, HaveLen(int(*instance.Spec.CoreTemplate.Spec.Replicas))), WithTransform(func(instance *appsv2beta1.EMQX) appsv2beta1.EMQXNodesStatus { - return instance.Status.CoreNodesStatus + return *instance.Status.CoreNodesStatus }, And( HaveField("Replicas", Equal(int32(*instance.Spec.CoreTemplate.Spec.Replicas))), HaveField("ReadyReplicas", Equal(int32(*instance.Spec.CoreTemplate.Spec.Replicas))), @@ -426,7 +426,7 @@ var _ = Describe("E2E Test", Label("base"), Ordered, func() { return instance.Status.ReplicantNodes }, HaveLen(int(*instance.Spec.ReplicantTemplate.Spec.Replicas))), WithTransform(func(instance *appsv2beta1.EMQX) appsv2beta1.EMQXNodesStatus { - return instance.Status.ReplicantNodesStatus + return *instance.Status.ReplicantNodesStatus }, And( HaveField("Replicas", Equal(int32(*instance.Spec.ReplicantTemplate.Spec.Replicas))), HaveField("ReadyReplicas", Equal(int32(*instance.Spec.ReplicantTemplate.Spec.Replicas))), @@ -471,7 +471,7 @@ var _ = Describe("E2E Test", Label("base"), Ordered, func() { return instance.Status.CoreNodes }, HaveLen(int(*instance.Spec.CoreTemplate.Spec.Replicas))), WithTransform(func(instance *appsv2beta1.EMQX) appsv2beta1.EMQXNodesStatus { - return instance.Status.CoreNodesStatus + return *instance.Status.CoreNodesStatus }, And( HaveField("Replicas", Equal(int32(*instance.Spec.CoreTemplate.Spec.Replicas))), HaveField("ReadyReplicas", Equal(int32(*instance.Spec.CoreTemplate.Spec.Replicas))), @@ -484,7 +484,7 @@ var _ = Describe("E2E Test", Label("base"), Ordered, func() { return instance.Status.ReplicantNodes }, HaveLen(int(*instance.Spec.ReplicantTemplate.Spec.Replicas))), WithTransform(func(instance *appsv2beta1.EMQX) appsv2beta1.EMQXNodesStatus { - return instance.Status.ReplicantNodesStatus + return *instance.Status.ReplicantNodesStatus }, And( HaveField("Replicas", Equal(int32(0))), HaveField("ReadyReplicas", Equal(int32(0))), @@ -526,7 +526,7 @@ var _ = Describe("E2E Test", Label("base"), Ordered, func() { return instance.Status.IsConditionTrue(appsv2beta1.Ready) }, BeTrue()), WithTransform(func(instance *appsv2beta1.EMQX) appsv2beta1.EMQXNodesStatus { - return instance.Status.CoreNodesStatus + return *instance.Status.CoreNodesStatus }, And( HaveField("Replicas", Equal(int32(*instance.Spec.CoreTemplate.Spec.Replicas))), HaveField("ReadyReplicas", Equal(int32(*instance.Spec.CoreTemplate.Spec.Replicas))), @@ -536,7 +536,7 @@ var _ = Describe("E2E Test", Label("base"), Ordered, func() { HaveField("UpdateReplicas", Equal(int32(*instance.Spec.CoreTemplate.Spec.Replicas))), )), WithTransform(func(instance *appsv2beta1.EMQX) appsv2beta1.EMQXNodesStatus { - return instance.Status.ReplicantNodesStatus + return *instance.Status.ReplicantNodesStatus }, And( HaveField("Replicas", Equal(int32(*instance.Spec.ReplicantTemplate.Spec.Replicas))), HaveField("ReadyReplicas", Equal(int32(*instance.Spec.ReplicantTemplate.Spec.Replicas))), @@ -579,7 +579,7 @@ var _ = Describe("E2E Test", Label("base"), Ordered, func() { return instance.Status.IsConditionTrue(appsv2beta1.Ready) }, BeTrue()), WithTransform(func(instance *appsv2beta1.EMQX) appsv2beta1.EMQXNodesStatus { - return instance.Status.CoreNodesStatus + return *instance.Status.CoreNodesStatus }, And( HaveField("Replicas", Equal(int32(*instance.Spec.CoreTemplate.Spec.Replicas))), HaveField("ReadyReplicas", Equal(int32(*instance.Spec.CoreTemplate.Spec.Replicas))), @@ -589,7 +589,7 @@ var _ = Describe("E2E Test", Label("base"), Ordered, func() { HaveField("UpdateReplicas", Equal(int32(*instance.Spec.CoreTemplate.Spec.Replicas))), )), WithTransform(func(instance *appsv2beta1.EMQX) appsv2beta1.EMQXNodesStatus { - return instance.Status.ReplicantNodesStatus + return *instance.Status.ReplicantNodesStatus }, And( HaveField("Replicas", Equal(int32(0))), HaveField("ReadyReplicas", Equal(int32(0))),