apisix-ingress-controller
apisix-ingress-controller copied to clipboard
request help: how to specific configuration of graphql via yaml
Issue description
Use GraphQL with API Gateway Apache APISIX
In the post, you use a http request to specific the graphql request.
But How can I do this via yaml since I can't get definitions of grapql from ApisixRoute
CRD.
Environment
apache/apisix:2.15.0-alpine apache/apisix-ingress-controller:1.4.1 docker.io/bitnami/etcd:3.5.4-debian-11-r14
Kubernetes cluster version: Client Version: v1.24.0 Kustomize Version: v4.5.4 Server Version: v1.21.12-gke.2200
For our usage scenarios,if we have a lot of graphql queries like query a 、b、c and so on. We want to expose a and b query to public use, and c for private and authKey is needed to do authentication.
you can refer to https://github.com/apache/apisix-ingress-controller/blob/dfcbaac8f2b8c9c5ece12e3454fa57a2a23dba65/samples/deploy/crd/v1/ApisixRoute.yaml#L665-L707
add some expr configurations.
you can refer to
https://github.com/apache/apisix-ingress-controller/blob/dfcbaac8f2b8c9c5ece12e3454fa57a2a23dba65/samples/deploy/crd/v1/ApisixRoute.yaml#L665-L707
add some expr configurations.
According to the file, only Cookie Header Path Query
scope are supported.
However in the graphql request, it pass all the data in body. The scope is Body
maybe ?
{
"query": "query Owner($transactionId: ID!) {\n transaction(id: $transactionId) {\n id\n timestamp\n }\n}\n",
"variables": {
"lpTokenId": null,
"transactionId": "xxx"
},
"operationName": "Owner"
}
Any updates on this ?
@Chever-John Please help check this issue when you are free. I think you are more familiar with GraphQL + APISIX
@tao12345666333 @akalittle
This does seem to be my area of expertise, so leave it to me~
Estimated completion time: within 24 hours.
The survey results are in:
@akalittle is right.
@tao12345666333 Now APISIX-ingress-controller does not support CRD resource configuration for GraphQL at this time. We need to add functionality for exprs
.
@akalittle The following command may temporarily fulfill your needs.
kubectl exec -it -n ingress-apisix apisix-5bcf68b548-w8xkr -- curl http://127.0.0.1:9180/apisix/admin/routes/1 -H 'X-API-Key: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
{
"methods": ["POST"],
"uri": "/graphql",
"vars": [
["graphql_operation", "==", "query"],
["graphql_name", "==", "getRepo"],
["graphql_root_fields", "has", "owner"]
],
"upstream": {
"type": "roundrobin",
"nodes": {
"192.168.1.200:4000": 1
}
}
}'
@tao12345666333
I need to explain the mechanism of GraphQL briefly. The GraphQL phase is supposed to take effect only when the request goes to the GraphQL in APISIX. Our exprs
have not reached this stage yet, so this is probably why match
or exprs
cannot resolve GraphQL requests.
thanks
we can add it to TODO list.
But I won't make any promises. I'm happy to accept PRs from anyone
This issue has been marked as stale due to 90 days of inactivity. It will be closed in 30 days if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the [email protected] list. Thank you for your contributions.
This issue has been marked as stale due to 90 days of inactivity. It will be closed in 30 days if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the [email protected] list. Thank you for your contributions.
This issue has been closed due to lack of activity. If you think that is incorrect, or the issue requires additional review, you can revive the issue at any time.
hi, will this ever get implemented ?