Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 2 additions & 2 deletions internal/provider/adc/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ func (d *adcClient) getConfigsForGatewayProxy(tctx *provider.TranslateContext, g
if !ok {
return nil, fmt.Errorf("no service found for service reference: %s", namespacedName)
}
endpoint := tctx.EndpointSlices[namespacedName]
if endpoint == nil {
endpoints := tctx.EndpointSlices[namespacedName]
if len(endpoints) == 0 {
return nil, nil
}
upstreamNodes, err := d.translator.TranslateBackendRef(tctx, gatewayv1.BackendRef{
Expand Down
8 changes: 8 additions & 0 deletions internal/provider/adc/translator/httproute.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,14 @@ func (t *Translator) translateEndpointSlice(portName *string, weight int, endpoi
}
for _, endpoint := range endpointSlice.Endpoints {
for _, addr := range endpoint.Addresses {
if endpoint.Conditions.Ready != nil && !*endpoint.Conditions.Ready {
log.Debugw("skip not ready endpoint", zap.Any("endpoint", endpoint))
continue
}
if endpoint.Conditions.Terminating != nil && *endpoint.Conditions.Terminating {
log.Debugw("skip terminating endpoint", zap.Any("endpoint", endpoint))
continue
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is recommended to put the filter in the controller layer and not manage the status of k8s resources in the translation layer.
https://github.com/apache/apisix-ingress-controller/blob/master/internal/controller/utils.go#L1447

node := adctypes.UpstreamNode{
Host: addr,
Port: int(*port.Port),
Expand Down
Loading