Skip to content
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

[Federation] Print out status updates while kubefed init is running #41849

Merged
merged 1 commit into from
Apr 18, 2017

Conversation

perotinus
Copy link
Contributor

This is not an ideal final state–it does not address the appearance of hanging during long-running commands, for example–but it provides some level of information when the operations are successful.

See #41725.

Release note:

Prints out status updates when running `kubefed init`

@k8s-ci-robot
Copy link
Contributor

Hi @perotinus. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with @k8s-bot ok to test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

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. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 21, 2017
@k8s-reviewable
Copy link

This change is Reviewable

@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Feb 21, 2017
@madhusudancs
Copy link
Contributor

General comment for the overall change. I was thinking about doing something less verbose than this since these are user facing messages. Example:

"Creating a namespace for federation system components..."

you wait until the operation is done and then on the same line say "Ok" or "Done".

"Creating a namespace for federation system components...Done"

Something like that.

Also, don't you need linebreaks at the end of each fmt.Fprintf() string?


Review status: 0 of 2 files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@irfanurrehman
Copy link
Contributor

a discussion (no related file):
I dont think the user really needs to know all the steps explicitly under the hood. The problem was that there was no indication of progress, at all, whatsoever.
My suggestion (since you have already added these prints) would be to just change the verbosity level of minor steps (might be useful for debugging) , to skip the minor steps at default verbosity. So by default following would be printed:
1 - created namespace . . Done
2 - created service . . Done
3 - deployed api server . . Done
4 - deployed controller manager . .Done
The above are not time consuming and would happen almost immediately (seconds).

The last message could be
Waiting for the control plane to come up . . . . . . . . . . Done!
The ". . . " as Madhu suggested could be timed prints (for example 2 seconds)


Comments from Reviewable

@perotinus
Copy link
Contributor Author

Review status: 0 of 2 files reviewed at latest revision, 1 unresolved discussion.


a discussion (no related file):

Previously, irfanurrehman wrote…

I dont think the user really needs to know all the steps explicitly under the hood. The problem was that there was no indication of progress, at all, whatsoever.
My suggestion (since you have already added these prints) would be to just change the verbosity level of minor steps (might be useful for debugging) , to skip the minor steps at default verbosity. So by default following would be printed:
1 - created namespace . . Done
2 - created service . . Done
3 - deployed api server . . Done
4 - deployed controller manager . .Done
The above are not time consuming and would happen almost immediately (seconds).

The last message could be
Waiting for the control plane to come up . . . . . . . . . . Done!
The ". . . " as Madhu suggested could be timed prints (for example 2 seconds)

Thanks for the feedback! Yes, that makes a lot of sense. I've created some simpler messages that will always print (and fixed the line breaks), and moved some of the more-detailed messages to verbose logs. WDYT?


Comments from Reviewable

@perotinus
Copy link
Contributor Author

Ok, I've made these updates. Thanks!


Review status: 0 of 2 files reviewed at latest revision, 1 unresolved discussion.


Comments from Reviewable

@perotinus
Copy link
Contributor Author

@madhusudancs @irfanurrehman PTAL?

@madhusudancs
Copy link
Contributor

Reviewed 2 of 2 files at r2.
Review status: all files reviewed at latest revision, 11 unresolved discussions.


a discussion (no related file):

Previously, perotinus (Jonathan MacMillan) wrote…

Thanks for the feedback! Yes, that makes a lot of sense. I've created some simpler messages that will always print (and fixed the line breaks), and moved some of the more-detailed messages to verbose logs. WDYT?

I have left a few comments. None of those are critical or urgent. So I would recommend making all those changes in a separate follow up PR.

In the cases where you print the messages to STDOUT, you skip logging them. I think it is worth adding an INFO log for those creating ... steps too. I understand why you are doing this, but if you don't have these INFO logs, people who grep for "INFO" don't see the messages printed to STDOUT.

It looks good to me otherwise. However, I would like @irfanurrehman to make another pass and add the LGTM label when he is satisfied.


federation/pkg/kubefed/init/init.go, line 241 at r2 (raw file):

	// 1.
	fmt.Fprint(cmdOut, "Creating a namespace for federation system components... ")

Print the namespace in the message Creating namespace "federation-system" for federation system components...


federation/pkg/kubefed/init/init.go, line 246 at r2 (raw file):

		return err
	}
	fmt.Fprint(cmdOut, "done\n")

