Skip to content

Commit

Permalink
Revert "updating"
Browse files Browse the repository at this point in the history
This reverts commit 46fbd3c.

Signed-off-by: Alexander Volchok <[email protected]>
  • Loading branch information
alexwo committed Oct 1, 2024
1 parent 46fbd3c commit 24eaa95
Showing 1 changed file with 27 additions and 49 deletions.
76 changes: 27 additions & 49 deletions internal/gatewayapi/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -847,19 +847,15 @@ func (t *Translator) processTLSRouteParentRefs(tlsRoute *TLSRouteContext, resour
// skip adding the route and provide the reason via route status.
if err != nil {
routeStatus := GetRouteStatus(tlsRoute)
parentStatus := routeStatus.Parents[parentRef.routeParentStatusIdx]
if isAccepted(parentStatus) {
status.SetRouteStatusCondition(routeStatus,
parentRef.routeParentStatusIdx,
tlsRoute.GetGeneration(),
gwapiv1.RouteConditionAccepted,
metav1.ConditionFalse,
"Failed to process the settings associated with the TLS route.",
err.Error(),
)
return
}

status.SetRouteStatusCondition(routeStatus,
parentRef.routeParentStatusIdx,
tlsRoute.GetGeneration(),
gwapiv1.RouteConditionAccepted,
metav1.ConditionFalse,
"Failed to process the settings associated with the TLS route.",
err.Error(),
)
return
}

if ds != nil {
Expand Down Expand Up @@ -1005,18 +1001,15 @@ func (t *Translator) processUDPRouteParentRefs(udpRoute *UDPRouteContext, resour
// skip adding the route and provide the reason via route status.
if err != nil {
routeStatus := GetRouteStatus(udpRoute)
parentStatus := routeStatus.Parents[parentRef.routeParentStatusIdx]
if isAccepted(parentStatus) {
status.SetRouteStatusCondition(routeStatus,
parentRef.routeParentStatusIdx,
udpRoute.GetGeneration(),
gwapiv1.RouteConditionAccepted,
metav1.ConditionFalse,
"Failed to process the settings associated with the UDP route.",
err.Error(),
)
return
}
status.SetRouteStatusCondition(routeStatus,
parentRef.routeParentStatusIdx,
udpRoute.GetGeneration(),
gwapiv1.RouteConditionAccepted,
metav1.ConditionFalse,
"Failed to process the settings associated with the UDP route.",
err.Error(),
)
return
}
if ds == nil {
continue
Expand Down Expand Up @@ -1154,18 +1147,15 @@ func (t *Translator) processTCPRouteParentRefs(tcpRoute *TCPRouteContext, resour
// skip adding the route and provide the reason via route status.
if err != nil {
routeStatus := GetRouteStatus(tcpRoute)
parentStatus := routeStatus.Parents[parentRef.routeParentStatusIdx]
if isAccepted(parentStatus) {
status.SetRouteStatusCondition(routeStatus,
parentRef.routeParentStatusIdx,
tcpRoute.GetGeneration(),
gwapiv1.RouteConditionAccepted,
metav1.ConditionFalse,
"Failed to process the settings associated with the TCP route.",
err.Error(),
)
return
}
status.SetRouteStatusCondition(routeStatus,
parentRef.routeParentStatusIdx,
tcpRoute.GetGeneration(),
gwapiv1.RouteConditionAccepted,
metav1.ConditionFalse,
"Failed to process the settings associated with the TCP route.",
err.Error(),
)
return
}

if ds == nil {
Expand Down Expand Up @@ -1765,15 +1755,3 @@ func (t *Translator) processBackendDestinationSetting(backendRef gwapiv1.Backend
AddressType: dstAddrType,
}
}

func isAccepted(rs gwapiv1.RouteParentStatus) bool {
for _, condition := range rs.Conditions {
if condition.Type == string(gwapiv1.RouteConditionAccepted) {
if condition.Status == metav1.ConditionTrue {
return true
}
return false
}
}
return false
}

0 comments on commit 24eaa95

Please sign in to comment.