Giter VIP home page Giter VIP logo

kube-vip-gateway-api's Introduction

Kube-vip Gateway API

This is an initial implementation of the various controllers required in order to manage Gateway API network deployments within Kubernetes. At the moment four basic controllers are implemented:

  • GatewayClass
  • Gateway
  • TCPRoute
  • UDPRoute

Usage

Build

go build

If I ever really learn how makefiles work, then perhaps i'll implement one

Running

If you're running outside of a Kubernetes cluster then something like the following will work..

./gateway-api-controller -metrics-bind-address :8083 -kubeconfig ~/.kube/config

Want to change the gatewayClass then the flag -gateway-class-name will probably help, setting the -ipam-configmap will point to a configmap that contains the range or cidr used for IPAM.

Create that range with the following:

kubectl create configmap --namespace default <configmap_name> --from-literal range-global=172.18.100.10-172.18.100.30

Example

The /manifests folder contains the basics of the GatewayClass, Gateway and TCPRoute yaml structure..

Implemented logic

  • Currently the GatewayClass will set the status ACCEPTED -> True if the gateway controller matches the flag -gateway-class-name
  • When a Gateway is created it will verify that the parent GatewayClass exists.
  • The Gateway will also perform IPAM and apply an address to the .Spec.Address and .Status.Address fields
  • The TCPRoute will look up its parent gateway and confirm that the it's the correct reference, it will then find the listener (external IP address)... with the listener and TCPRoute routes it will then lookup the referenced service.

Services implementation (WIP)

When creating a TCPRoute you can apply the following labels:

metadata:
  labels:
    selectorkey: app
    selectorvalue: my-nginx
    serviceBehaviour: create

The selector key/value is used when creating/updating/duplicating a corresponding service, the serviceBehaviour determins what the TCPRoute controller will do when a new route is created. (The default behaviour is to create a new service, referenced by rules.backendRefs.name)

Thoughts

As Gateway-API has no concept of selectors (to identify a range of pods or endpoints), it refers to a a service though the []rules.[]backendRefs.name (multiple rules, with multiple backends) with a destination port and destination service (identified as name). With L2/L3 loadbalancers not touching the dataplane we rely in Kubernetes services (of type=LoadBalancer) to configure the kube-proxy so that the dataplane works, without selectors we can't create "enough" of a new service that will map to endpoints.. we can refer to an existing service (that a user has to create) however.

So what are the options moving forward:

Idea 1

Add key/value labels to a TCPRoute that "emulate" the selector on a service, we can then create a brand new service of type=LoadBalancer with the external address from the gateway and the destination settings of the TCPRoute.

Idea 2

We can ask a user to create a quick service (clusterIP etc..) that has the selectors in it, we can then duplicate that service with type=LoadBalancer and set the .spec.LoadBalancerIP from the gateway address along with the additional config from the TCPRoute.

Idea 3

We can update the refered service with the configuration from the gateway/TCPRoute so that it behaves as we're asking Gateway API.

It will create a new service based upon that referenced service with the type loadbalancer and away we go...

that's it so far (clearly a long way to go)

Want to Contribute?

Please and thankyou

kube-vip-gateway-api's People

Contributors

inductor avatar thebsdbox 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

Watchers

 avatar  avatar  avatar

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.