Giter Site home page Giter Site logo

kubeshop / kusk-gateway Goto Github PK

View Code? Open in Web Editor NEW
248.0 17.0 21.0 30.68 MB

Kusk-gateway is an OpenAPI-driven API Gateway for Kubernetes

Home Page: https://kubeshop.github.io/kusk-gateway/

License: MIT License

Dockerfile 0.47% Makefile 3.34% Go 94.31% Shell 1.71% JavaScript 0.06% PowerShell 0.11%
kubernetes api-gateway openapi openapi3 swagger ingress

kusk-gateway's Introduction

Dear users and contributors of Kusk and Kusk Gateway!

We continue to believe in the idea of OpenAPI driven Gateway. However, we have decided to pause ongoing active development and support for the time being.

We want to express our sincere gratitude to everyone who has contributed to Kusk, whether by submitting code, reporting issues, or simply using it. We are proud of the work we accomplished together, and hope that our efforts have had a positive impact on your work and your community.

If you're willing to improve the project, please feel free to contribute. We will do our best to review and approve incoming PRs as our time and resources allow.

Thank you for your understanding and support!

The Kusk Team at Kubeshop

Kusk Logo Light Kusk Logo Dark

Welcome to Kusk Gateway - a self-service API gateway powered by OpenAPI and Envoy

Website |  Documentation |  Twitter |  Discord |  Blog

Slack Discord

Welcome to Kusk Gateway

Kusk Gateway enables you to design and configure your APIs from single OpenAPI manifest and you can:

  • Rapidly prototype your APIs by mocking your API responses, allowing your teams to instantly start building on top of your APIs without your services being implemented
  • 🔒 Protect your endpoints with automatic request and response validations
  • ⚠️ Configure critical policies like request timeouts and CORS with no coding required
  • 🧐 Centrally control your APIs from an Open Source dashboard

Get Started

Check out our Getting Started section to install Kusk Gateway, deploy an example API and connect a service to the API.

Contributing

Go to contribution document to read more how can you help us 🔥

Feedback

Whether it helps you or not - we'd LOVE to hear from you. Please let us know what you think and of course, how we can make it better. Please join our growing community on Discord.

Development

See SKAFFOLD.md.

kusk-gateway's People

Contributors

aabedraba avatar crjones avatar dobegor avatar ioggstream avatar jasmingacic avatar jfermi avatar mbana avatar olensmar avatar povilasv avatar snyk-bot avatar tarick avatar yllek avatar ypoplavs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kusk-gateway's Issues

CORS support

  • For each endpoint with CORS we should have method OPTIONS (if not already specified in OpenAPI) that allows to get CORS headers.
  • Envoy configuration makes CORS policy applicable per vhost and per route as well, we should make clear distinction when to use what - right now we configure everything per route.

Fix parser.go panics

I.e. if service: disabled is not present the parser it would panic.
There are a few other places it might get broken too.

static routing support

OpenAPI is not feature complete and using its definition it won't be possible to host the site with API AND front.
I.e. static route to index.html should exist, e.g.:

path:
  '/': 
   backend: front.namespace:80

Define how should we supply it - either with OpenAPI CRD or separately.

Local development Makefile target

We can run the operator locally with make run, but we need to disable websockets, because CRDs are installed with them and API server can't reach the local development server.

Or make them work via routing the traffic from the API server to local running operator somehow (probably more complicated).

Static Envoy Fleet Deployment

For an internal MVP, we've agreed to have a static Envoy Fleet deployment fetching settings from xDS API server.
This task's scope includes:

  • Envoy Fleet deployment
  • static configuration for it to fetch settings from xDS API server
  • Makefile adjustments to easily deploy and iterate over it

CI: Add GH action for releasing

We need automation for releasing new versions of kusk-gateway's docker image

The basic version should be building and pushing a tagged docker image to a public docker repo

TLS: with static certificates

Introduce a new CRD for configuring TLS.

Based on the context and TLS workflows, people will be creating the certificates secrets manually and at the same time LetsEncrypt (CertManager) certificates will be updated dynamically, so we need to send to Envoy information on new certs when this happens.

