@@ -226,69 +226,48 @@ func (d *routeReconcilerImpl) resolveRefGateway(parentRef gwv1.ParentReference,
226226// setCondition based on RouteStatusInfo
227227func (d * routeReconcilerImpl ) setConditionsWithRouteStatusInfo (route client.Object , parentStatus * gwv1.RouteParentStatus , info routeutils.RouteStatusInfo ) {
228228 timeNow := metav1 .NewTime (time .Now ())
229+ var conditions []metav1.Condition
229230 if ! info .ResolvedRefs {
230- // resolvedRef rejected
231- parentStatus .Conditions = []metav1.Condition {
232- {
233- Type : string (gwv1 .RouteConditionAccepted ),
234- Status : metav1 .ConditionFalse ,
235- Reason : info .Reason ,
236- Message : info .Message ,
237- LastTransitionTime : timeNow ,
238- ObservedGeneration : route .GetGeneration (),
239- },
240- {
241- Type : string (gwv1 .RouteConditionResolvedRefs ),
242- Status : metav1 .ConditionFalse ,
243- Reason : info .Reason ,
244- Message : info .Message ,
245- LastTransitionTime : timeNow ,
246- ObservedGeneration : route .GetGeneration (),
247- },
248- }
249- return
231+ conditions = append (conditions , metav1.Condition {
232+ Type : string (gwv1 .RouteConditionResolvedRefs ),
233+ Status : metav1 .ConditionFalse ,
234+ Reason : info .Reason ,
235+ Message : info .Message ,
236+ LastTransitionTime : timeNow ,
237+ ObservedGeneration : route .GetGeneration (),
238+ })
239+ } else {
240+ conditions = append (conditions , metav1.Condition {
241+ Type : string (gwv1 .RouteConditionResolvedRefs ),
242+ Status : metav1 .ConditionTrue ,
243+ Reason : string (gwv1 .RouteReasonResolvedRefs ),
244+ Message : "" ,
245+ LastTransitionTime : timeNow ,
246+ ObservedGeneration : route .GetGeneration (),
247+ })
250248 }
251- // resolveRef accepted and route accepted
252- if info .Accepted {
253- parentStatus .Conditions = []metav1.Condition {
254- {
255- Type : string (gwv1 .RouteConditionAccepted ),
256- Status : metav1 .ConditionTrue ,
257- Reason : info .Reason ,
258- Message : info .Message ,
259- LastTransitionTime : timeNow ,
260- ObservedGeneration : route .GetGeneration (),
261- },
262- {
263- Type : string (gwv1 .RouteConditionResolvedRefs ),
264- Status : metav1 .ConditionTrue ,
265- Reason : string (gwv1 .RouteReasonResolvedRefs ),
266- LastTransitionTime : timeNow ,
267- ObservedGeneration : route .GetGeneration (),
268- },
269- }
270- return
249+
250+ if ! info .Accepted {
251+ conditions = append (conditions , metav1.Condition {
252+ Type : string (gwv1 .RouteConditionAccepted ),
253+ Status : metav1 .ConditionFalse ,
254+ Reason : info .Reason ,
255+ Message : info .Message ,
256+ LastTransitionTime : timeNow ,
257+ ObservedGeneration : route .GetGeneration (),
258+ })
271259 } else {
272- // resolveRef accepted but route rejected
273- parentStatus .Conditions = []metav1.Condition {
274- {
275- Type : string (gwv1 .RouteConditionAccepted ),
276- Status : metav1 .ConditionFalse ,
277- Reason : info .Reason ,
278- Message : info .Message ,
279- LastTransitionTime : timeNow ,
280- ObservedGeneration : route .GetGeneration (),
281- },
282- {
283- Type : string (gwv1 .RouteConditionResolvedRefs ),
284- Status : metav1 .ConditionTrue ,
285- Reason : string (gwv1 .RouteReasonAccepted ),
286- LastTransitionTime : timeNow ,
287- ObservedGeneration : route .GetGeneration (),
288- },
289- }
290- return
260+ conditions = append (conditions , metav1.Condition {
261+ Type : string (gwv1 .RouteConditionAccepted ),
262+ Status : metav1 .ConditionTrue ,
263+ Reason : string (gwv1 .RouteReasonAccepted ),
264+ Message : "" ,
265+ LastTransitionTime : timeNow ,
266+ ObservedGeneration : route .GetGeneration (),
267+ })
291268 }
269+
270+ parentStatus .Conditions = conditions
292271}
293272
294273func (d * routeReconcilerImpl ) setConditionsBasedOnResolveRefGateway (route client.Object , parentStatus * gwv1.RouteParentStatus , resolveErr error ) {
0 commit comments