From 5d221e781a566a79da861c66188481dc2d97c674 Mon Sep 17 00:00:00 2001 From: Marshall Jones Date: Tue, 20 Aug 2019 20:47:30 -0700 Subject: [PATCH 1/2] Propose Embedding Health Check Proto Copy this file https://github.com/grpc/grpc-proto/blob/master/grpc/health/v1/health.proto into the ghz folder for use when promoting a canary running a grpc service. This repo describes the file: > This repository contains common protocol definitions for peripheral services around gRPC such as health checking, load balancing etc.. Any app that chooses to implement this interface (which imo should be any grpc service exposing a health check) will then be able to use this without providing reflection. I'm not a grpc expert so I'm not sure what the best practices are around allowing reflection on the server but this seems like a simple solution for those who choose not to enable it. Slack discussion on the weave users slack is here - https://weave-community.slack.com/archives/CGLQLLH9Q/p1566358441123400 You can utilize this file like so `/ghz --proto=/tmp/health.proto --call=grpc.health.v1.Health/Check ...` --- Dockerfile.loadtester | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile.loadtester b/Dockerfile.loadtester index 220c27380..2fd6031bd 100644 --- a/Dockerfile.loadtester +++ b/Dockerfile.loadtester @@ -16,6 +16,8 @@ rm -rf linux-amd64 RUN curl -sSL "https://github.com/bojand/ghz/releases/download/v0.39.0/ghz_0.39.0_Linux_x86_64.tar.gz" | tar xz -C /tmp && \ mv /tmp/ghz /usr/local/bin && chmod +x /usr/local/bin/ghz && rm -rf /tmp/ghz-web +ADD https://github.com/grpc/grpc-proto/blob/master/grpc/health/v1/health.proto /tmp/ghz/health.proto + RUN ls /tmp COPY ./bin/loadtester . From ffe5dd91c5b92c1dfcf8e262ccfd929e4810b3d7 Mon Sep 17 00:00:00 2001 From: Marshall Jones Date: Wed, 21 Aug 2019 15:15:01 -0700 Subject: [PATCH 2/2] Add an example and fix path to downloaded proto file --- Dockerfile.loadtester | 2 +- docs/gitbook/how-it-works.md | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Dockerfile.loadtester b/Dockerfile.loadtester index 2fd6031bd..c50d67194 100644 --- a/Dockerfile.loadtester +++ b/Dockerfile.loadtester @@ -16,7 +16,7 @@ rm -rf linux-amd64 RUN curl -sSL "https://github.com/bojand/ghz/releases/download/v0.39.0/ghz_0.39.0_Linux_x86_64.tar.gz" | tar xz -C /tmp && \ mv /tmp/ghz /usr/local/bin && chmod +x /usr/local/bin/ghz && rm -rf /tmp/ghz-web -ADD https://github.com/grpc/grpc-proto/blob/master/grpc/health/v1/health.proto /tmp/ghz/health.proto +ADD https://raw.githubusercontent.com/grpc/grpc-proto/master/grpc/health/v1/health.proto /tmp/ghz/health.proto RUN ls /tmp diff --git a/docs/gitbook/how-it-works.md b/docs/gitbook/how-it-works.md index 34a0806d6..d2c05e1de 100644 --- a/docs/gitbook/how-it-works.md +++ b/docs/gitbook/how-it-works.md @@ -798,6 +798,18 @@ webhooks: cmd: "ghz -z 1m -q 10 -c 2 --insecure podinfo.test:9898" ``` +`ghz` uses reflection to identify which gRPC method to call. If you do not wish to enable reflection for your gRPC service you can implement a standardized health check from the [grpc-proto](https://github.com/grpc/grpc-proto) library. To use this [health check schema](https://github.com/grpc/grpc-proto/blob/master/grpc/health/v1/health.proto) without reflection you can pass a parameter to `ghz` like this + +```yaml +webhooks: + - name: grpc-load-test-no-reflection + url: http://flagger-loadtester.test/ + timeout: 5s + metadata: + type: cmd + cmd: "ghz --insecure --proto=/tmp/ghz/health.proto --call=grpc.health.v1.Health/Check podinfo.test:9898" +``` + The load tester can run arbitrary commands as long as the binary is present in the container image. For example if you you want to replace `hey` with another CLI, you can create your own Docker image: