@@ -76,14 +76,15 @@ func (c *Controller) syncGateway(key string) error {
7676 }
7777
7878 // Update configuration
79+ newGw := gw .DeepCopy ()
7980 resources := map [resourcev3.Type ][]envoyproxytypes.Resource {}
80- gwConditions := [] metav1.Condition { {
81+ newGw . Status . Conditions , _ = UpdateConditionIfChanged ( newGw . Status . Conditions , metav1.Condition {
8182 Type : string (gatewayv1 .GatewayConditionAccepted ),
8283 Status : metav1 .ConditionTrue ,
8384 Reason : string (gatewayv1 .GatewayReasonAccepted ),
8485 ObservedGeneration : gw .Generation ,
8586 LastTransitionTime : metav1 .Now (),
86- }}
87+ })
8788
8889 lisStatus := make ([]gatewayv1.ListenerStatus , len (gw .Spec .Listeners ))
8990 for i , listener := range gw .Spec .Listeners {
@@ -111,16 +112,15 @@ func (c *Controller) syncGateway(key string) error {
111112 var attachedRoutes int32
112113 for _ , route := range c .getHTTPRoutesForListener (gw , listener ) {
113114 klog .V (2 ).Infof ("Processing http route %s/%s for gw %s/%s" , route .Namespace , route .Name , gw .Namespace , gw .Name )
114- gwConditions = append (gwConditions , metav1.Condition {})
115115 }
116116
117117 for _ , route := range c .getGRPCRoutesForListener (gw , listener ) {
118118 klog .V (2 ).Infof ("Processing grpc route %s/%s for gw %s/%s" , route .Namespace , route .Name , gw .Namespace , gw .Name )
119- gwConditions = append (gwConditions , metav1.Condition {})
120119 }
121120
122121 lisStatus [i ] = gatewayv1.ListenerStatus {
123122 Name : listener .Name ,
123+ SupportedKinds : []gatewayv1.RouteGroupKind {{Kind : "HTTPRoute" }},
124124 AttachedRoutes : attachedRoutes ,
125125 Conditions : []metav1.Condition {{
126126 Type : string (gatewayv1 .ListenerConditionAccepted ),
@@ -134,7 +134,7 @@ func (c *Controller) syncGateway(key string) error {
134134
135135 err = c .UpdateXDSServer (context .Background (), containerName , resources )
136136 if err != nil {
137- gwConditions , _ = UpdateConditionIfChanged (gwConditions , metav1.Condition {
137+ newGw . Status . Conditions , _ = UpdateConditionIfChanged (newGw . Status . Conditions , metav1.Condition {
138138 Type : string (gatewayv1 .GatewayConditionProgrammed ),
139139 Status : metav1 .ConditionFalse ,
140140 Reason : string (gatewayv1 .GatewayReasonProgrammed ),
@@ -144,7 +144,7 @@ func (c *Controller) syncGateway(key string) error {
144144 })
145145
146146 } else {
147- gwConditions , _ = UpdateConditionIfChanged (gwConditions , metav1.Condition {
147+ newGw . Status . Conditions , _ = UpdateConditionIfChanged (newGw . Status . Conditions , metav1.Condition {
148148 Type : string (gatewayv1 .GatewayConditionProgrammed ),
149149 Status : metav1 .ConditionTrue ,
150150 Reason : string (gatewayv1 .GatewayReasonProgrammed ),
@@ -153,10 +153,9 @@ func (c *Controller) syncGateway(key string) error {
153153 })
154154 }
155155
156- gw .Status .Listeners = lisStatus
157- gw .Status .Conditions = gwConditions
156+ newGw .Status .Listeners = lisStatus
158157
159- _ , err = c .gwClient .GatewayV1 ().Gateways (gw .Namespace ).UpdateStatus (context .Background (), gw , metav1.UpdateOptions {})
158+ _ , err = c .gwClient .GatewayV1 ().Gateways (newGw .Namespace ).UpdateStatus (context .Background (), newGw , metav1.UpdateOptions {})
160159 return err
161160}
162161
0 commit comments