@@ -33,7 +33,9 @@ import (
3333 clusterv1beta1 "go.goms.io/fleet/apis/cluster/v1beta1"
3434 placementv1alpha1 "go.goms.io/fleet/apis/placement/v1alpha1"
3535 placementv1beta1 "go.goms.io/fleet/apis/placement/v1beta1"
36+ "go.goms.io/fleet/pkg/controllers/work"
3637 "go.goms.io/fleet/pkg/utils"
38+ "go.goms.io/fleet/pkg/utils/condition"
3739 "go.goms.io/fleet/test/e2e/framework"
3840)
3941
@@ -113,12 +115,27 @@ var (
113115 ignoreServicePortNodePortProtocolField = cmpopts .IgnoreFields (corev1.ServicePort {}, "NodePort" , "Protocol" )
114116 ignoreRPSClusterNameField = cmpopts .IgnoreFields (placementv1beta1.ResourcePlacementStatus {}, "ClusterName" )
115117
118+ // Since Fleet agents v0.14.0 a minor reason string change was applied on the hub side that
119+ // affects CRP availability status reportings in the resource placement section when untrackable
120+ // resources are involved. This transformer is added to ensure that the compatibility test specs
121+ // can handle this string change smoothly.
122+ //
123+ // Note that the aforementioned change is hub side exclusive and is for informational purposes only.
124+ availableDueToUntrackableResCondAcyclicTransformer = cmpopts .AcyclicTransformer ("AvailableDueToUntrackableResCond" , func (cond metav1.Condition ) metav1.Condition {
125+ transformedCond := cond .DeepCopy ()
126+ if cond .Type == string (placementv1beta1 .ResourcesAvailableConditionType ) && cond .Reason == work .WorkNotTrackableReason {
127+ transformedCond .Reason = condition .WorkNotAvailabilityTrackableReason
128+ }
129+ return * transformedCond
130+ })
131+
116132 crpStatusCmpOptions = cmp.Options {
117133 cmpopts .SortSlices (lessFuncConditionByType ),
118134 cmpopts .SortSlices (lessFuncPlacementStatusByClusterName ),
119135 cmpopts .SortSlices (utils .LessFuncResourceIdentifier ),
120136 cmpopts .SortSlices (utils .LessFuncFailedResourcePlacements ),
121137 utils .IgnoreConditionLTTAndMessageFields ,
138+ availableDueToUntrackableResCondAcyclicTransformer ,
122139 cmpopts .EquateEmpty (),
123140 }
124141 crpWithStuckRolloutStatusCmpOptions = cmp.Options {
@@ -128,6 +145,7 @@ var (
128145 cmpopts .SortSlices (utils .LessFuncFailedResourcePlacements ),
129146 utils .IgnoreConditionLTTAndMessageFields ,
130147 ignoreRPSClusterNameField ,
148+ availableDueToUntrackableResCondAcyclicTransformer ,
131149 cmpopts .EquateEmpty (),
132150 }
133151)
0 commit comments