diff --git a/pkg/providers/cloudstack/reconciler/reconciler_test.go b/pkg/providers/cloudstack/reconciler/reconciler_test.go index 2ba4f5cd25cf2..6f05e3ac8750e 100644 --- a/pkg/providers/cloudstack/reconciler/reconciler_test.go +++ b/pkg/providers/cloudstack/reconciler/reconciler_test.go @@ -48,7 +48,27 @@ func TestReconcilerReconcileSuccess(t *testing.T) { // We want to check that the cluster status is cleaned up if validations are passed tt.cluster.SetFailure(anywherev1.FailureReasonType("InvalidCluster"), "invalid cluster") - tt.eksaSupportObjs = append(tt.eksaSupportObjs, tt.secret, tt.kcp) + kcp := test.KubeadmControlPlane(func(kcp *controlplanev1.KubeadmControlPlane) { + kcp.Name = tt.cluster.Name + kcp.Spec = controlplanev1.KubeadmControlPlaneSpec{ + MachineTemplate: controlplanev1.KubeadmControlPlaneMachineTemplate{ + InfrastructureRef: corev1.ObjectReference{ + Name: fmt.Sprintf("%s-control-plane-1", tt.cluster.Name), + }, + }, + } + kcp.Status = controlplanev1.KubeadmControlPlaneStatus{ + Conditions: clusterv1.Conditions{ + { + Type: clusterapi.ReadyCondition, + Status: corev1.ConditionTrue, + LastTransitionTime: metav1.NewTime(time.Now()), + }, + }, + ObservedGeneration: 2, + } + }) + tt.eksaSupportObjs = append(tt.eksaSupportObjs, tt.secret, kcp) tt.createAllObjs() logger := test.NewNullLogger() @@ -178,17 +198,27 @@ func TestReconcilerControlPlaneIsNotReady(t *testing.T) { tt := newReconcilerTest(t) - tt.kcp.Status = controlplanev1.KubeadmControlPlaneStatus{ - Conditions: clusterv1.Conditions{ - { - Type: clusterapi.ReadyCondition, - Status: corev1.ConditionFalse, - LastTransitionTime: metav1.NewTime(time.Now()), + kcp := test.KubeadmControlPlane(func(kcp *controlplanev1.KubeadmControlPlane) { + kcp.Name = tt.cluster.Name + kcp.Spec = controlplanev1.KubeadmControlPlaneSpec{ + MachineTemplate: controlplanev1.KubeadmControlPlaneMachineTemplate{ + InfrastructureRef: corev1.ObjectReference{ + Name: fmt.Sprintf("%s-control-plane-1", tt.cluster.Name), + }, }, - }, - ObservedGeneration: 2, - } - tt.eksaSupportObjs = append(tt.eksaSupportObjs, tt.kcp, tt.secret) + } + kcp.Status = controlplanev1.KubeadmControlPlaneStatus{ + Conditions: clusterv1.Conditions{ + { + Type: clusterapi.ReadyCondition, + Status: corev1.ConditionFalse, + LastTransitionTime: metav1.NewTime(time.Now()), + }, + }, + ObservedGeneration: 2, + } + }) + tt.eksaSupportObjs = append(tt.eksaSupportObjs, kcp, tt.secret) tt.createAllObjs() logger := test.NewNullLogger() @@ -542,7 +572,6 @@ type reconcilerTest struct { validatorRegistry *cloudstack.MockValidatorRegistry execConfig *decoder.CloudStackExecConfig secret *corev1.Secret - kcp *controlplanev1.KubeadmControlPlane } func newReconcilerTest(t testing.TB) *reconcilerTest { @@ -647,28 +676,6 @@ func newReconcilerTest(t testing.TB) *reconcilerTest { c.Spec.EksaVersion = &version }) - - kcp := test.KubeadmControlPlane(func(kcp *controlplanev1.KubeadmControlPlane) { - kcp.Name = cluster.Name - kcp.Spec = controlplanev1.KubeadmControlPlaneSpec{ - MachineTemplate: controlplanev1.KubeadmControlPlaneMachineTemplate{ - InfrastructureRef: corev1.ObjectReference{ - Name: fmt.Sprintf("%s-control-plane-1", cluster.Name), - }, - }, - } - kcp.Status = controlplanev1.KubeadmControlPlaneStatus{ - Conditions: clusterv1.Conditions{ - { - Type: clusterapi.ReadyCondition, - Status: corev1.ConditionTrue, - LastTransitionTime: metav1.NewTime(time.Now()), - }, - }, - ObservedGeneration: 2, - } - }) - secret := &corev1.Secret{ TypeMeta: metav1.TypeMeta{ APIVersion: "v1", @@ -710,7 +717,6 @@ func newReconcilerTest(t testing.TB) *reconcilerTest { validatorRegistry: validatorRegistry, execConfig: execConfig, secret: secret, - kcp: kcp, } t.Cleanup(tt.cleanup) diff --git a/pkg/providers/snow/reconciler/reconciler_test.go b/pkg/providers/snow/reconciler/reconciler_test.go index 3fbc7218cf219..0ae24cf839ed0 100644 --- a/pkg/providers/snow/reconciler/reconciler_test.go +++ b/pkg/providers/snow/reconciler/reconciler_test.go @@ -43,8 +43,27 @@ func TestReconcilerReconcileSuccess(t *testing.T) { tt := newReconcilerTest(t) // We want to check that the cluster status is cleaned up if validations are passed tt.cluster.SetFailure(anywherev1.FailureReasonType("InvalidCluster"), "invalid cluster") - - tt.eksaSupportObjs = append(tt.eksaSupportObjs, tt.kcp) + kcp := test.KubeadmControlPlane(func(kcp *controlplanev1.KubeadmControlPlane) { + kcp.Name = tt.cluster.Name + kcp.Spec = controlplanev1.KubeadmControlPlaneSpec{ + MachineTemplate: controlplanev1.KubeadmControlPlaneMachineTemplate{ + InfrastructureRef: corev1.ObjectReference{ + Name: fmt.Sprintf("%s-control-plane-1", tt.cluster.Name), + }, + }, + } + kcp.Status = controlplanev1.KubeadmControlPlaneStatus{ + Conditions: clusterv1.Conditions{ + { + Type: clusterapi.ReadyCondition, + Status: corev1.ConditionTrue, + LastTransitionTime: metav1.NewTime(time.Now()), + }, + }, + ObservedGeneration: 2, + } + }) + tt.eksaSupportObjs = append(tt.eksaSupportObjs, kcp) tt.createAllObjs() logger := test.NewNullLogger() @@ -230,16 +249,26 @@ func TestReconcilerReconcileControlPlane(t *testing.T) { func TestReconcilerCheckControlPlaneReadyItIsReady(t *testing.T) { tt := newReconcilerTest(t) - tt.kcp.Status = controlplanev1.KubeadmControlPlaneStatus{ - Conditions: clusterv1.Conditions{ - { - Type: clusterapi.ReadyCondition, - Status: corev1.ConditionTrue, - LastTransitionTime: metav1.NewTime(time.Now()), + kcp := test.KubeadmControlPlane(func(kcp *controlplanev1.KubeadmControlPlane) { + kcp.Name = tt.cluster.Name + kcp.Spec = controlplanev1.KubeadmControlPlaneSpec{ + MachineTemplate: controlplanev1.KubeadmControlPlaneMachineTemplate{ + InfrastructureRef: corev1.ObjectReference{ + Name: fmt.Sprintf("%s-control-plane-1", tt.cluster.Name), + }, }, - }, - } - tt.eksaSupportObjs = append(tt.eksaSupportObjs, tt.kcp) + } + kcp.Status = controlplanev1.KubeadmControlPlaneStatus{ + Conditions: clusterv1.Conditions{ + { + Type: clusterapi.ReadyCondition, + Status: corev1.ConditionTrue, + LastTransitionTime: metav1.NewTime(time.Now()), + }, + }, + } + }) + tt.eksaSupportObjs = append(tt.eksaSupportObjs, kcp) tt.withFakeClient() result, err := tt.reconciler().CheckControlPlaneReady(tt.ctx, test.NewNullLogger(), tt.buildSpec()) @@ -304,7 +333,6 @@ type reconcilerTest struct { eksaSupportObjs []client.Object machineConfigControlPlane *anywherev1.SnowMachineConfig machineConfigWorker *anywherev1.SnowMachineConfig - kcp *controlplanev1.KubeadmControlPlane } func newReconcilerTest(t testing.TB) *reconcilerTest { @@ -394,27 +422,6 @@ func newReconcilerTest(t testing.TB) *reconcilerTest { c.Spec.EksaVersion = &version }) - kcp := test.KubeadmControlPlane(func(kcp *controlplanev1.KubeadmControlPlane) { - kcp.Name = cluster.Name - kcp.Spec = controlplanev1.KubeadmControlPlaneSpec{ - MachineTemplate: controlplanev1.KubeadmControlPlaneMachineTemplate{ - InfrastructureRef: corev1.ObjectReference{ - Name: fmt.Sprintf("%s-control-plane-1", cluster.Name), - }, - }, - } - kcp.Status = controlplanev1.KubeadmControlPlaneStatus{ - Conditions: clusterv1.Conditions{ - { - Type: clusterapi.ReadyCondition, - Status: corev1.ConditionTrue, - LastTransitionTime: metav1.NewTime(time.Now()), - }, - }, - ObservedGeneration: 2, - } - }) - tt := &reconcilerTest{ t: t, WithT: NewWithT(t), @@ -439,7 +446,6 @@ func newReconcilerTest(t testing.TB) *reconcilerTest { cluster: cluster, machineConfigControlPlane: machineConfigCP, machineConfigWorker: machineConfigWN, - kcp: kcp, } t.Cleanup(tt.cleanup) diff --git a/pkg/providers/vsphere/reconciler/reconciler_test.go b/pkg/providers/vsphere/reconciler/reconciler_test.go index 70970e1669100..7640ce513dc94 100644 --- a/pkg/providers/vsphere/reconciler/reconciler_test.go +++ b/pkg/providers/vsphere/reconciler/reconciler_test.go @@ -52,7 +52,27 @@ func TestReconcilerReconcileSuccess(t *testing.T) { // We want to check that the cluster status is cleaned up if validations are passed tt.cluster.SetFailure(anywherev1.FailureReasonType("InvalidCluster"), "invalid cluster") - tt.eksaSupportObjs = append(tt.eksaSupportObjs, tt.kcp) + kcp := test.KubeadmControlPlane(func(kcp *controlplanev1.KubeadmControlPlane) { + kcp.Name = tt.cluster.Name + kcp.Spec = controlplanev1.KubeadmControlPlaneSpec{ + MachineTemplate: controlplanev1.KubeadmControlPlaneMachineTemplate{ + InfrastructureRef: corev1.ObjectReference{ + Name: fmt.Sprintf("%s-control-plane-1", tt.cluster.Name), + }, + }, + } + kcp.Status = controlplanev1.KubeadmControlPlaneStatus{ + Conditions: clusterv1.Conditions{ + { + Type: clusterapi.ReadyCondition, + Status: corev1.ConditionTrue, + LastTransitionTime: metav1.NewTime(time.Now()), + }, + }, + ObservedGeneration: 2, + } + }) + tt.eksaSupportObjs = append(tt.eksaSupportObjs, kcp) tt.createAllObjs() logger := test.NewNullLogger() @@ -169,18 +189,28 @@ func TestReconcilerControlPlaneIsNotReady(t *testing.T) { t.Skip("Flaky (https://github.com/aws/eks-anywhere/issues/7000)") tt := newReconcilerTest(t) - tt.kcp.Status = controlplanev1.KubeadmControlPlaneStatus{ - Conditions: clusterv1.Conditions{ - { - Type: clusterapi.ReadyCondition, - Status: corev1.ConditionFalse, - LastTransitionTime: metav1.NewTime(time.Now()), + kcp := test.KubeadmControlPlane(func(kcp *controlplanev1.KubeadmControlPlane) { + kcp.Name = tt.cluster.Name + kcp.Spec = controlplanev1.KubeadmControlPlaneSpec{ + MachineTemplate: controlplanev1.KubeadmControlPlaneMachineTemplate{ + InfrastructureRef: corev1.ObjectReference{ + Name: fmt.Sprintf("%s-control-plane-1", tt.cluster.Name), + }, }, - }, - ObservedGeneration: 2, - } + } + kcp.Status = controlplanev1.KubeadmControlPlaneStatus{ + Conditions: clusterv1.Conditions{ + { + Type: clusterapi.ReadyCondition, + Status: corev1.ConditionFalse, + LastTransitionTime: metav1.NewTime(time.Now()), + }, + }, + ObservedGeneration: 2, + } + }) - tt.eksaSupportObjs = append(tt.eksaSupportObjs, tt.kcp) + tt.eksaSupportObjs = append(tt.eksaSupportObjs, kcp) tt.createAllObjs() logger := test.NewNullLogger() @@ -352,7 +382,6 @@ type reconcilerTest struct { machineConfigControlPlane *anywherev1.VSphereMachineConfig machineConfigWorker *anywherev1.VSphereMachineConfig ipValidator *vspherereconcilermocks.MockIPValidator - kcp *controlplanev1.KubeadmControlPlane } func newReconcilerTest(t testing.TB) *reconcilerTest { @@ -440,27 +469,6 @@ func newReconcilerTest(t testing.TB) *reconcilerTest { c.Spec.EksaVersion = &version }) - kcp := test.KubeadmControlPlane(func(kcp *controlplanev1.KubeadmControlPlane) { - kcp.Name = cluster.Name - kcp.Spec = controlplanev1.KubeadmControlPlaneSpec{ - MachineTemplate: controlplanev1.KubeadmControlPlaneMachineTemplate{ - InfrastructureRef: corev1.ObjectReference{ - Name: fmt.Sprintf("%s-control-plane-1", cluster.Name), - }, - }, - } - kcp.Status = controlplanev1.KubeadmControlPlaneStatus{ - Conditions: clusterv1.Conditions{ - { - Type: clusterapi.ReadyCondition, - Status: corev1.ConditionTrue, - LastTransitionTime: metav1.NewTime(time.Now()), - }, - }, - ObservedGeneration: 2, - } - }) - tt := &reconcilerTest{ t: t, WithT: NewWithT(t), @@ -489,7 +497,6 @@ func newReconcilerTest(t testing.TB) *reconcilerTest { datacenterConfig: workloadClusterDatacenter, machineConfigControlPlane: machineConfigCP, machineConfigWorker: machineConfigWN, - kcp: kcp, } t.Cleanup(tt.cleanup) diff --git a/release/triggers/brew-version-release/CLI_RELEASE_VERSION b/release/triggers/brew-version-release/CLI_RELEASE_VERSION index 468312066c12a..c3990df253d95 100644 --- a/release/triggers/brew-version-release/CLI_RELEASE_VERSION +++ b/release/triggers/brew-version-release/CLI_RELEASE_VERSION @@ -1 +1 @@ -v0.18.1 \ No newline at end of file +v0.18.2 \ No newline at end of file