Cloud native API Gateway powered with in-redis cache.
- API composition: expose your services to the internet using a single endpoint
- Cloud native: configure routing and cache using Kubernetes CRDs
- In-memory cache using redis
- Cache invalidation using tags
- Health checking
- Management REST API
- ~6MB Docker image available for multiple architectures
- Helm chart
helm repo add mmontes https://mmontes11.github.io/charts
helm repo add gotway https://gotway.github.io/gotway
helm install redis mmontes/redis
helm install gotway gotway/gotway
We will need microservices to route to in order to test Gotway, you can deploy some by running:
helm upgrade --install gotway gotway/gotway --set examples.enabled=true
Let's register the catalog service into Gotway by creating an IngressHTTP
CRD:
kubectl apply -f ./manifests/examples/catalog.yml
apiVersion: gotway.io/v1alpha1
kind: IngressHTTP
metadata:
name: catalog
spec:
match:
host: catalog.gotway.duckdns.org:9111
service:
name: catalog
url: http://gotway-catalog
healthPath: /health
cache:
ttl: 30
statuses:
- 200
- 404
tags:
- "catalog"
- "products"
We are now able to route requests through Gotway:
curl -k --request GET 'https://catalog.gotway.duckdns.org:9111/products' | jq
{
"products": [
{
"id": 911902081,
"name": "sneakers",
"price": 69000,
"color": "white",
"size": "42"
}
],
"totalCount": 1
}
This response has a TTL of 30 seconds, let's invalidate the cache for the catalog service by providing one of its tags:
curl -k --request DELETE 'https://gotway.duckdns.org:9111/api/cache' \
--header 'Content-Type: application/json' \
--data-raw '{
"tags": ["catalog"]
}'