gotway

module
v0.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2023 License: MIT

README

mariadb

CI Helm Release Go Report Card Go Reference Artifact Hub

☸️ gotway

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
Installation
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
Quickstart

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"]
}'
Management REST API

Run in Postman

Directories

Path Synopsis
cmd
internal
microservices
catalog Module
route Module
stock Module
pkg
env
kubernetes/crd/v1alpha1
+groupName=gotway.io
+groupName=gotway.io
kubernetes/crd/v1alpha1/apis/clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
kubernetes/crd/v1alpha1/apis/clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
kubernetes/crd/v1alpha1/apis/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
kubernetes/crd/v1alpha1/apis/clientset/versioned/typed/crd/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
kubernetes/crd/v1alpha1/apis/clientset/versioned/typed/crd/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
log

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL