Skip to content

Make logs work for builds - #4997

Merged
openshift-bot merged 2 commits into
openshift:masterfrom
deads2k:make-logs-work-for-builds
Oct 9, 2015
Merged

openshift-bot merged 2 commits into
openshift:masterfrom
deads2k:make-logs-work-for-builds

Conversation

@deads2k

@deads2k deads2k commented Oct 7, 2015

Copy link
Copy Markdown
Contributor

This adds support to oc logs to handle buildconfigs and builds. For a buildconfig, it locates the most recent build for the buildconfig and displays its logs. I could see an argument for including --nowait on oc logs, but for now I've hardcoded the default.

Fixes #2659

@bparees @csrwng @smarterclayton @Kargakis Complaints in principle?

@csrwng

csrwng commented Oct 7, 2015

Copy link
Copy Markdown
Contributor

I like it 👍 esp that I can use a bc name and don't need to get the build name. Though it would make sense that we allow other objects like dc/deployments

@deads2k

deads2k commented Oct 7, 2015

Copy link
Copy Markdown
Contributor Author

I like it esp that I can use a bc name and don't need to get the build name. Though it would make sense that we allow other objects like dc/deployments

Deployment logs haven't landed. I don't want to steal @Kargakis's thunder. :)

Comment thread pkg/cmd/cli/cmd/logs.go

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has to be abstracted out into a method on Factory for this to be viable.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the long run.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has to be abstracted out into a method on Factory for this to be viable.

By "this", you mean the idea of handling logs for different kinds of resources? If we could agree on all flags, I definitely agree. However, things like --nowait seem useful and also unlikely to move upstream. I could also envision flags "this many builds/deployments before current" and "show me logs for a pod in the RC of a DC's current deployment". I want my oc logs command to do all those things.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with it for now.

On Oct 7, 2015, at 3:03 PM, David Eads [email protected] wrote:

In pkg/cmd/cli/cmd/logs.go
#4997 (comment):

  • resourceType := "pod"
  • resourceName := o.ResourceString
  • tokens := strings.SplitN(o.ResourceString, "/", 2)
  • if len(tokens) == 2 {
  • resourceType = tokens[0]
    
  • resourceName = tokens[1]
    
  • }
  • resourceType = strings.ToLower(resourceType)
    +
  • // if we're requesting a pod, delegate directly to kubectl logs
  • if (tokens[0] == "pods") || (tokens[0] == "pod") || len(o.ContainerName) > 0 {
  • kLogsOptions.PodName = resourceName
    
  • return kLogsOptions.RunLog()
    
  • }
    +
  • switch resourceType {

This has to be abstracted out into a method on Factory for this to be
viable.

By "this", you mean the idea of handling logs for different kinds of
resources? If we could agree on all flags, I definitely agree. However,
things like --nowait seem useful and also unlikely to move upstream. I
could also envision flags "this many builds/deployments before current" and
"show me logs for a pod in the RC of a DC's current deployment". I want my oc
logs command to do all those things.

—
Reply to this email directly or view it on GitHub
https://github.com/openshift/origin/pull/4997/files#r41431680.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has to be abstracted out into a method on Factory for this to be viable.

Let's open an issue about this

@deads2k
deads2k force-pushed the make-logs-work-for-builds branch from d42741e to a4bca79 Compare October 7, 2015 20:39
@deads2k deads2k changed the title [WIP] Make logs work for builds Make logs work for builds Oct 7, 2015
@bparees

bparees commented Oct 7, 2015

Copy link
Copy Markdown
Contributor

Yay! Time to deprecate oc build-logs, finally.

@0xmichalis

Copy link
Copy Markdown
Contributor

If we are going to deprecate build-logs, I would prefer exposing deployment logs only after this PR lands (and not via deploy --logs). We wouldn't be able to view at older deployments without introducing a new flag here but we could also avoid that once we start using upstream deployments. @smarterclayton @ironcladlou thoughts?

@deads2k

deads2k commented Oct 7, 2015

Copy link
Copy Markdown
Contributor Author

Yay! Time to deprecate oc build-logs, finally.

Clearly it should have annoyed me while I was at work sooner. :)

@0xmichalis

Copy link
Copy Markdown
Contributor

Related issue: #2659

@ironcladlou

Copy link
Copy Markdown
Contributor

Definitely agree that this should be the foundation for deployment logs.

@deads2k
deads2k force-pushed the make-logs-work-for-builds branch from a4bca79 to 8b4f77e Compare October 8, 2015 14:02
@deads2k

deads2k commented Oct 8, 2015

Copy link
Copy Markdown
Contributor Author

[test]

@openshift-bot

Copy link
Copy Markdown
Contributor

@mfojtik

mfojtik commented Oct 8, 2015

Copy link
Copy Markdown
Contributor

@bparees @deads2k we should keep build-logs around for some time with fat deprecation warning :-)

fat 👍 for getting rid of oc build-logs

@deads2k
deads2k force-pushed the make-logs-work-for-builds branch from 8b4f77e to 567b61a Compare October 8, 2015 15:22
@0xmichalis

Copy link
Copy Markdown
Contributor

To be honest I am worried about carrying our own version of the command. We already do something similar with oc expose and it's really painful maintaining it. I'm envisioning a URLValuesGenerator which runs upstream and here we use whatever additional flags we want without actually having our own logs. This would solve the problem for --no-wait. As for the rest @deads2k mentions, the factory is what we want to touch. Thoughts?

Separate issue after this lands is ok.

@deads2k

deads2k commented Oct 8, 2015

