@@ -76,14 +76,15 @@ func (c *Controller) syncGateway(key string) error {
76
76
}
77
77
78
78
// Update configuration
79
+ newGw := gw .DeepCopy ()
79
80
resources := map [resourcev3.Type ][]envoyproxytypes.Resource {}
80
- gwConditions := [] metav1.Condition { {
81
+ newGw . Status . Conditions , _ = UpdateConditionIfChanged ( newGw . Status . Conditions , metav1.Condition {
81
82
Type : string (gatewayv1 .GatewayConditionAccepted ),
82
83
Status : metav1 .ConditionTrue ,
83
84
Reason : string (gatewayv1 .GatewayReasonAccepted ),
84
85
ObservedGeneration : gw .Generation ,
85
86
LastTransitionTime : metav1 .Now (),
86
- }}
87
+ })
87
88
88
89
lisStatus := make ([]gatewayv1.ListenerStatus , len (gw .Spec .Listeners ))
89
90
for i , listener := range gw .Spec .Listeners {
@@ -111,16 +112,15 @@ func (c *Controller) syncGateway(key string) error {
111
112
var attachedRoutes int32
112
113
for _ , route := range c .getHTTPRoutesForListener (gw , listener ) {
113
114
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 {})
115
115
}
116
116
117
117
for _ , route := range c .getGRPCRoutesForListener (gw , listener ) {
118
118
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 {})
120
119
}
121
120
122
121
lisStatus [i ] = gatewayv1.ListenerStatus {
123
122
Name : listener .Name ,
123
+ SupportedKinds : []gatewayv1.RouteGroupKind {{Kind : "HTTPRoute" }},
124
124
AttachedRoutes : attachedRoutes ,
125
125
Conditions : []metav1.Condition {{
126
126
Type : string (gatewayv1 .ListenerConditionAccepted ),
@@ -134,7 +134,7 @@ func (c *Controller) syncGateway(key string) error {
134
134
135
135
err = c .UpdateXDSServer (context .Background (), containerName , resources )
136
136
if err != nil {
137
- gwConditions , _ = UpdateConditionIfChanged (gwConditions , metav1.Condition {
137
+ newGw . Status . Conditions , _ = UpdateConditionIfChanged (newGw . Status . Conditions , metav1.Condition {
138
138
Type : string (gatewayv1 .GatewayConditionProgrammed ),
139
139
Status : metav1 .ConditionFalse ,
140
140
Reason : string (gatewayv1 .GatewayReasonProgrammed ),
@@ -144,7 +144,7 @@ func (c *Controller) syncGateway(key string) error {
144
144
})
145
145
146
146
} else {
147
- gwConditions , _ = UpdateConditionIfChanged (gwConditions , metav1.Condition {
147
+ newGw . Status . Conditions , _ = UpdateConditionIfChanged (newGw . Status . Conditions , metav1.Condition {
148
148
Type : string (gatewayv1 .GatewayConditionProgrammed ),
149
149
Status : metav1 .ConditionTrue ,
150
150
Reason : string (gatewayv1 .GatewayReasonProgrammed ),
@@ -153,10 +153,9 @@ func (c *Controller) syncGateway(key string) error {
153
153
})
154
154
}
155
155
156
- gw .Status .Listeners = lisStatus
157
- gw .Status .Conditions = gwConditions
156
+ newGw .Status .Listeners = lisStatus
158
157
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 {})
160
159
return err
161
160
}
162
161
0 commit comments