ronething commented on code in PR #2451:
URL:
https://github.com/apache/apisix-ingress-controller/pull/2451#discussion_r2184469943
##########
internal/provider/adc/translator/httproute.go:
##########
@@ -312,11 +315,19 @@ func (t *Translator) translateEndpointSlice(portName
*string, weight int, endpoi
return nodes
}
-func (t *Translator) TranslateBackendRef(tctx *provider.TranslateContext, ref
gatewayv1.BackendRef) (adctypes.UpstreamNodes, error) {
- return t.translateBackendRef(tctx, ref)
+func DefaultEndpointFilter(endpoint *discoveryv1.Endpoint) bool {
+ if endpoint.Conditions.Ready != nil && !*endpoint.Conditions.Ready {
+ log.Debugw("skip not ready endpoint", zap.Any("endpoint",
endpoint))
+ return false
+ }
+ return true
+}
+
+func (t *Translator) TranslateBackendRefWithFilter(tctx
*provider.TranslateContext, ref gatewayv1.BackendRef, endpointFilter
func(*discoveryv1.Endpoint) bool) (adctypes.UpstreamNodes, error) {
+ return t.translateBackendRef(tctx, ref, endpointFilter)
}
-func (t *Translator) translateBackendRef(tctx *provider.TranslateContext, ref
gatewayv1.BackendRef) (adctypes.UpstreamNodes, error) {
+func (t *Translator) translateBackendRef(tctx *provider.TranslateContext, ref
gatewayv1.BackendRef, endpointFilter func(*discoveryv1.Endpoint) bool)
(adctypes.UpstreamNodes, error) {
Review Comment:
Currently, only the code that retrieves apisix standalone nodes calls the
`TranslateBackendRefWithFilter` method, as it is called from another package,
so it has been exported.
We can consider making a unified adjustment in the next PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]