Use fmt.Fprintln()(https://golang.org/pkg/fmt/#Fprintln) instead. It's more readable. Also change all other occurrences.


federation/pkg/kubefed/init/init.go, line 249 at r2 (raw file):

	// 2.
	fmt.Fprint(cmdOut, "Creating federation control plane objects (service, credentials, persistent volume claim)... ")

I like this simplification a lot. However, I think service deserves its own message. It is one of the slowest operations in the entire init command, probably as slow as or slower than waiting for the control plane pods to come up.


federation/pkg/kubefed/init/init.go, line 270 at r2 (raw file):

	// 4.
	glog.V(4).Info("Creating an entry in the kubeconfig file with the certificate and credential data")

What's happening here is creation of kubeconfig data to be populated in a secret. While your message is correct if one reads it very carefully, it might also cause some confusion. I would just write this as Creating credentials secret for federation controller manager


federation/pkg/kubefed/init/init.go, line 275 at r2 (raw file):

		return err
	}
	glog.V(4).Info("kubeconfig successfully updated")

Same as above.


federation/pkg/kubefed/init/init.go, line 298 at r2 (raw file):

	// 6.
	fmt.Fprint(cmdOut, "Creating federation component deployments...")

I would just say Creating federation control plane components...


federation/pkg/kubefed/init/init.go, line 332 at r2 (raw file):

	// 8.
	fmt.Fprint(cmdOut, "Updating kubeconfig... ")

No log here?


federation/pkg/kubefed/init/init.go, line 349 at r2 (raw file):

	if err != nil {
		return err
	}

Log here?


federation/pkg/kubefed/init/init.go, line 353 at r2 (raw file):

	if !i.options.dryRun {
		fmt.Fprint(cmdOut, "Waiting for federation control plane to come up... ")

No log here?


federation/pkg/kubefed/init/init.go, line 360 at r2 (raw file):

		}
		err = waitSrvHealthy(config, i.commonOptions.Name, i.commonOptions.Kubeconfig)
		fmt.Fprint(cmdOut, "done\n")

log here?


Comments from Reviewable

@irfanurrehman
Copy link
Contributor

/lgtm

Except one thing (add it as part of follow up PR) I think everything is covered. (provided you would take the additional comments from @madhusudancs in a follow up PR).
About printing ". . ", I mentioned them to be timed prints (for example with a wait of 2 seconds each), rather then they being part of the original print.
The intention is, if the step is taking long, it will sort of give a notion of a console status bar moving .. :)
You can have a common function (or a goroutine with some channel to flag when to start and when to stop) and call it at all steps.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 26, 2017
@irfanurrehman
Copy link
Contributor

@perotinus, please run hack/update-bazel.sh to update the bazel build files and update the commit, I will lgtm it again.

@madhusudancs
Copy link
Contributor

/approve


Review status: all files reviewed at latest revision, 11 unresolved discussions, some commit checks failed.


Comments from Reviewable

@k8s-github-robot k8s-github-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Feb 26, 2017
@k8s-github-robot k8s-github-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Feb 27, 2017
@madhusudancs
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 27, 2017
@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 27, 2017
@perotinus
Copy link
Contributor Author

@madhusudancs I ran hack/update-bazel.sh and need approval again. Can you oblige?

Thanks!

@perotinus
Copy link
Contributor Author

@madhusudancs Can you poke the robot again? The failures look like they were related to the BUILD file issue.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 1, 2017
@perotinus
Copy link
Contributor Author

Review status: 0 of 3 files reviewed at latest revision, 11 unresolved discussions.


a discussion (no related file):

Previously, madhusudancs (Madhusudan.C.S) wrote…

I have left a few comments. None of those are critical or urgent. So I would recommend making all those changes in a separate follow up PR.

In the cases where you print the messages to STDOUT, you skip logging them. I think it is worth adding an INFO log for those creating ... steps too. I understand why you are doing this, but if you don't have these INFO logs, people who grep for "INFO" don't see the messages printed to STDOUT.

It looks good to me otherwise. However, I would like @irfanurrehman to make another pass and add the LGTM label when he is satisfied.

Thanks! I've created a follow-up PR that addresses your concerns: #42296


federation/pkg/kubefed/init/init.go, line 241 at r2 (raw file):

Previously, madhusudancs (Madhusudan.C.S) wrote…

Print the namespace in the message Creating namespace "federation-system" for federation system components...

Done.


federation/pkg/kubefed/init/init.go, line 246 at r2 (raw file):

Previously, madhusudancs (Madhusudan.C.S) wrote…