Copy link
Copy Markdown
Contributor Author

To be honest I am worried about carrying our own version of the command. We already do something similar with oc expose and it's really painful maintaining it. I'm envisioning a URLValuesGenerator which runs upstream and here we use whatever additional flags we want without actually having our own logs. This would solve the problem for --no-wait. As for the rest @deads2k mentions, the factory is what we want to touch. Thoughts?

Something similar to ReaperFor that accepts a resource,name tuple suits me fine. I don't see how it solves our flag problem for us, but I'd really like this functionality before such a refactor.

@deads2k

deads2k commented Oct 8, 2015

Copy link
Copy Markdown
Contributor Author

Ready for review. The UPSTREAM pull doesn't merge in cleanly, so this is functionally equivalent even if it doesn't match exactly. logs has changed a lot upstream.

@0xmichalis

Copy link
Copy Markdown
Contributor

I don't see how it solves our flag problem for us, but I'd really like this functionality before such a refactor.

Check how we currently generate parameters for expose and run https://github.com/kubernetes/kubernetes/blob/036fe1684973f323f75a55cb3ce01fbf23ba1d1b/pkg/kubectl/generate.go#L67

Also how we added --hostname to expose without actually touching any code upstream: https://github.com/openshift/origin/pull/2744/files

@deads2k

deads2k commented Oct 8, 2015

Copy link
Copy Markdown
Contributor Author

Check how we currently generate parameters for expose and run https://github.com/kubernetes/kubernetes/blob/036fe1684973f323f75a55cb3ce01fbf23ba1d1b/pkg/kubectl/generate.go#L67

Also how we added --hostname to expose without actually touching any code upstream: https://github.com/openshift/origin/pull/2744/files

Yeah, that doesn't solve the problem. If they choose a flag that conflicts with yours, you're still screwed.

@0xmichalis

Copy link
Copy Markdown
Contributor

If they choose a flag that conflicts with yours, you're still screwed.

How is that? If they choose the same flag, the result is still the same since its up to the generator to give a meaning to the flag. For example, if they add --hostname to expose, our --hostname would still be the same for routes (plus we would drop the flag).

Regarding the URLValuesGenerator, --nowait would translate to ?nowait=true in both cases

@0xmichalis

Copy link
Copy Markdown
Contributor

Regarding the URLValuesGenerator, --nowait would translate to ?nowait=true in both cases

We would still have to abstract in the factory though

@deads2k

deads2k commented Oct 8, 2015

Copy link
Copy Markdown
Contributor Author

How is that? If they choose the same flag, the result is still the same since its up to the generator to give a meaning to the flag. For example, if they add --hostname to expose, our --hostname would still be the same for routes.

Regarding the URLVaulesGenerator --nowait would translate to ?nowait=true in both cases

Who's to say that didn't choose to make that a flag a different type? I guess in the expose case they helpfully pass it through to a generator that strips all meaningful type information (map[string][]string as I recall?), but I find the generator pattern pretty painful to deal with. Stripping type information and passing it through magic containers makes things seem easy, but usually results in future pain.

@0xmichalis

Copy link
Copy Markdown
Contributor

The problem I had while working on abstracting the logging to the factory (https://github.com/openshift/origin/pull/3672/files) was that I couldn't carry our own url values since I was passing a PodLogOptions which is limited. I think that a generator that would break everything down to a map would be sufficient and solve this but I may be wrong. I will play around with it tomorrow.

@deads2k

deads2k commented Oct 8, 2015

Copy link
Copy Markdown
Contributor Author

@Kargakis are you requesting that we hold this pull on it?

Comment thread pkg/cmd/cli/cmd/logs.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Include examples of the other resource types

@smarterclayton

Copy link
Copy Markdown
Contributor

I'm ok with this being done in stages, we are going to hit this with jobs
upstream soon though

On Oct 8, 2015, at 2:29 PM, David Eads [email protected] wrote:

@Kargakis https://github.com/kargakis are you requesting that we hold
this pull on it?

—
Reply to this email directly or view it on GitHub
#4997 (comment).

@0xmichalis

Copy link
Copy Markdown
Contributor

@deads2k

deads2k commented Oct 8, 2015

Copy link
Copy Markdown
Contributor Author

Anyone have comments other than the example?

Comment thread pkg/cmd/cli/cmd/logs.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-c CONTAINER

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-c CONTAINER

I think we want to emphasize the fact that we take more resources, so I've made it match Use.

@deads2k
deads2k force-pushed the make-logs-work-for-builds branch from 567b61a to 466f659 Compare October 9, 2015 12:03
@deads2k
deads2k force-pushed the make-logs-work-for-builds branch from 466f659 to f1c6fbe Compare October 9, 2015 12:04
@deads2k

deads2k commented Oct 9, 2015

Copy link
Copy Markdown
Contributor Author

comments addressed.

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin test up to f1c6fbe

@0xmichalis

Copy link
Copy Markdown
Contributor

LGTM

@deads2k

deads2k commented Oct 9, 2015

Copy link
Copy Markdown
Contributor Author

[merge]

@openshift-bot

Copy link
Copy Markdown
Contributor

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_origin/3545/) (Image: devenv-fedora_2452)

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin merge up to f1c6fbe

openshift-bot pushed a commit that referenced this pull request Oct 9, 2015
@openshift-bot
openshift-bot merged commit 8a70d5f into openshift:master Oct 9, 2015
@pweil- pweil- mentioned this pull request Oct 22, 2015
@deads2k
deads2k deleted the make-logs-work-for-builds branch November 5, 2015 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants