Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 24 additions & 9 deletions internal/controller/status/status_setters.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,22 @@ func newHTTPRouteStatusSetter(status gatewayv1.HTTPRouteStatus, gatewayCtlrName
hr := helpers.MustCastObject[*gatewayv1.HTTPRoute](object)

// keep all the parent statuses that belong to other controllers
newParents := make([]gatewayv1.RouteParentStatus, 0, len(status.Parents))
newParents = append(newParents, status.Parents...)
for _, os := range hr.Status.Parents {
if string(os.ControllerName) != gatewayCtlrName {
status.Parents = append(status.Parents, os)
newParents = append(newParents, os)
}
}

if routeStatusEqual(gatewayCtlrName, hr.Status.Parents, status.Parents) {
fullStatus := status
fullStatus.Parents = newParents

if routeStatusEqual(gatewayCtlrName, hr.Status.Parents, fullStatus.Parents) {
return false
}

hr.Status = status
hr.Status = fullStatus

return true
}
Expand All @@ -105,17 +110,22 @@ func newTLSRouteStatusSetter(status v1alpha2.TLSRouteStatus, gatewayCtlrName str
tr := helpers.MustCastObject[*v1alpha2.TLSRoute](object)

// keep all the parent statuses that belong to other controllers
newParents := make([]gatewayv1.RouteParentStatus, 0, len(status.Parents))
newParents = append(newParents, status.Parents...)
for _, os := range tr.Status.Parents {
if string(os.ControllerName) != gatewayCtlrName {
status.Parents = append(status.Parents, os)
newParents = append(newParents, os)
}
}

if routeStatusEqual(gatewayCtlrName, tr.Status.Parents, status.Parents) {
fullStatus := status
fullStatus.Parents = newParents

if routeStatusEqual(gatewayCtlrName, tr.Status.Parents, fullStatus.Parents) {
return false
}

tr.Status = status
tr.Status = fullStatus

return true
}
Expand All @@ -126,17 +136,22 @@ func newGRPCRouteStatusSetter(status gatewayv1.GRPCRouteStatus, gatewayCtlrName
gr := helpers.MustCastObject[*gatewayv1.GRPCRoute](object)

// keep all the parent statuses that belong to other controllers
newParents := make([]gatewayv1.RouteParentStatus, 0, len(status.Parents))
newParents = append(newParents, status.Parents...)
for _, os := range gr.Status.Parents {
if string(os.ControllerName) != gatewayCtlrName {
status.Parents = append(status.Parents, os)
newParents = append(newParents, os)
}
}

if routeStatusEqual(gatewayCtlrName, gr.Status.Parents, status.Parents) {
fullStatus := status
fullStatus.Parents = newParents

if routeStatusEqual(gatewayCtlrName, gr.Status.Parents, fullStatus.Parents) {
return false
}

gr.Status = status
gr.Status = fullStatus

return true
}
Expand Down
Loading