Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement gRPC Health Checking Protocol + add readiness/liveness probes to vizier-core #270

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmd/manager/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ RUN go build -o vizier-manager

FROM alpine:3.7
WORKDIR /app
RUN GRPC_HEALTH_PROBE_VERSION=v0.2.0 && \
wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \
chmod +x /bin/grpc_health_probe
COPY --from=build-env /go/src/github.com/kubeflow/katib/cmd/manager/vizier-manager /app/
COPY --from=build-env /go/src/github.com/kubeflow/katib/pkg/manager/visualise /
ENTRYPOINT ["./vizier-manager"]
Expand Down
191 changes: 110 additions & 81 deletions cmd/manager/main.go

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions manifests/vizier/core/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ spec:
ports:
- name: api
containerPort: 6789
readinessProbe:
exec:
command: ["/bin/grpc_health_probe", "-addr=:6789"]
initialDelaySeconds: 5
livenessProbe:
exec:
command: ["/bin/grpc_health_probe", "-addr=:6789"]
initialDelaySeconds: 10
# resources:
# requests:
# cpu: 500m
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
api.pb.go: api.proto
protoc -I. api.proto --go_out=plugins=grpc:.
health.pb.go: health/health.proto
protoc -I. health/health.proto --go_out=plugins=grpc:.
10 changes: 6 additions & 4 deletions pkg/api/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
docker run -it --rm -v $PWD:$(pwd) -w $(pwd) znly/protoc --python_out=plugins=grpc:./python --go_out=plugins=grpc:. -I. api.proto
docker run -it --rm -v $PWD:$(pwd) -w $(pwd) znly/protoc --plugin=protoc-gen-grpc=/usr/bin/grpc_python_plugin --python_out=./python --grpc_out=./python -I. api.proto
docker run -it --rm -v $PWD:$(pwd) -w $(pwd) znly/protoc --grpc-gateway_out=logtostderr=true:. -I. api.proto
docker run -it --rm -v $PWD:$(pwd) -w $(pwd) znly/protoc --swagger_out=logtostderr=true:. -I. api.proto
for proto in api.proto health/health.proto; do
docker run -it --rm -v $PWD:$(pwd) -w $(pwd) znly/protoc --python_out=plugins=grpc:./python --go_out=plugins=grpc:. -I. $proto
docker run -it --rm -v $PWD:$(pwd) -w $(pwd) znly/protoc --plugin=protoc-gen-grpc=/usr/bin/grpc_python_plugin --python_out=./python --grpc_out=./python -I. $proto
docker run -it --rm -v $PWD:$(pwd) -w $(pwd) znly/protoc --grpc-gateway_out=logtostderr=true:. -I. $proto
docker run -it --rm -v $PWD:$(pwd) -w $(pwd) znly/protoc --swagger_out=logtostderr=true:. -I. $proto
done
189 changes: 189 additions & 0 deletions pkg/api/health/health.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions pkg/api/health/health.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
syntax = "proto3";

package grpc.health.v1;

service Health {
rpc Check(HealthCheckRequest) returns (HealthCheckResponse);
}

message HealthCheckRequest {
string service = 1;
}

message HealthCheckResponse {
enum ServingStatus {
UNKNOWN = 0;
SERVING = 1;
NOT_SERVING = 2;
}
ServingStatus status = 1;
}
37 changes: 37 additions & 0 deletions pkg/api/health/health.swagger.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"swagger": "2.0",
"info": {
"title": "health/health.proto",
"version": "version not set"
},
"schemes": [
"http",
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {},
"definitions": {
"HealthCheckResponseServingStatus": {
"type": "string",
"enum": [
"UNKNOWN",
"SERVING",
"NOT_SERVING"
],
"default": "UNKNOWN"
},
"v1HealthCheckResponse": {
"type": "object",
"properties": {
"status": {
"$ref": "#/definitions/HealthCheckResponseServingStatus"
}
}
}
}
}
Loading