kayx23 opened a new issue, #2271:
URL: https://github.com/apache/apisix-ingress-controller/issues/2271

   ### Issue description
   
   An upstream is not required when using `aws-lambda` plugin. See:
   
   * https://apisix.apache.org/docs/apisix/plugins/aws-lambda/#enable-plugin
   * 
https://docs.api7.ai/apisix/how-to-guide/ai-gateway/proxy-amazon-bedrock-requests#configure-apisix
   
   With ingress controller, if you attempt to apply the following config:
   
   ```yaml
   apiVersion: apisix.apache.org/v2
   kind: ApisixRoute
   metadata:
     name: aws-lambda-route
   spec:
     http:
       - name: aws-lambda-route
         match:
           paths:
             - /something
         plugins:
         - name: aws-lambda
           enable: true
           config:
             function_uri: https://xxx.com
             authorization:
               iam:
                 accesskey: xxx
                 secretkey: xxx
                 aws_region: us-east-2
                 service: lambda
             timeout: 30000
             ssl_verify: false
   ```
   
   You get the a schema check error:
   
   ```text
   The ApisixRoute "aws-lambda-route" is invalid: 
   * <nil>: Invalid value: "": "spec.http[0]" must validate at least one schema 
(anyOf)
   * spec.http[0].backends: Required value
   ```
   
   What I have also attempted is to set an `upstreams`:
   
   ```yaml
   apiVersion: apisix.apache.org/v2
   kind: ApisixRoute
   metadata:
     name: aws-lambda-route
   spec:
     http:
       - name: aws-lambda-route
         match:
           paths:
             - /something
         upstreams:
         - name: https-upstream
         plugins:
         - name: aws-lambda
           enable: true
           config:
             function_uri: https://xxx.com
             authorization:
               iam:
                 accesskey: xxx
                 secretkey: xxx
                 aws_region: us-east-2
                 service: lambda
             timeout: 30000
             ssl_verify: false
   ---
   apiVersion: apisix.apache.org/v2
   kind: ApisixUpstream
   metadata:
     name: https-upstream
   spec:
     scheme: https
     loadbalancer:
       type: roundrobin
   ```
   
   With this you do get around the schema check but you would see an `empty 
ExternalNodes or Discovery configuration` error in the ingress controller log:
   
   ```
   2024-08-01T17:39:26+08:00    error   translation/apisix_route.go:243 failed 
to translate ApisixUpstream at Upstream[0]       {"error": 
"default/https-upstream has empty ExternalNodes or Discovery configuration", 
"apisix_upstream": "default/amazon-bedrock-upstream"}
   ```
   
   So what should be the right way to configure `aws-lambda` on a route that 
does not require an upstream? Or is this scenario something ingress controller 
schema should accommodate for?
   
   Note: `aws-lambda` plugin does not have test coverage in this repo as of now.
   
   ### Environment
   
   - your apisix-ingress-controller version (output of 
apisix-ingress-controller version --long): 1.8.0
   


-- 
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: notifications-unsubscr...@apisix.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to