Use fmt.Fprintln()(https://golang.org/pkg/fmt/#Fprintln) instead. It's more readable. Also change all other occurrences.

Done.


federation/pkg/kubefed/init/init.go, line 249 at r2 (raw file):

Previously, madhusudancs (Madhusudan.C.S) wrote…

I like this simplification a lot. However, I think service deserves its own message. It is one of the slowest operations in the entire init command, probably as slow as or slower than waiting for the control plane pods to come up.

Done.


federation/pkg/kubefed/init/init.go, line 270 at r2 (raw file):

Previously, madhusudancs (Madhusudan.C.S) wrote…

What's happening here is creation of kubeconfig data to be populated in a secret. While your message is correct if one reads it very carefully, it might also cause some confusion. I would just write this as Creating credentials secret for federation controller manager

Done.


federation/pkg/kubefed/init/init.go, line 275 at r2 (raw file):

Previously, madhusudancs (Madhusudan.C.S) wrote…

Same as above.

Done.


federation/pkg/kubefed/init/init.go, line 298 at r2 (raw file):

Previously, madhusudancs (Madhusudan.C.S) wrote…

I would just say Creating federation control plane components...

Done.


federation/pkg/kubefed/init/init.go, line 332 at r2 (raw file):

Previously, madhusudancs (Madhusudan.C.S) wrote…

No log here?

Done.


federation/pkg/kubefed/init/init.go, line 349 at r2 (raw file):

Previously, madhusudancs (Madhusudan.C.S) wrote…

Log here?

Done.


federation/pkg/kubefed/init/init.go, line 353 at r2 (raw file):

Previously, madhusudancs (Madhusudan.C.S) wrote…

No log here?

Done.


federation/pkg/kubefed/init/init.go, line 360 at r2 (raw file):

Previously, madhusudancs (Madhusudan.C.S) wrote…

log here?

Done.


Comments from Reviewable

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 3, 2017
@k8s-github-robot k8s-github-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Mar 26, 2017
@perotinus
Copy link
Contributor Author

@madhusudancs Can you re-LGTM this?

@irfanurrehman
Copy link
Contributor

@k8s-bot gce etcd3 e2e test this

@irfanurrehman
Copy link
Contributor

Review status: 0 of 3 files reviewed at latest revision, 12 unresolved discussions.


federation/pkg/kubefed/init/init.go, line 280 at r3 (raw file):

	// 1.
	fmt.Fprint(cmdOut, "Creating a namespace for federation system components... ")

You wouldn't need to print the ". . ." as part of a particular message.
Also please check my comments on #42296


Comments from Reviewable

@perotinus
Copy link
Contributor Author

Review status: 0 of 3 files reviewed at latest revision, 12 unresolved discussions.


federation/pkg/kubefed/init/init.go, line 280 at r3 (raw file):

Previously, irfanurrehman wrote…

You wouldn't need to print the ". . ." as part of a particular message.
Also please check my comments on #42296

Thanks! Just replied to your comments on #42296. I'll update this PR based on the results of that discussion.


Comments from Reviewable

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 13, 2017
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 14, 2017
@perotinus
Copy link
Contributor Author

Review status: 0 of 3 files reviewed at latest revision, 12 unresolved discussions.


federation/pkg/kubefed/init/init.go, line 280 at r3 (raw file):

Previously, perotinus (Jonathan MacMillan) wrote…

Thanks! Just replied to your comments on #42296. I'll update this PR based on the results of that discussion.

OK, based on discussion in #42296, I've updated this PR.


Comments from Reviewable

@perotinus
Copy link
Contributor Author

@madhusudancs @irfanurrehman I think this should be good-to-go at this point. Can someone LGTM?

@irfanurrehman
Copy link
Contributor

A very minor nit, else this pr is good to go from me.
Also, apologies for being this picky, I guess user facing code tends to attract lot of different opinions from reviewers... !


Review status: 0 of 3 files reviewed at latest revision, 12 unresolved discussions, some commit checks failed.


federation/pkg/kubefed/init/init.go, line 280 at r3 (raw file):

Previously, perotinus (Jonathan MacMillan) wrote…

OK, based on discussion in #42296, I've updated this PR.

Thanks @perotinus. I see that you have removed all the dots from the messages.
If the operation finishes fast (before the timed print of . . happens done will be printed right next to the last message, without even space.. :-)
For example Creating a namespace for federation system componentsdone


Comments from Reviewable

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 17, 2017
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 17, 2017
@perotinus
Copy link
Contributor Author

No worries! Better to have it be right, especially when it'll be exposed to users.


Review status: 0 of 3 files reviewed at latest revision, 12 unresolved discussions.


federation/pkg/kubefed/init/init.go, line 280 at r3 (raw file):

Previously, irfanurrehman wrote…

Thanks @perotinus. I see that you have removed all the dots from the messages.
If the operation finishes fast (before the timed print of . . happens done will be printed right next to the last message, without even space.. :-)
For example Creating a namespace for federation system componentsdone

Ah, yes, that make sense. Fixed.


Comments from Reviewable

@irfanurrehman
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 18, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: irfanurrehman, madhusudancs, perotinus

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 7688594 into kubernetes:master Apr 18, 2017
k8s-github-robot pushed a commit that referenced this pull request May 10, 2017
Automatic merge from submit-queue

[Federation] Improve the logging and user feedback in 'kubefed init'

This is a follow-up to #41849, which added some status information. This PR is based off of that one, and includes its changes as well.

See #41725.

```release-note
None
```
@perotinus perotinus deleted the kubefedlogs branch May 10, 2017 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants