Skip to content

Commit e917e8d

Browse files
committed
MINOR: move r.Valid assignment after backendRef loop in HTTPRouteRule and TLSRouteRule
r.Valid = routeValid was inside the loop in the success branch only; failure paths hit continue and skipped it, leaving r.Valid at its zero value (false). The result was correct by coincidence but fragile. Moving the assignment after the loop makes the intent explicit and safe against future refactors.
1 parent 0d61669 commit e917e8d

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

k8s/gate/tree/route-rule.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ func (r *HTTPRouteRule) checkBackendRef(httpRoute *HTTPRoute, controllerStore Co
8282
Valid: true,
8383
Conditions: rc.ConditionOKResolvedRef(),
8484
})
85-
r.Valid = routeValid
8685
}
86+
r.Valid = routeValid
8787
}
8888

8989
// checkFilters validates the HTTPRoute filters at both rule and backendRef level.

k8s/gate/tree/tls-route-rule.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ func (r *TLSRouteRule) checkBackendRef(tlsRoute *TLSRoute, controllerStore Contr
7878
Valid: true,
7979
Conditions: rc.ConditionOKResolvedRef(),
8080
})
81-
r.Valid = routeValid
8281
}
82+
r.Valid = routeValid
8383
}
8484

8585
// ServiceNsNameKey returns the service Ns/Name

0 commit comments

Comments
 (0)