etcd-adapter
etcd-adapter copied to clipboard
Poc sqlite
Needs discussion; first preview
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.
Basic APISIX scenarios continue to show correct:
# No routes at the start
$ curl -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' http://localhost:9180/apisix/admin/routes
{"header":{"revision":"15"},"message":"Key not found"}
# Add route 1
$ curl -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '{
"methods": ["GET"],
"uris": ["/get"],
"upstream": {
"nodes": {
"httpbin.org:80": 1
}
}
}' http://localhost:9180/apisix/admin/routes/1
{"key":"/apisix/routes/1","value":{"priority":0,"uris":["/get"],"methods":["GET"],"update_time":1692857760,"create_time":1692857760,"id":"1","upstream":{"pass_host":"pass","nodes":{"httpbin.org:80":1},"type":"roundrobin","hash_on":"vars","scheme":"http"},"status":1}}
# Add route 2
$ curl -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '{
"methods": ["GET"],
"uris": ["/foo"],
"upstream": {
"nodes": {
"httpbin.org:80": 1
}
}
}' http://localhost:9180/apisix/admin/routes/2
{"key":"/apisix/routes/2","value":{"priority":0,"uris":["/foo"],"methods":["GET"],"update_time":1692857777,"create_time":1692857777,"id":"2","upstream":{"pass_host":"pass","nodes":{"httpbin.org:80":1},"type":"roundrobin","hash_on":"vars","scheme":"http"},"status":1}}
# List only the 1st routes even though
$ curl -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' http://localhost:9180/apisix/admin/routes
{"createdIndex":16,"value":{"priority":0,"uris":["/get"],"methods":["GET"],"update_time":1692857760,"create_time":1692857760,"id":"1","upstream":{"pass_host":"pass","nodes":{"httpbin.org:80":1},"type":"roundrobin","hash_on":"vars","scheme":"http"},"status":1},"modifiedIndex":16,"key":"/apisix/routes/1"}
# Individual route details show
$ curl -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' http://localhost:9180/apisix/admin/routes/1
{"createdIndex":16,"value":{"priority":0,"uris":["/get"],"methods":["GET"],"update_time":1692857760,"create_time":1692857760,"id":"1","upstream":{"pass_host":"pass","nodes":{"httpbin.org:80":1},"type":"roundrobin","hash_on":"vars","scheme":"http"},"status":1},"modifiedIndex":16,"key":"/apisix/routes/1"}
# Individual route details show
$ curl -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' http://localhost:9180/apisix/admin/routes/2
{"createdIndex":17,"value":{"priority":0,"uris":["/foo"],"methods":["GET"],"update_time":1692857777,"create_time":1692857777,"id":"2","upstream":{"pass_host":"pass","nodes":{"httpbin.org:80":1},"type":"roundrobin","hash_on":"vars","scheme":"http"},"status":1},"modifiedIndex":17,"key":"/apisix/routes/2"}
APISIX Route rules only work for the 1st route
# Now the first route seems to work
$ curl localhost:9080/get
{
"args": {},
"headers": {
"Accept": "*/*",
"Host": "localhost",
"User-Agent": "curl/8.1.2",
"X-Amzn-Trace-Id": "Root=1-64e6f5f0-65954e3038b40cdd62b74565",
"X-Forwarded-Host": "localhost"
},
"origin": "127.0.0.1, 175.139.188.81",
"url": "http://localhost/get"
}
# Second route does not seem to work
$ curl localhost:9080/foo
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>404 Not Found</title>
<h1>Not Found</h1>
<p>The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.</p>
Routes are shown in the raw etcdctl calls:
$ etcdctl --endpoints=localhost:12379 get /apisix/routes --prefix -w=fields
"ClusterID" : 0
"MemberID" : 0
"Revision" : 17
"RaftTerm" : 0
"Key" : "/apisix/routes/1"
"CreateRevision" : 16
"ModRevision" : 16
"Version" : 0
"Value" : "{\"priority\":0,\"uris\":[\"/get\"],\"methods\":[\"GET\"],\"update_time\":1692857760,\"create_time\":1692857760,\"id\":\"1\",\"upstream\":{\"pass_host\":\"pass\",\"nodes\":{\"httpbin.org:80\":1},\"type\":\"roundrobin\",\"hash_on\":\"vars\",\"scheme\":\"http\"},\"status\":1}"
"Lease" : 0
"Key" : "/apisix/routes/2"
"CreateRevision" : 17
"ModRevision" : 17
"Version" : 0
"Value" : "{\"priority\":0,\"uris\":[\"/foo\"],\"methods\":[\"GET\"],\"update_time\":1692857777,\"create_time\":1692857777,\"id\":\"2\",\"upstream\":{\"pass_host\":\"pass\",\"nodes\":{\"httpbin.org:80\":1},\"type\":\"roundrobin\",\"hash_on\":\"vars\",\"scheme\":\"http\"},\"status\":1}"
"Lease" : 0
"More" : false
"Count" : 2