@@ -723,9 +723,19 @@ func ClusterctlUpgradeSpec(ctx context.Context, inputGetter func() ClusterctlUpg
723723 upgrade .PostUpgrade (managementClusterProxy , workloadCluster .Namespace , workloadCluster .Name )
724724 }
725725
726- Byf ("[%d] Verify v1beta2 Available and Ready conditions (if exist) to be true for Cluster and Machines" , i )
727- verifyV1Beta2ConditionsTrueV1Beta1 (ctx , managementClusterProxy .GetClient (), workloadCluster .Name , workloadCluster .Namespace ,
728- []string {clusterv1 .AvailableCondition , clusterv1 .ReadyCondition })
726+ Byf ("[%d] Verify Cluster Available condition is true" , i )
727+ framework .VerifyClusterAvailable (ctx , framework.VerifyClusterAvailableInput {
728+ Getter : managementClusterProxy .GetClient (),
729+ Name : workloadCluster .Name ,
730+ Namespace : workloadCluster .Namespace ,
731+ })
732+
733+ Byf ("[%d] Verify Machines Ready condition is true" , i )
734+ framework .VerifyMachinesReady (ctx , framework.VerifyMachinesReadyInput {
735+ Lister : managementClusterProxy .GetClient (),
736+ Name : workloadCluster .Name ,
737+ Namespace : workloadCluster .Namespace ,
738+ })
729739
730740 // If this is the last step of the upgrade sequence check hat the resourceVersions are stable, i.e. it verifies there are no
731741 // continuous reconciles when everything should be stable.
@@ -809,53 +819,6 @@ func ClusterctlUpgradeSpec(ctx context.Context, inputGetter func() ClusterctlUpg
809819 })
810820}
811821
812- // verifyV1Beta2ConditionsTrueV1Beta1 checks the Cluster and Machines of a Cluster that
813- // the given v1beta2 condition types are set to true without a message, if they exist.
814- func verifyV1Beta2ConditionsTrueV1Beta1 (ctx context.Context , c client.Client , clusterName , clusterNamespace string , v1beta2conditionTypes []string ) {
815- cluster := & clusterv1beta1.Cluster {}
816- key := client.ObjectKey {
817- Namespace : clusterNamespace ,
818- Name : clusterName ,
819- }
820- Eventually (func () error {
821- return c .Get (ctx , key , cluster )
822- }, 3 * time .Minute , 3 * time .Second ).Should (Succeed (), "Failed to get Cluster object %s" , klog .KRef (clusterNamespace , clusterName ))
823-
824- if cluster .Status .V1Beta2 != nil && len (cluster .Status .V1Beta2 .Conditions ) > 0 {
825- for _ , conditionType := range v1beta2conditionTypes {
826- for _ , condition := range cluster .Status .V1Beta2 .Conditions {
827- if condition .Type != conditionType {
828- continue
829- }
830- Expect (condition .Status ).To (Equal (metav1 .ConditionTrue ), "The v1beta2 condition %q on the Cluster should be set to true" , conditionType )
831- Expect (condition .Message ).To (BeEmpty (), "The v1beta2 condition %q on the Cluster should have an empty message" , conditionType )
832- }
833- }
834- }
835-
836- machineList := & clusterv1beta1.MachineList {}
837- Eventually (func () error {
838- return c .List (ctx , machineList , client .InNamespace (clusterNamespace ),
839- client.MatchingLabels {
840- clusterv1 .ClusterNameLabel : clusterName ,
841- })
842- }, 3 * time .Minute , 3 * time .Second ).Should (Succeed (), "Failed to list Machines for Cluster %s" , klog .KObj (cluster ))
843- for _ , machine := range machineList .Items {
844- if machine .Status .V1Beta2 == nil || len (machine .Status .V1Beta2 .Conditions ) == 0 {
845- continue
846- }
847- for _ , conditionType := range v1beta2conditionTypes {
848- for _ , condition := range machine .Status .V1Beta2 .Conditions {
849- if condition .Type != conditionType {
850- continue
851- }
852- Expect (condition .Status ).To (Equal (metav1 .ConditionTrue ), "The v1beta2 condition %q on the Machine %q should be set to true" , conditionType , machine .Name )
853- Expect (condition .Message ).To (BeEmpty (), "The v1beta2 condition %q on the Machine %q should have an empty message" , conditionType , machine .Name )
854- }
855- }
856- }
857- }
858-
859822func setupClusterctl (ctx context.Context , clusterctlBinaryURL , clusterctlConfigPath string ) (string , string ) {
860823 clusterctlBinaryPath := downloadToTmpFile (ctx , clusterctlBinaryURL )
861824
0 commit comments