@@ -193,9 +193,23 @@ func (c *Controller) buildEnvoyResourcesForGateway(gateway *gatewayv1.Gateway) (
193193 listenerStatus := gatewayv1.ListenerStatus {
194194 Name : gatewayv1 .SectionName (listener .Name ),
195195 SupportedKinds : []gatewayv1.RouteGroupKind {},
196- Conditions : listenerValidationConditions [ listener . Name ] ,
196+ Conditions : []metav1. Condition {} ,
197197 AttachedRoutes : 0 ,
198198 }
199+ // Find old status to preserve condition timestamps
200+ for _ , oldStatus := range gateway .Status .Listeners {
201+ if oldStatus .Name == listener .Name {
202+ listenerStatus .Conditions = oldStatus .Conditions // Copy old conditions
203+ break
204+ }
205+ }
206+
207+ // Apply pre-calculated validation conditions
208+ if validationConds , ok := listenerValidationConditions [listener .Name ]; ok {
209+ for _ , cond := range validationConds {
210+ meta .SetStatusCondition (& listenerStatus .Conditions , cond )
211+ }
212+ }
199213 supportedKinds , allKindsValid := getSupportedKinds (listener )
200214 listenerStatus .SupportedKinds = supportedKinds
201215
@@ -492,7 +506,6 @@ func (c *Controller) validateHTTPRoute(
492506 resolvedRefsCondition := metav1.Condition {
493507 Type : string (gatewayv1 .RouteConditionResolvedRefs ),
494508 ObservedGeneration : httpRoute .Generation ,
495- LastTransitionTime : metav1 .Now (),
496509 }
497510 if c .areBackendsValid (httpRoute ) {
498511 resolvedRefsCondition .Status = metav1 .ConditionTrue
@@ -549,7 +562,6 @@ func (c *Controller) validateHTTPRoute(
549562 acceptedCondition := metav1.Condition {
550563 Type : string (gatewayv1 .RouteConditionAccepted ),
551564 ObservedGeneration : httpRoute .Generation ,
552- LastTransitionTime : metav1 .Now (),
553565 }
554566
555567 if len (listenersForThisRef ) == 0 {
@@ -571,7 +583,9 @@ func (c *Controller) validateHTTPRoute(
571583 }
572584
573585 // --- 4. Combine the two independent conditions into the final status. ---
574- status .Conditions = append (status .Conditions , acceptedCondition , resolvedRefsCondition )
586+ meta .SetStatusCondition (& status .Conditions , acceptedCondition )
587+ meta .SetStatusCondition (& status .Conditions , resolvedRefsCondition )
588+
575589 parentStatuses = append (parentStatuses , status )
576590 }
577591
0 commit comments