GitXplorerGitXplorer
m

yages

public
36 stars
14 forks
0 issues

Commits

List of commits on branch master.
Verified
8d495d7135de603b9411ac76bd4026f2ddb02470

makes in-cluster access easier by introducing gump

mmhausenblas committed 6 years ago
Unverified
5db17917c138cd0ecdf31a9d9501a5f9f4d302cc

inits Conduit, factors out others

mmhausenblas committed 7 years ago
Unverified
a4a9b64e588023c970bd0d69b0678b623fde9c2d

updates for GCE deployment

mmhausenblas committed 7 years ago
Unverified
bd3ba58c19a96bf9365deab1f06bfb782787445c

adds LB via Ambassador

mmhausenblas committed 7 years ago
Unverified
b555d6e5cc53f595e06a8b0757fb0b9437e0cadf

updates Ingress

mmhausenblas committed 7 years ago
Unverified
99c6c2a23cd8c9293a18bffb34b11c2f6cc66d0f

fixes docs

mmhausenblas committed 7 years ago

README

The README file for this repository.

Yet another gRPC echo server

YAGES (yet another gRPC echo server) is an educational gRPC server implementation. The goal is to learn gRPC and communicate best practices around its deployment and usage in the context of Kubernetes.

As an Kubernetes app

You can install YAGES as an app in your Kubernetes cluster (tested with Kubernetes v1.9, v1.10, and v1.11) like so:

$ kubectl apply -f http://mhausenblas.info/yages/app.yaml

Then, in order to invoke the service you've got essentially two options: from inside the cluster or from the outside the cluster, by exposing the service.

From inside the cluster

To access the gRPC server from inside the cluster, you can for example use the gump container image that has grpcurl installed:

$ kubectl run -it --rm grpcurl --restart=Never --image=quay.io/mhausenblas/gump:0.1 -- sh 
If you don't see a command prompt, try pressing enter.
/go $ grpcurl --plaintext yages:9000 yages.Echo.Ping
{
  "text": "pong"
}

From outside the cluster

TBD: Using Ingress as shown in ingress.yaml or an OpenShift Route object with TLS passthrough set.

As a local app

Install

Requires Go 1.9 or above, do:

$ go get -u github.com/mhausenblas/yages

Use

You can run go run main.go in $GOPATH/src/github.com/mhausenblas/yages or if you've added $GOPATH/bin to your path, directly call the binary:

$ yages
2018/03/25 16:23:42 YAGES in version dev serving on 0.0.0.0:9000 is ready for gRPC clients …

Open up a second terminal session and using grpcurl execute the following:

# invoke the ping method:
$ grpcurl --plaintext localhost:9000 yages.Echo.Ping
{
  "text": "pong"
}
# invoke the reverse method with parameter:
$ grpcurl --plaintext -d '{ "text" : "some fun here" }' localhost:9000 yages.Echo.Reverse
{
  "text": "ereh nuf emos"
}
# invoke the reverse method with parameter from JSON file:
$ cat echo.json | grpcurl --plaintext -d @ localhost:9000 yages.Echo.Reverse
{
  "text": "ohce"
}

Note that you can execute grpcurl --plaintext localhost:9000 list and grpcurl --plaintext localhost:9000 describe to get further details on the available services and their respective methods.

Develop

First you want to generate the stubs based on the protobuf schema. Note that this requires the Go gRPC runtime and plug-in installed on your machine, including protoc in v3 set up, see grpc.io for the steps.

Do the following:

$ protoc \
  --proto_path=$GOPATH/src/github.com/mhausenblas/yages \
  --go_out=plugins=grpc:yages \
  yages-schema.proto

Executing above command results in the auto-generated file yages/yages-schema.pb.go. Do not manually edit this file, or put in other words: if you add a new message or service to the schema defined in yages-schema.proto just run above protoc command again and you'll get an updated version of yages-schema.pb.go in the yages/ directory as a result.