gRPC client, service and CLI utility to provide/check load balancing and connection stability
import "github.com/takama/grpc/client"
...
c, err := client.New(cfg, log)
if err != nil {
log.Fatal(err)
}
ctx, cancel := context.WithTimeout(context.Background(), time.Second*15)
defer cancel()
e := echo.NewEchoClient(c.Connection())
response, err := e.Ping(
// This is important to pass trough c.Context(ctx)
// when we use Envoy balancer for any retries
c.Context(ctx),
&echo.Request{
Content: "Some content",
},
)
if err != nil {
log.Print(err)
}
fmt.Print("Response:", response.Content)
- Create a new project and GKE cluster in Google Cloud
- Setup Contour balancer according to example
- Note somewhere the IP of Load balancer
- Change default GKE values in
Makefile
on your own
GKE_PROJECT_ID ?= your-project-id
GKE_PROJECT_ZONE ?= europe-west1-b
GKE_CLUSTER_NAME ?= your-cluster-name
- Choose domain host name for the service and point your DNS record on GKE Contour balancer using IP above
- Make the certificates for the domain name (Let's encrypt as option)
- Test to create in dry run
grpc-service-tls
in corresponded Kubernetes environment (ex:test
)
kubectl create secret tls grpc-service-tls --key key.pem --cert cert.pem --dry-run -o yaml
- Create
grpc-service-tls
in corresponded Kubernetes environment (ex:test
)
kubectl create secret tls grpc-service-tls --key key.pem --cert cert.pem
- Change domain name in
.helm/values-test.yaml
or any othervalues-name.yaml
to your own
## Ingress route hosts
##
hosts:
## gRPC service host
- name: grpc
host: grpc.your-test-domain.net
...
## Client connection to the service
##
client:
host: grpc.your-test-domain.net
- Change default namespace in
Makefile
# Namespace: dev, prod, username ...
NAMESPACE ?= test
make build
make deploy
make compile
GOOS=darwin make compile
./bin/darwin-amd64/grpc client ping --count 600 --config config/test.conf
./bin/darwin-amd64/grpc client reverse --count 600 --config config/test.conf
During the ping process scale services from 1 to N and see how it is going
kubectl scale --replicas 3 -n test deploy/grpc
kubectl scale --replicas 6 -n test deploy/grpc
kubectl scale --replicas 1 -n test deploy/grpc
...
all
- run default complete set of commands (build the service)vendor
- import all vendors (using dep)compile
- build the service binarycerts
- download latests certs from an alpine image and prepare it for service containerbuild
- build container imagepush
- push an image in docker registryrun
- build and run the servicelogs
- show service logs from containerdeploy
- deployment of the service into Kubernetes environmentcharts
- validate helm templates (charts)test
- run unit testscover
- show testing coverage for packagesfmt
- format Go packages with go fmtlint
- use set of linters ( ~ 20) to check the service codestop
- stop running containerstart
- start existing container (if it was stopped before)rm
- remove stopped containerversion
- add next major/minor/patch versionclean
- remove binary and running containerbootstrap
- check and setup if something from utilities is not exist
All changes in the project described in changelog
Generated using (Caldera boilerplate)