Skip to content

logs: Use resource builder and upstream code - #5233

Merged
openshift-bot merged 2 commits into
openshift:masterfrom
0xmichalis:logs
Oct 23, 2015
Merged

openshift-bot merged 2 commits into
openshift:masterfrom
0xmichalis:logs

Conversation

@0xmichalis

Copy link
Copy Markdown
Contributor

@smarterclayton

Copy link
Copy Markdown
Contributor

Do we have tests for these new types in another PR?

@0xmichalis

Copy link
Copy Markdown
Contributor Author

Do we have tests for these new types in another PR?

No, I'll add any tests here.

@liggitt

liggitt commented Oct 21, 2015

Copy link
Copy Markdown
Contributor

what PR is the upstream commit in? if none, please open one, then update the commit title to include the upstream PR number (e.g. UPSTREAM: 1234: title)

@ironcladlou

Copy link
Copy Markdown
Contributor

I'd like to get this in to support #5305

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.

is there any way this could have a PodLogsNamespacer, not a factory? Requiring a factory makes it really hard to reuse this from other commands (as evidenced by the plumbing required to update the other commands that delegate to this).
edit: hmm, looks like it's the resource builder bits and the LogsForObject... I really wish we didn't need a whole factory for that

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.

Take methods or an interface.

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.

It's either the factory or a method and the resource builder. I opted for the first since it's cleaner but I don't feel strongly..

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.

@liggitt PTAL

@0xmichalis

Copy link
Copy Markdown
Contributor Author

@smarterclayton actually we already test all new types against logs

oc logs ${BUILD_NAME} --loglevel=6
oc logs ${BUILD_NAME} --loglevel=6
oc logs bc/ruby-sample-build --loglevel=6
oc logs buildconfigs/ruby-sample-build --loglevel=6
oc logs buildconfig/ruby-sample-build --loglevel=6

oc logs dc/database -n $1 --follow
echo "[INFO] Waiting for database service to start"
wait_for_command "oc get -n $1 services | grep database" $((20*TIME_SEC))
DB_IP=$(oc get -n $1 --output-version=v1beta3 --template="{{ .spec.portalIP }}" service database)
echo "[INFO] Waiting for frontend pod to start"
wait_for_command "oc get -n $1 pods | grep frontend | grep -i Running" $((120*TIME_SEC))
oc logs dc/frontend -n $1 --follow

@0xmichalis

Copy link
Copy Markdown
Contributor Author

what PR is the upstream commit in? if none, please open one, then update the commit title to include the upstream PR number (e.g. UPSTREAM: 1234: title)

Upstream PR is kubernetes/kubernetes#10707, updated the commit message.

@ironcladlou

Copy link
Copy Markdown
Contributor

LGTM, waiting on another round of feedback from @liggitt or @smarterclayton re: interfaces

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.

I think it's more predictable to just tell the truth: the logs are no longer available. If we want to report something like what you have here (that the last deployment was successful) we could make it accurate by just fetching the RC to verify it exists and was successful. Thoughts?

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.

we could make it accurate by just fetching the RC to verify it exists and was successful

I like this. Personally I wouldn't mind leaving the output empty but someone will definitely request for it at some point.

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.

@ironcladlou updated to get the deployment and check if it's status is complete in case of no logs

@0xmichalis

Copy link
Copy Markdown
Contributor Author

[test]

@openshift-bot

Copy link
Copy Markdown
Contributor

Comment thread pkg/cmd/cli/cmd/logs_test.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.

You still need this check to make sure that we don't have flag conflicts as we start adding our own log options.

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.

Moved it back.

@liggitt

liggitt commented Oct 22, 2015

Copy link
Copy Markdown
Contributor

structurally, this feels similar to the Scale operation... basically a polymorphic operation... can we figure out what we want the interface in the client to look like and do the same thing for both?

Right now, this introduces: PodLogsNamespacer, which seems too specific, maybe?
Scaling has ScaleNamespacer, which seems more composable

edit: @deads2k is convincing me this is a reasonable first step

@0xmichalis

Copy link
Copy Markdown
Contributor Author

Right now, this introduces: PodLogsNamespacer, which seems too specific, maybe?

If I want to get build logs. I will use a BuildLogsNamespacer, if I want to get deployment logs there is the DeploymentLogNamespacer, so why not a PodLogsNamespacer for pod logs?

@openshift-bot openshift-bot removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Oct 22, 2015
@0xmichalis 0xmichalis closed this Oct 23, 2015
@0xmichalis 0xmichalis reopened this Oct 23, 2015
@0xmichalis

Copy link
Copy Markdown
Contributor Author

I feel this is ready for a final review

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.

Add a TODO to only inspect the string without retrieving the object.

@deads2k

deads2k commented Oct 23, 2015

Copy link
Copy Markdown
Contributor

Minor comments.

lgtm otherwise.

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin test up to 523c5e9

@ironcladlou

Copy link
Copy Markdown
Contributor

[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/3749/) (Image: devenv-rhel7_2539)

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin merge up to 523c5e9

openshift-bot pushed a commit that referenced this pull request Oct 23, 2015
Merged by openshift-bot
@openshift-bot
openshift-bot merged commit 74d4fa4 into openshift:master Oct 23, 2015
@0xmichalis
0xmichalis deleted the logs branch October 23, 2015 18:00
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.

6 participants