Skip to content
This repository has been archived by the owner on Mar 30, 2021. It is now read-only.

roleypoly/openfaas-grpc-controller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenFaaS gRPC Ingress Controller Controller

yeah, it's a double controller.

to put it quickly, this searches for any pods under openfaas-fn (the ones it creates,) and searches for an annotation, com.roleypoly/faas-rpc which is set to the "gRPC path" of the function underneath.

this controller creates FunctionIngress objects matching what gRPC native and improbable-eng/gRPC-web systems are expecting.

the overall goal was to have individual functions in a gRPC system exist as a function alone. this part solves routing.

Deploying

clone this repo,

kubectl apply -f ./k8s

Example

this example implies you are running a recent OpenFaaS install with nginx-ingress-controller and OpenFaaS's ingress-operator 1.5.0 or newer.

consider this well-known RPC definition, greeter.proto...

package greeter; // Note this, if it's missing, omit it from instructions.

// The greeting service definition.
service Greeter {
  // Sends a greeting
  rpc SayHello (HelloRequest) returns (HelloReply) {}
}

// The request message containing the user's name.
message HelloRequest {
  string name = 1;
}

// The response message containing the greetings
message HelloReply {
  string message = 1;
}

your stack.yaml would look like this to accomodate it

version: 1.0
provider:
  name: openfaas
functions:
  greeter-say-hello:
    lang: golang-grpc # this is the other piece of the puzzle! see below.
    handler: ./greeter-say-hello
    image: mydocker/greeter-say-hello:latest
    annotations:
      com.roleypoly/faas-rpc: greeter.Greeter/SayHello # *** omit `greeter.` if `package` is not set in protobuf.

and it should just work given this controller is deployed.

wait a minute

golang-grpc is the other piece of the puzzle. it provides the function wrapper pattern to support this working.

see example repo for an end-to-end example that you can run on your friendliest kubernetes cluster.

todo

  • it works
  • other ingresses (nginx only right now, no real reason)
  • example
  • verify on raspi (arm/v7 + arm64 images exist, though.)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published