@@ -84,17 +84,22 @@ func newHTTPRouteStatusSetter(status gatewayv1.HTTPRouteStatus, gatewayCtlrName
8484 hr := helpers.MustCastObject [* gatewayv1.HTTPRoute ](object )
8585
8686 // keep all the parent statuses that belong to other controllers
87+ newParents := make ([]gatewayv1.RouteParentStatus , 0 , len (status .Parents ))
88+ newParents = append (newParents , status .Parents ... )
8789 for _ , os := range hr .Status .Parents {
8890 if string (os .ControllerName ) != gatewayCtlrName {
89- status . Parents = append (status . Parents , os )
91+ newParents = append (newParents , os )
9092 }
9193 }
9294
93- if routeStatusEqual (gatewayCtlrName , hr .Status .Parents , status .Parents ) {
95+ fullStatus := status
96+ fullStatus .Parents = newParents
97+
98+ if routeStatusEqual (gatewayCtlrName , hr .Status .Parents , fullStatus .Parents ) {
9499 return false
95100 }
96101
97- hr .Status = status
102+ hr .Status = fullStatus
98103
99104 return true
100105 }
@@ -105,17 +110,22 @@ func newTLSRouteStatusSetter(status v1alpha2.TLSRouteStatus, gatewayCtlrName str
105110 tr := helpers.MustCastObject [* v1alpha2.TLSRoute ](object )
106111
107112 // keep all the parent statuses that belong to other controllers
113+ newParents := make ([]gatewayv1.RouteParentStatus , 0 , len (status .Parents ))
114+ newParents = append (newParents , status .Parents ... )
108115 for _ , os := range tr .Status .Parents {
109116 if string (os .ControllerName ) != gatewayCtlrName {
110- status . Parents = append (status . Parents , os )
117+ newParents = append (newParents , os )
111118 }
112119 }
113120
114- if routeStatusEqual (gatewayCtlrName , tr .Status .Parents , status .Parents ) {
121+ fullStatus := status
122+ fullStatus .Parents = newParents
123+
124+ if routeStatusEqual (gatewayCtlrName , tr .Status .Parents , fullStatus .Parents ) {
115125 return false
116126 }
117127
118- tr .Status = status
128+ tr .Status = fullStatus
119129
120130 return true
121131 }
@@ -126,17 +136,22 @@ func newGRPCRouteStatusSetter(status gatewayv1.GRPCRouteStatus, gatewayCtlrName
126136 gr := helpers.MustCastObject [* gatewayv1.GRPCRoute ](object )
127137
128138 // keep all the parent statuses that belong to other controllers
139+ newParents := make ([]gatewayv1.RouteParentStatus , 0 , len (status .Parents ))
140+ newParents = append (newParents , status .Parents ... )
129141 for _ , os := range gr .Status .Parents {
130142 if string (os .ControllerName ) != gatewayCtlrName {
131- status . Parents = append (status . Parents , os )
143+ newParents = append (newParents , os )
132144 }
133145 }
134146
135- if routeStatusEqual (gatewayCtlrName , gr .Status .Parents , status .Parents ) {
147+ fullStatus := status
148+ fullStatus .Parents = newParents
149+
150+ if routeStatusEqual (gatewayCtlrName , gr .Status .Parents , fullStatus .Parents ) {
136151 return false
137152 }
138153
139- gr .Status = status
154+ gr .Status = fullStatus
140155
141156 return true
142157 }
0 commit comments