Since TLS is mapped to the Listener config and EnvoyFleet doesn't manage listener config, but EnvoyConfigManager does when Envoy is ready, we need to send this as part of Envoy application configuration - not as part of Fleet configuration.

Fields for CRD

  • Secret ref containing certs
  • Cipher suites order string (users will likely exclude or include ciphes depending on their usecases.)

https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/transport_sockets/tls/v3/common.proto has some of those,

I think for the first iteration we need only the secret ref and ciphers order (which again has a sane default - we can make it optional for the user, but allow to configure).

Then manager has to pull this on startup/creation and update and send this to Envoy with listener configuration.

The Envoy config manager sends the whole configuration in one go (we don't do delta configuration currently), it must be a part of main configuration routine in https://github.com/kubeshop/kusk-gateway/blob/main/controllers/config_manager.go#L56

options: restructure it for a better UX

example api crd should look like this:

apiVersion: gateway.kusk.io/v1
kind: API
metadata:
  name: httpbin-sample
spec:
  # service name and port should be specified inside x-kusk annotation
  fleet: default
  
  spec: |
    swagger: '2.0'
    info:
      title: httpbin.org
      description: API Management facade for a very handy and free online HTTP tool.
      version: '1.0'
    host: httpbin.org
    schemes:
    - http
    - https
    x-kusk:
      hosts:
        - example.com // vhost is created dynamically, but you can override TLS and other settings in EnvoyFleet per-host if you want to
      
      disabled:
      
      mock:
      
      validation:
      
      redirect: // redirect and upstream nodes are mutually exclusive
      
      upstream: // service upstream is k8s-native, host is a generic one, they are mutually exclusive
        service:
          namespace: default
          name: petstore
          port: 8080
        host:
          hostname: example.com
          port: 8080
          
      qos:
        retries:
        timeouts:
        rate_limits:
        
      cors:
      
      path:
        rewrite:
        // remove trim_prefix, superseded by rewrite
        prefix: /env3/api // renamed from base

x-kusk: allow user to specify upstream (backend) in a user-friendly way

We should allow user to specify upstream (backend?) in a few ways:

  1. Native Kubernetes Service Name, Namespace and port, i.e.:
backend:
  service:
    name: petstore
    namespace: default
    port: http
  1. Fully customizable host, something like:
backend:
  host: somehost.com:80

The first one would be so much easier and more user-friendly for those that route their traffic to the services inside their clusters (most of the cases) and the latter would allow for custom use cases like a different cluster, non-k8s workloads and etc.

Ensure correct regex for routes with parameters

When setting routes we use naive implementation of regex as [A-z0-9]+ for route with parameters (/pet/{id}). This creates conflicts for existing routes (e.g. /pet/findByStatus) since is occasionally caught by /pet/{id} route when it has CORS but /pet/findByStatus doesn't. We need to make sure that regex covers the type that is set in the parameters in OpenAPI.

Routes order must be more specific

As per https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_conn_man/route_matching

When Envoy matches a route, it uses the following procedure:
The HTTP request’s host or :authority header is matched to a virtual host.

Each route entry in the virtual host is checked, in order. If there is a match, the route is used and no further route checks are made.

Independently, each virtual cluster in the virtual host is checked, in order. If there is a match, the virtual cluster is used and no further virtual cluster checks are made.

That means if route with path prefix matching was early in the list of routes for vhost, it will win all routes, even if they're more specific (exact path or regex). We need to ensure that routes in vhost are sorted by:

  1. Exact path first
  2. Longest regex path first
  3. Longest prefix path first
    This must ensure that prefix path / will not match any other routes.

Mocking prototype

Implement the way to mock paths with predefined responses as POC.
E.g. using x-kusk construct:

x-kusk:
  mock:
    response: "{ blablabla: true }"

Change APIs to v1alpha1

We should change our APIs to v1alpha1 before the general release so that we'd be able to update them later without breaking a compatibility promise (which is implicit if we settle on v1 API).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.