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

Add spinner at preparing Kubernetes... #9855

Merged
merged 33 commits into from Dec 11, 2020
Merged

Conversation

alonyb
Copy link

@alonyb alonyb commented Dec 4, 2020

This PR is to #9091

Spinner was added in step:

🐳 Preparing Kubernetes v1.19.4 on Docker 19.03.13 ...

This spinner works with this repo(module) forked in alonyb/spinner

PR of original repo is here

With this user feels more comfortable UI

In Windows was testing too and it works without problem

Next step:
Add spinner in another processes as (Starting Control plane ... and pulling docker image... and others.)

Screen Recording 2020-12-02 at 00 35 56 (online-video-cutter com)

minikube start --output=json
output:

{"data":{"currentstep":"0","message":"minikube v1.15.1 on Darwin 10.15.7","name":"Initial Minikube Setup","totalsteps":"12"},"datacontenttype":"application/json","id":"7e20202a-babe-48e1-910d-6b525e8e7ef2","source":"https://minikube.sigs.k8s.io/","specversion":"1.0","type":"io.k8s.sigs.minikube.step"} {"data":{"currentstep":"1","message":"Automatically selected the docker driver","name":"Selecting Driver","totalsteps":"12"},"datacontenttype":"application/json","id":"ba60dba1-7394-4a9b-88f4-9929f3f07580","source":"https://minikube.sigs.k8s.io/","specversion":"1.0","type":"io.k8s.sigs.minikube.step"} {"data":{"currentstep":"3","message":"Starting control plane node minikube in cluster minikube","name":"Starting Node","totalsteps":"12"},"datacontenttype":"application/json","id":"bfb2efda-bf26-4e47-b745-1b0a3366e13e","source":"https://minikube.sigs.k8s.io/","specversion":"1.0","type":"io.k8s.sigs.minikube.step"} {"data":{"currentstep":"6","message":"Creating docker container (CPUs=2, Memory=1990MB) ...","name":"Creating Container","totalsteps":"12"},"datacontenttype":"application/json","id":"b3017c52-e565-49d5-850a-f038bef8d3f5","source":"https://minikube.sigs.k8s.io/","specversion":"1.0","type":"io.k8s.sigs.minikube.step"} {"data":{"currentstep":"8","message":"Preparing Kubernetes v1.19.4 on Docker 19.03.13 ...","name":"Preparing Kubernetes","totalsteps":"12"},"datacontenttype":"application/json","id":"108d626e-6a0a-4ce3-8521-f52d9cacd6af","source":"https://minikube.sigs.k8s.io/","specversion":"1.0","type":"io.k8s.sigs.minikube.step"} {"data":{"currentstep":"10","message":"Verifying Kubernetes components...","name":"Verifying Kubernetes","totalsteps":"12"},"datacontenttype":"application/json","id":"63cded8a-fe6b-44d8-87b2-ba9aa1d82d4d","source":"https://minikube.sigs.k8s.io/","specversion":"1.0","type":"io.k8s.sigs.minikube.step"} {"data":{"currentstep":"11","message":"Enabled addons: default-storageclass, storage-provisioner","name":"Enabling Addons","totalsteps":"12"},"datacontenttype":"application/json","id":"65a9f4d7-9866-417a-a7c4-d5e9cdecfdeb","source":"https://minikube.sigs.k8s.io/","specversion":"1.0","type":"io.k8s.sigs.minikube.step"} {"data":{"message":"/usr/local/bin/kubectl is version 1.16.6-beta.0, which may have incompatibilites with Kubernetes 1.19.4."},"datacontenttype":"application/json","id":"11e64450-c0d2-4884-b210-12dcd2bc3e50","source":"https://minikube.sigs.k8s.io/","specversion":"1.0","type":"io.k8s.sigs.minikube.warning"} {"data":{"message":"Want kubectl v1.19.4? Try 'minikube kubectl -- get pods -A'"},"datacontenttype":"application/json","id":"df0d59f2-983e-4392-8529-16343e895300","source":"https://minikube.sigs.k8s.io/","specversion":"1.0","type":"io.k8s.sigs.minikube.info"} {"data":{"currentstep":"12","message":"Done! kubectl is now configured to use \"minikube\" cluster and \"default\" namespace by default","name":"Done","totalsteps":"12"},"datacontenttype":"application/json","id":"4cc4a768-206b-48fd-8ccb-d355059508f3","source":"https://minikube.sigs.k8s.io/","specversion":"1.0","type":"io.k8s.sigs.minikube.step"}

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 4, 2020
pkg/minikube/out/out.go Outdated Show resolved Hide resolved
pkg/minikube/out/out.go Outdated Show resolved Hide resolved
pkg/minikube/out/out.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 7, 2020
cmd/minikube/cmd/config/addons_list.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 8, 2020
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 8, 2020
@alonyb alonyb requested a review from medyagh December 9, 2020 14:39
Copy link
Member

@medyagh medyagh left a comment

Choose a reason for hiding this comment

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

