-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Support gRPC probe #14134
Support gRPC probe #14134
Conversation
Welcome @seongpyoHong! It looks like this is your first PR to knative/serving 🎉 |
Hi @seongpyoHong. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@evankanderson @mgencur @psschwei (I tagged you because you were designated as a reviewer.) Could you please review this PR? |
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.
We should also add some unit tests and e2e tests
pkg/queue/health/probe.go
Outdated
client := grpchealth.NewHealthClient(conn) | ||
|
||
resp, err := client.Check(metadata.NewOutgoingContext(ctx, make(metadata.MD)), &grpchealth.HealthCheckRequest{ | ||
Service: ptr.ToString(config.Service), |
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.
Don't need to pull in a new pkg - we have https://github.com/knative/pkg/blob/main/ptr/ptr.go#L53
pkg/queue/health/probe.go
Outdated
}, | ||
} | ||
|
||
v := version.Get() |
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.
This doesn't work - this package is from the k8s code and assumes the binary is built with certain linker flags.
I'd look what we're doing with the HTTPProbe
pkg/queue/health/probe.go
Outdated
if err == context.DeadlineExceeded { | ||
return fmt.Errorf("timeout: failed to connect service %q within %v", addr, config.Timeout) | ||
} else { | ||
return fmt.Errorf("error: failed to connect service at %q", addr) |
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.
we should wrap the error in this message - eg. use %w
pkg/queue/health/probe.go
Outdated
return fmt.Errorf("timeout: health rpc did not complete within %v", config.Timeout) | ||
} | ||
} | ||
return fmt.Errorf("error: health rpc probe failed: %+v", err) |
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.
likewise wrap the error using %w
dialer := &net.Dialer{ | ||
Control: func(network, address string, c syscall.RawConn) error { | ||
return c.Control(func(fd uintptr) { | ||
unix.SetsockoptLinger(int(fd), syscall.SOL_SOCKET, syscall.SO_LINGER, &unix.Linger{Onoff: 1, Linger: 1}) | ||
}) | ||
}, | ||
} |
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 you reference where you got this from
https://github.com/kubernetes/kubernetes/blob/master/pkg/probe/dialer_others.go#L33
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.
and mention why we are using these options
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 have a question about it.
Is it necessary to handle the Windows container? 🤔
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.
No - we currently don't have windows support
34eee90
to
f23b828
Compare
@dprotaso I will request a review again when the test-related work is completed. Thank you. 😄 |
/retest |
63da60d
to
3c9307c
Compare
4673587
to
dd1b4f5
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #14134 +/- ##
==========================================
- Coverage 86.10% 86.04% -0.06%
==========================================
Files 196 196
Lines 14787 14874 +87
==========================================
+ Hits 12732 12799 +67
- Misses 1749 1764 +15
- Partials 306 311 +5
☔ View full report in Codecov by Sentry. |
hey @seongpyoHong thanks for the changes - looks like you have just one small lint error left https://github.com/knative/serving/actions/runs/6236884761/job/16936938875?pr=14134#step:5:28916 |
Hi @dprotaso, I resolved lint error. How can I run GitHub Actions for lint(code check)? |
Do you mean locally? We don't have an easy way to do it What we do is here: https://github.com/knative/actions/blob/main/.github/workflows/reusable-helper-go-style.yaml |
/lgtm thanks for all the help 🎉 getting this over the line |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dprotaso, seongpyoHong The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
* Add gRPC probe * Modify unit test * Modify unit test * Set default to grpcprobe's service field * Use knative pkg for ptr operation * Use config's KubeMajor & KubeMinor instead of k8s native version pkg * Wrap error in GRPCProbe * Add comment to explain why use dialer_others.go * Run update scripts * Add probe test * Add test in readiness/probe_test.go * update deps * Ignore readinessProbe when it's gRPC * Fix test to use empemeral port * Resolve govet lint error * Use errors.Is to compare * Also use ephemeral port for handler test * drop unneccesary else block (cherry picked from commit d02702e)
* Support gRPC probe (knative#14134) * Add gRPC probe * Modify unit test * Modify unit test * Set default to grpcprobe's service field * Use knative pkg for ptr operation * Use config's KubeMajor & KubeMinor instead of k8s native version pkg * Wrap error in GRPCProbe * Add comment to explain why use dialer_others.go * Run update scripts * Add probe test * Add test in readiness/probe_test.go * update deps * Ignore readinessProbe when it's gRPC * Fix test to use empemeral port * Resolve govet lint error * Use errors.Is to compare * Also use ephemeral port for handler test * drop unneccesary else block (cherry picked from commit d02702e) * Regenerate OCP release artifacts --------- Co-authored-by: Seongpyo Hong <[email protected]>
Fixes #12442
Proposed Changes
Exec probe by grpc-health-probe is the only way to check gRPC service healthy.
Add gRPC probe that kubernetes support from version 1.24 to make probing for gRPC service more convenient.
Release Note