-
Notifications
You must be signed in to change notification settings - Fork 511
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
Introduce health check grpc service to Signer #902
Conversation
Can one of the admins verify this patch? |
jenkins, test this please. |
// The server will use an empty string as the key for server's overall health status, | ||
// so that a client not interested in a specific service can query the server's status | ||
// with an empty service name. | ||
err := notarySigner.CheckHealth(duration, "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a test for CheckHealth
with the empty service argument?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test added
jenkins, test this please |
|
||
} | ||
|
||
// TestHealthCheckUnExistsService query for an un-exists service's health status |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can we change an un-exists
to a nonexistent
here, in the function name, and in the comment below?
updated |
jenkins, test this please. |
} | ||
|
||
// healthCheckHealthy succeeds if server is healthy and reachable. | ||
func healthCheckKMHealthy(t *testing.T, serviceName string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: function name should probably be healthCheckHealthy
to match the description
LGTM after nits! Thank you @HuKeping for your work on this :) |
// healthCheckConnectionDied fails immediately if not connected to the server. | ||
func healthCheckConnectionDied(t *testing.T, serviceName string) { | ||
hs := health.NewServer() | ||
hs.SetServingStatus(serviceName, healthpb.HealthCheckResponse_NOT_SERVING) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can we change this to healthpb.HealthCheckResponse_SERVING
so that the only reason it should be failing is the disconnection?
Thank you all your work on this! LGTM after the two minor nitpick changes! |
Updated. After this PR, we could also regenerate the proto of signer, I think at least the |
ping ... |
Oh I must have forgotten to commit that ! |
No problem, thank you for updating! LGTM pending CI |
jenkins, test this please. |
@@ -1,12 +1,12 @@ | |||
// Code generated by protoc-gen-go. | |||
// source: proto/signer.proto | |||
// source: signer.proto |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huh this change seems unexpected, do we know why this changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's relative from where you run the protoc
command. If you run make protos
from the main repo directory you get proto/signer.proto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch, updated!
jenkins, test this please |
@HuKeping: thanks for updating the protos, LGTM! |
Thanks @HuKeping! LGTM pending CI! |
Every time this happens, |
As per SPEC: https://github.com/grpc/grpc/blob/master/doc/health-checking.md We hook a health check service into notary-signer along with the normal services, say "KeyManagement" and "Signer". After booting "KeyManagement" and "Signer", we set the health status of each to be "SERVING" which would be returned as the status of service on the health checking time. Signed-off-by: Hu Keping <hukeping@huawei.com>
1) Create three constants for different grpc services. 2) Create two helper function used to check the health status of Signer and KeyManagement. 3) Due to 2), we refator the CheckHealth function to use switch to see which service's health status was required. Signed-off-by: Hu Keping <hukeping@huawei.com>
Signed-off-by: Hu Keping <hukeping@huawei.com>
Create some helper functions and refactor the health check test. Signed-off-by: Hu Keping <hukeping@huawei.com>
Signed-off-by: Hu Keping <hukeping@huawei.com>
Signed-off-by: Hu Keping <hukeping@huawei.com>
jenkins, test this please. |
thanks for regenerating the protos and all of your work on this 👍 |
LGTM! Thank you for all your work on adding this! |
ping :) |
CI green, merging :) |
Fixes #894
Fixes #917
As per SPEC:
https://github.com/grpc/grpc/blob/master/doc/health-checking.md
We hook a health check service into notary-signer along with
the normal services, say "KeyManagement" and "Signer".
After booting "KeyManagement" and "Signer", we set the health status
of each to be "SERVING" which would be returned as the status of
service on the health checking time.
Signed-off-by: Hu Keping hukeping@huawei.com