I dont know think we need to pass true or false to out.String
I think we only need it in out.Step (is there a reason we pass it to out.String ?

also consider using a Constant in the out package for a better code readability

for example

out.Step(style.Tip, false, "kubectl not found. If you need it, try: 'minikube kubectl -- get pods -A'")

can be chaged to

out.Step(style.Tip, out.Spinning, "kubectl not found. If you need it, try: 'minikube kubectl -- get pods -A'")

and for false it would

out.Step(style.Tip, out.NoSpinner, "kubectl not found. If you need it, try: 'minikube kubectl -- get pods -A'")

@@ -142,7 +142,7 @@ func runDelete(cmd *cobra.Command, args []string) {
if purge && len(profilesToDelete) > 1 && !deleteAll {
out.ErrT(style.Notice, "Multiple minikube profiles were found - ")
for _, p := range profilesToDelete {
out.Step(style.Notice, " - {{.profile}}", out.V{"profile": p.Name})
out.Step(style.Notice, out.NoSpinner, " - {{.profile}}", out.V{"profile": p.Name})
Copy link
Member

Choose a reason for hiding this comment

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

lets move out.NoSpinner to style.NoSpinner

Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than adding an extra argument: the styles are designed to carry all information necessary for display. I would suggest adding a Spin bool to style.Options:

type Options struct {

Copy link
Author

Choose a reason for hiding this comment

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

Great idea! thanks @tstromberg from 42 files we reduce it to 6

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 10, 2020
Copy link
Member

@medyagh medyagh left a comment

Choose a reason for hiding this comment

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

thank you for this PR ! looks good (literally Looks good)

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alonyb, medyagh

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 11, 2020
@medyagh
Copy link
Member

medyagh commented Dec 11, 2020

/ok-to-test

@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Dec 11, 2020
@minikube-pr-bot
Copy link

kvm2 Driver
error collecting results for kvm2 driver: timing run 1 with Minikube (PR 9855): timing cmd: [/home/performance-monitor/.minikube/minikube-binaries/9855/minikube start --driver=kvm2]: waiting for minikube: exit status 85
docker Driver
Times for minikube: 65.7s 27.3s 27.1s
Average time for minikube: 40.0s

Times for Minikube (PR 9855): 29.7s 29.2s 28.2s
Average time for Minikube (PR 9855): 29.0s

Averages Time Per Log

+--------------------------------+----------+--------------------+
|              LOG               | MINIKUBE | MINIKUBE (PR 9855) |
+--------------------------------+----------+--------------------+
| * minikube v1.15.1 on Debian   | 0.2s     | 0.2s               |
|                           9.11 |          |                    |
| * Using the docker driver      | 0.1s     | 0.1s               |
| based on user configuration    |          |                    |
| * Starting control plane node  | 0.1s     | 0.1s               |
| minikube in cluster minikube   |          |                    |
| * Creating docker container    | 10.5s    | 27.3s              |
| (CPUs=2, Memory=3700MB) ...    |          |                    |
| * Preparing Kubernetes v1.20.0 | 21.6s    | 0.0s               |
| on Docker 19.03.14 ...         |          |                    |
| * Verifying Kubernetes         | 7.5s     | 1.2s               |
| components...                  |          |                    |
| * Enabled addons:              | 0.1s     | 0.2s               |
| default-storageclass,          |          |                    |
| storage-provisioner            |          |                    |
| * Done! kubectl is now         | 0.0s     | 0.0s               |
| configured to use "minikube"   |          |                    |
| cluster and "default"          |          |                    |
| namespace by default           |          |                    |
+--------------------------------+----------+--------------------+

@minikube-pr-bot
Copy link

kvm2 Driver
error collecting results for kvm2 driver: timing run 0 with minikube: timing cmd: [./minikube start --driver=kvm2]: waiting for minikube: exit status 105
docker Driver
Times for minikube: 29.5s 27.9s 28.7s
Average time for minikube: 28.7s

Times for Minikube (PR 9855): 29.7s 28.8s 29.4s
Average time for Minikube (PR 9855): 29.3s

Averages Time Per Log

+--------------------------------+----------+--------------------+
|              LOG               | MINIKUBE | MINIKUBE (PR 9855) |
+--------------------------------+----------+--------------------+
| * minikube v1.15.1 on Debian   | 0.2s     | 0.2s               |
|                           9.11 |          |                    |
| * Using the docker driver      | 0.1s     | 0.1s               |
| based on user configuration    |          |                    |
| * Starting control plane node  | 0.1s     | 0.1s               |
| minikube in cluster minikube   |          |                    |
| * Creating docker container    | 8.9s     | 27.6s              |
| (CPUs=2, Memory=3700MB) ...    |          |                    |
| * Preparing Kubernetes v1.20.0 | 18.1s    | 0.0s               |
| on Docker 19.03.14 ...         |          |                    |
| * Verifying Kubernetes         | 1.3s     | 1.3s               |
| components...                  |          |                    |
| * Enabled addons:              | 0.1s     | 0.1s               |
| storage-provisioner,           |          |                    |
| default-storageclass           |          |                    |
| * Done! kubectl is now         | 0.0s     | 0.0s               |
| configured to use "minikube"   |          |                    |
| cluster and "default"          |          |                    |
| namespace by default           |          |                    |
+--------------------------------+----------+--------------------+

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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

None yet

5 participants