Repository navigation
Inline deployer hook logs - #5305
Conversation
|
I'm always getting 0 bytes written to |
|
Deferring godocs and tests until I can prove this will work. |
|
One other thing for discussion: should we wrap the destination writer with something that prefixes the log output with something indicating that the output is from another pod? |
There was a problem hiding this comment.
why are we switching away from an interface?
There was a problem hiding this comment.
As I mention in the description and linked issue: I can't find any other way to get access to the pod log stream. None of the interfaces expose anything helpful for it that I can find. Suggestions?
Also, I don't necessarily think using the concrete client for initialization code (constructors) called only by other initialization code is a bad thing.
There was a problem hiding this comment.
if it's to plumb what's needed for logging, can we take a second arg which is an interface with all the required info instead (namespace, name, and PodLogOptions)?
There was a problem hiding this comment.
To be clear, if there was some interface to pod log streams, I'd certainly use it...
There was a problem hiding this comment.
requiring concrete client implementations (even in constructors) hamstrings us from ever building a joint client, or a client wrapper, etc
There was a problem hiding this comment.
@smarterclayton? I don't have a feel for the effort involved in exposing pod logs through the k8s client interface. Aware of any work in this area?
There was a problem hiding this comment.
it can be a second arg to the constructor, just make up your own interface here (I think namespace, name, and PodLogOptions are the only required input), and make an implementation which uses an internal *kclient.Client and pass it in
There was a problem hiding this comment.
Oh, I see what you mean. Good idea. Nevermind, @smarterclayton.
573b6d8 to
0c090c0
Compare
0c090c0 to
060a519
Compare
060a519 to
edbcdf7
Compare
|
@Kargakis @smarterclayton this is ready for review. |
There was a problem hiding this comment.
This belongs in its own method.
There was a problem hiding this comment.
Extracted method
|
Needs an e2e test. |
edbcdf7 to
0c8b5ef
Compare
The e2e tests already use a deployment config with both pre and post hooks which would exercise the log reading from a regression perspective... the most important thing I want verified is that the log reading goroutine won't block unexpectedly and cause the hook execution to stall the deployment, which the existing fixtures should cover. Did you have something else in mind for a specific scenario? |
There was a problem hiding this comment.
Since we are going to wait for the logs to be consumed, do we really need goroutines and all the sync machinery?
There was a problem hiding this comment.
Maybe we could have something like WaitForTerminatedHookPod?
There was a problem hiding this comment.
We're not necessarily waiting for the logs to be consumed, we're waiting for our attempt to consume the logs to be completed. There's no use asking for the logs until the pod's in a phase where the server will return them, and even though the pod was observed to be in a log-readable phase, by the time we ask for the stream, the master might return an error or a broken stream anyway. We also need to block until the pod is terminal anyway: an end of the log stream doesn't necessarily mean the pod has reached a terminal phase. It doesn't seem good to ignore the phase updates while blocking synchronously on log streaming.
If you have another algorithm to propose, describe it here and we'll discuss.
There was a problem hiding this comment.
At start I thought there would be no difference between what I was thinking and what you have here (it would just be a simpler impl) but you start returning the logs if the pod is observed as running and that's something that would still need another goroutine in my implementation. So I guess this is fine with me.
|
Code LGTM. I am going to pull the branch and test it. |
|
Finally got to rebuild and test this. Works like a charm. We may want to add timestamps by default to the pod hook logs? @ironcladlou Squash and this is LGTM |
0c8b5ef to
e7d71d2
Compare
I'm not sure if I want to introduce the complexity of a I can also see an argument that if we provide clear lines of demarcation (hook pods begin here/end here) and then print logs verbatim, the hook logs can be more reliably read by other tools without having to strip out our added line prefixes (what if the hook pod logs with its own timestamps, etc.) Maybe let's discuss that in a followup if there's demand? |
|
Adding timestamps is as simple as adding |
|
I don't feel strongly though.. I just didn't enjoy seeing my echo w/o one:) |
|
Sweet, let's do that. After I wrote my paragraph I also realized it would be easier to parse out "hook logs" if we added a known prefix, but I still don't really want to wrap the reader right now. |
e7d71d2 to
4fe9174
Compare
|
In this case it's |
|
Asset failure, [test] |
|
Only -q fails. Don't use -q On Tue, Nov 3, 2015 at 1:25 PM, Dan Mace [email protected] wrote:
|
|
There is no -q. The line that's failing is: The question is why does this fix it: |
|
Head may have the same behavior. On Tue, Nov 3, 2015 at 1:29 PM, Dan Mace [email protected] wrote:
|
|
$ seq 1 10000 | head -11 $ echo ${PIPESTATUS[@]}141 0 On Tue, Nov 3, 2015 at 1:33 PM, Clayton Coleman [email protected] wrote:
|
|
I realize that head is also susceptible. What I'm still not seeing any explanation for is why a sleep before executing the piped command consistently fixes it. |
|
There are less pods or exactly one pod? On Tue, Nov 3, 2015 at 1:34 PM, Dan Mace [email protected] wrote:
|
I have output demonstrating that when the pipe failure occurs, the client got a full PodList/200 OK. It's never failing due to a lack of pods returned from the |
|
The PIPEFAIL is due to the amount of lines - if the buffer still has On Tue, Nov 3, 2015 at 1:36 PM, Dan Mace [email protected] wrote:
|
That makes sense... double wow. Nice research |
|
Followup: why isn't this broken for everybody else? |
69d6801 to
c322bb1
Compare
|
Replaced piped calls to |
c322bb1 to
4a279a6
Compare
|
I've got a local |
Inline deployer hook logs into the deployer strategy pod output. This is useful for debugging hook pods, which are prone to being GC'd before users can get to the logs.
4a279a6 to
630fa13
Compare
|
TestRouterPathSpecificity and TestRouterDuplications flaked (?) locally. No more time tonight for more runs. |
|
Can you paste errors? On Nov 3, 2015, at 8:11 PM, Dan Mace [email protected] wrote: TestRouterPathSpecificity and TestRouterDuplications flaked (?) locally. No — |
|
Evaluated for origin test up to 630fa13 |
|
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin/6859/) |
|
[merge] |
|
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin/6859/) (Image: devenv-rhel7_2638) |
|
Evaluated for origin merge up to 630fa13 |
Implements inline deployer hook pod logs for #5199.
Logs will be streamed from the hook pod to the deployer pod's stdout.