Re: [PR] fix: Add provider endpoints to translate context [apisix-ingress-controller]

2025-07-02 Thread via GitHub


nic-6443 merged PR #2442:
URL: https://github.com/apache/apisix-ingress-controller/pull/2442


-- 
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]



Re: [PR] fix: Add provider endpoints to translate context [apisix-ingress-controller]

2025-07-02 Thread via GitHub


dspo commented on code in PR #2442:
URL: 
https://github.com/apache/apisix-ingress-controller/pull/2442#discussion_r2179948840


##
internal/provider/adc/config.go:
##
@@ -86,24 +87,27 @@ func (d *adcClient) getConfigsForGatewayProxy(tctx 
*provider.TranslateContext, g
}
_, ok := tctx.Services[namespacedName]
if !ok {
-   return nil, errors.New("no service found for service 
reference")
+   return nil, errors.Errorf("no service found for service 
reference: %s", namespacedName)

Review Comment:
   OK! I'll resolve this in 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]



Re: [PR] fix: Add provider endpoints to translate context [apisix-ingress-controller]

2025-07-02 Thread via GitHub


ronething commented on code in PR #2442:
URL: 
https://github.com/apache/apisix-ingress-controller/pull/2442#discussion_r2179608322


##
internal/provider/adc/config.go:
##
@@ -86,24 +87,27 @@ func (d *adcClient) getConfigsForGatewayProxy(tctx 
*provider.TranslateContext, g
}
_, ok := tctx.Services[namespacedName]
if !ok {
-   return nil, errors.New("no service found for service 
reference")
+   return nil, errors.Errorf("no service found for service 
reference: %s", namespacedName)

Review Comment:
   "github.com/pkg/errors" is archived,we can use fmt.Errorf.



-- 
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]



Re: [PR] fix: Add provider endpoints to translate context [apisix-ingress-controller]

2025-07-02 Thread via GitHub


dspo commented on code in PR #2442:
URL: 
https://github.com/apache/apisix-ingress-controller/pull/2442#discussion_r2179416626


##
internal/provider/adc/config.go:
##
@@ -86,24 +87,32 @@ func (d *adcClient) getConfigsForGatewayProxy(tctx 
*provider.TranslateContext, g
}
_, ok := tctx.Services[namespacedName]
if !ok {
-   return nil, errors.New("no service found for service 
reference")
+   return nil, errors.Errorf("no service found for service 
reference: %s", namespacedName)
}
-   endpoint := tctx.EndpointSlices[namespacedName]
-   if endpoint == nil {
-   return nil, nil
-   }
-   upstreamNodes, err := d.translator.TranslateBackendRef(tctx, 
v1.BackendRef{
-   BackendObjectReference: v1.BackendObjectReference{
-   Name: 
v1.ObjectName(provider.ControlPlane.Service.Name),
-   Port: 
ptr.To(v1.PortNumber(provider.ControlPlane.Service.Port)),
-   },
-   })
-   if err != nil {
-   return nil, err
-   }
-   for _, node := range upstreamNodes {
-   config.ServerAddrs = append(config.ServerAddrs, 
fmt.Sprintf("http://%s:%d";, node.Host, node.Port))
+
+   var (
+   endpointSlices = tctx.EndpointSlices[namespacedName]
+   port   = 
strconv.FormatInt(int64(provider.ControlPlane.Service.Port), 10)

Review Comment:
   fixed



-- 
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]



Re: [PR] fix: Add provider endpoints to translate context [apisix-ingress-controller]

2025-07-02 Thread via GitHub


AlinsRan commented on code in PR #2442:
URL: 
https://github.com/apache/apisix-ingress-controller/pull/2442#discussion_r2179290265


##
internal/provider/adc/config.go:
##
@@ -86,24 +87,32 @@ func (d *adcClient) getConfigsForGatewayProxy(tctx 
*provider.TranslateContext, g
}
_, ok := tctx.Services[namespacedName]
if !ok {
-   return nil, errors.New("no service found for service 
reference")
+   return nil, errors.Errorf("no service found for service 
reference: %s", namespacedName)
}
-   endpoint := tctx.EndpointSlices[namespacedName]
-   if endpoint == nil {
-   return nil, nil
-   }
-   upstreamNodes, err := d.translator.TranslateBackendRef(tctx, 
v1.BackendRef{
-   BackendObjectReference: v1.BackendObjectReference{
-   Name: 
v1.ObjectName(provider.ControlPlane.Service.Name),
-   Port: 
ptr.To(v1.PortNumber(provider.ControlPlane.Service.Port)),
-   },
-   })
-   if err != nil {
-   return nil, err
-   }
-   for _, node := range upstreamNodes {
-   config.ServerAddrs = append(config.ServerAddrs, 
fmt.Sprintf("http://%s:%d";, node.Host, node.Port))
+
+   var (
+   endpointSlices = tctx.EndpointSlices[namespacedName]
+   port   = 
strconv.FormatInt(int64(provider.ControlPlane.Service.Port), 10)

Review Comment:
   We need to match endpoints ports based on the targetPort or portName of the 
service.



-- 
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]



Re: [PR] fix: Add provider endpoints to translate context [apisix-ingress-controller]

2025-07-01 Thread via GitHub


AlinsRan commented on PR #2442:
URL: 
https://github.com/apache/apisix-ingress-controller/pull/2442#issuecomment-3026687473

   You need to add more description for this 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]



Re: [PR] fix: Add provider endpoints to translate context [apisix-ingress-controller]

2025-07-01 Thread via GitHub


AlinsRan commented on code in PR #2442:
URL: 
https://github.com/apache/apisix-ingress-controller/pull/2442#discussion_r2179273849


##
internal/provider/adc/config.go:
##
@@ -86,24 +87,32 @@ func (d *adcClient) getConfigsForGatewayProxy(tctx 
*provider.TranslateContext, g
}
_, ok := tctx.Services[namespacedName]
if !ok {
-   return nil, errors.New("no service found for service 
reference")
+   return nil, errors.Errorf("no service found for service 
reference: %s", namespacedName)
}
-   endpoint := tctx.EndpointSlices[namespacedName]
-   if endpoint == nil {
-   return nil, nil
-   }
-   upstreamNodes, err := d.translator.TranslateBackendRef(tctx, 
v1.BackendRef{
-   BackendObjectReference: v1.BackendObjectReference{
-   Name: 
v1.ObjectName(provider.ControlPlane.Service.Name),
-   Port: 
ptr.To(v1.PortNumber(provider.ControlPlane.Service.Port)),
-   },
-   })
-   if err != nil {
-   return nil, err
-   }
-   for _, node := range upstreamNodes {
-   config.ServerAddrs = append(config.ServerAddrs, 
fmt.Sprintf("http://%s:%d";, node.Host, node.Port))
+
+   var (
+   endpointSlices = tctx.EndpointSlices[namespacedName]
+   port   = 
strconv.FormatInt(int64(provider.ControlPlane.Service.Port), 10)

Review Comment:
   The service port is not always equal to the container port.
   
   



-- 
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]