Repository navigation
Remove endpoint /quitquitquit from admin server - #3347
Conversation
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
knative-prow-robot
left a comment
There was a problem hiding this comment.
@xtreme-andrew-su: 4 warnings.
Details
In response to this:
In this PR the goal is to avoid exposing the admin port to all other pods while maintaining liveness and readiness probing.
- Port 8022 is no longer exposed through deployment
- Admin server is now only bound to localhost
- Liveness and Readiness probes are now executing the queue application to hit its own endpoints.
- This was done to avoid either updating the base image to have something like
curlor creating another binary whose sole purpose is to query the admin endpoints.- To query health or quit it's now
/ko-app/queue exec healthand/ko-app/queue exec quitFixes #3279
/lint
/wip
/holdOpen questions:
- Should the executable path be configurable through a
ConfigMap? Separate PR?
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.
535db98 to
5a342d7
Compare
andrew-su
left a comment
There was a problem hiding this comment.
Fixed linter errors.
|
I signed it! |
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
|
It looks like the version of |
vagababov
left a comment
There was a problem hiding this comment.
So the main question is: if this is an admin tool that someone has to launch somehow (how?): then why is it in queue binary at all?
@vagababov it is launched by the kubelet by the readiness probe and the lifecycle hook. My guess of why @xtreme-andrew-su puts it in the queue binary is that because @jonjohnsonjr is there a way to have |
ac56291 to
d1c6464
Compare
d1c6464 to
bc11798
Compare
vagababov
left a comment
There was a problem hiding this comment.
Just stylistic.
Thanks!
bc11798 to
10c98a6
Compare
|
Do you have a bit more context on this snippet? serving/pkg/reconciler/v1alpha1/revision/resources/deploy.go Lines 58 to 69 in 4a11cdd |
|
@xtreme-andrew-su good find. The context here is that the user-container will need to wait for queue-proxy to drain properly. So in this case we probably have to keep the admin port but won't expose Please let me know if this make sense? |
The idea makes sense to have the user container finish processing what it has already accepted while it makes the queue-proxy container not "ready" thus requests are no longer routed to it. The |
|
@xtreme-andrew-su If that is all |
|
@tcnghia I fear that what you're suggesting is not feasible in this case. It sleeps for 20s (we had that historically, I think we can revisit that sleep at this point) and then calls |
Yeah, we still want the prestop for the queue container. Since we want the prestop on queue container to marks itself as not-ready and begin shutdown. The user-container won't have access to do that as the endpoint for shutdown won't exist anymore and can't call the queue binary. |
|
I'd like to do a fact check with y'all.
What we have today:
After an attempt at the previous proposal.. it was getting a bit ugly/messy. Taking a step back, I feel we should be moving towards:
This should address the two goals above. Is there something I'm missing in the purpose of |
10c98a6 to
e74e00a
Compare
e74e00a to
612f549
Compare
|
/hold cancel |
889441a to
4674b7c
Compare
|
/retest |
markusthoemmes
left a comment
There was a problem hiding this comment.
This looks superb to me. Very neat implementation, thanks @xtreme-andrew-su!
Left a few comments here and there but great overall!
/approve
| cleaner() | ||
| } | ||
| return func(_ http.ResponseWriter, _ *http.Request) { | ||
| <-h.drainCh |
There was a problem hiding this comment.
No need to send a response at all?
There was a problem hiding this comment.
Oh I see, there is a test for that 👍
There was a problem hiding this comment.
Yup, I figured that if they wanted to know the actual readiness of the server they should use /health
| time.Sleep(quitSleepDuration) | ||
| if err := server.Shutdown(context.Background()); err != nil { | ||
| logger.Errorf("Failed to shutdown proxy server", zap.Error(err)) | ||
| } |
There was a problem hiding this comment.
Shall we keep the debug log and the comment on server.Shutdown?
There was a problem hiding this comment.
Added comments for sleep and shutdown
| // queue-proxy. | ||
| RequestQueueHealthPath = "/health" | ||
|
|
||
| // RequestQueueDrainPath specifies the path for waiting on drain. |
There was a problem hiding this comment.
Maybe specify what "drain" is in this case with a bit more verbosity. As you probably noted while implementing this, the "why things are the way they are" can be confusing to detangle in this case.
|
@xtreme-andrew-su Want to rename the PR? The commit message will equal to the PR name and the impl. has changed a lot. |
/quitquitquit for shutting down proxy server
This change is to fix issue knative#3279. Rely on SIGTERM from kubernetes to trigger drain. User-container wait for the drain to complete instead of shutting down the proxy server. * Add new endpoint `/wait-for-drain` * Remove the pre-stop lifecycle hook on queue-proxy container * Update the pre-stop lifecycle hook on user-container to use `wait-for-drain`
4674b7c to
2f0eade
Compare
/quitquitquit for shutting down proxy server/quitquitquit from admin server
markusthoemmes
left a comment
There was a problem hiding this comment.
/lgtm
/approve
Very nice work 🎉
|
/assign @mattmoor Would you do me the honors for the reconciler changes? |
| return func(w http.ResponseWriter, r *http.Request) { | ||
| h.shutdown() | ||
| // DrainHandler constructs a handler that waits until the proxy server is shut down. | ||
| func (h *State) DrainHandler() func(_ http.ResponseWriter, _ *http.Request) { |
There was a problem hiding this comment.
Considering that this is done once during the construction of the server, why not just create the channel during construction of the State? At that point the whole function can be replaced with
func (h *State) DrainHandler(_ http.ResponseWriter, _ *http.Request) {
<- h.drainCh
}
and its invocation, as mux.HandleFunc(queue.RequestQueueDrainPath, healthState.DrainHandler)
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: markusthoemmes, tcnghia, xtreme-andrew-su The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
In this PR the goal is to avoid exposing the admin port to all other pods while maintaining liveness and readiness probing.
curlor creating another binary whose sole purpose is to query the admin endpoints./ko-app/queue exec healthand/ko-app/queue exec quitFixes #3279
/lint
/wip
/hold
Open questions:
ConfigMap? Separate PR?