diff --git a/controllers/operands/kubevirt.go b/controllers/operands/kubevirt.go index fb873d307..4d4cb6629 100644 --- a/controllers/operands/kubevirt.go +++ b/controllers/operands/kubevirt.go @@ -813,9 +813,9 @@ func hcoConfig2KvConfig(hcoConfig hcov1beta1.HyperConvergedConfig, controlPlaneH kvConfig.Replicas = ptr.To[uint8](1) } - // In case there are no worker nodes, we're setting an empty struct for NodePlacement - // so that kubevirt control plane pods won't have any affinity rules, and they could get - // scheduled onto worker nodes. + // In case there are no control plane / master nodes in the cluster, we're setting + // an empty struct for NodePlacement so that kubevirt control plane pods won't have + // any affinity rules, and they could get scheduled onto worker nodes. if hcoConfig.NodePlacement == nil && !controlPlaneNodeExists { kvConfig.NodePlacement = &kubevirtcorev1.NodePlacement{} return kvConfig diff --git a/controllers/operands/kubevirt_test.go b/controllers/operands/kubevirt_test.go index 361352761..e6fb8d243 100644 --- a/controllers/operands/kubevirt_test.go +++ b/controllers/operands/kubevirt_test.go @@ -3022,7 +3022,7 @@ Version: 1.2.3`) kv, err := NewKubeVirt(hco) Expect(err).ToNot(HaveOccurred()) Expect(kv.Spec.Infra).To(Not(BeNil())) - Expect(*kv.Spec.Infra.Replicas).To(Equal(uint8(1))) + Expect(kv.Spec.Infra.Replicas).To(HaveValue(Equal(uint8(1)))) Expect(kv.Spec.Workloads).To(BeNil()) }) @@ -3066,8 +3066,7 @@ Version: 1.2.3`) kv, err := NewKubeVirt(hco) Expect(err).ToNot(HaveOccurred()) Expect(kv.Spec.Infra).To(Not(BeNil())) - Expect(kv.Spec.Infra.Replicas).To(Not(BeNil())) - Expect(*kv.Spec.Infra.Replicas).To(Equal(uint8(1))) + Expect(kv.Spec.Infra.Replicas).To(HaveValue(Equal(uint8(1)))) Expect(kv.Spec.Workloads).To(Not(BeNil())) Expect(kv.Spec.Workloads.Replicas).To(BeNil()) }) @@ -3107,8 +3106,7 @@ Version: 1.2.3`) kv, err := NewKubeVirt(hco) Expect(err).ToNot(HaveOccurred()) Expect(kv.Spec.Infra).To(Not(BeNil())) - Expect(kv.Spec.Infra.Replicas).To(Not(BeNil())) - Expect(*kv.Spec.Infra.Replicas).To(Equal(uint8(1))) + Expect(kv.Spec.Infra.Replicas).To(HaveValue(Equal(uint8(1)))) Expect(kv.Spec.Workloads).To(BeNil()) }) @@ -3129,8 +3127,7 @@ Version: 1.2.3`) kv, err := NewKubeVirt(hco) Expect(err).ToNot(HaveOccurred()) Expect(kv.Spec.Infra).To(Not(BeNil())) - Expect(kv.Spec.Infra.Replicas).To(Not(BeNil())) - Expect(*kv.Spec.Infra.Replicas).To(Equal(uint8(1))) + Expect(kv.Spec.Infra.Replicas).To(HaveValue(Equal(uint8(1)))) Expect(kv.Spec.Workloads).To(Not(BeNil())) Expect(kv.Spec.Workloads.Replicas).To(BeNil()) })