KEMBAR78
Refactor spinner library & hide sub steps after spinning by medyagh · Pull Request #21215 · kubernetes/minikube · GitHub
Skip to content

Conversation

@medyagh
Copy link
Member

@medyagh medyagh commented Aug 1, 2025

This PR fixes the broken spinner

Before

Some Spining steps were over-written and didnt show
spinner-before

After

mini-spinner

New Feature: Hide Sub Steps (details after showing them once during spinning)

and also After Showing the Sub Steps for
🐳 Preparing Kubernetes v1.33.2 on Docker 28.3.2 ...
it will hide the following after Showing them Once :

    ▪ Generating certificates and keys ...(hide after showing)
    ▪ Booting up control plane ...(hide after showing)
    ▪ Configuring RBAC rules ...(hide after showing)

Enable Spinning on a second start

Before this PR minikube second start would not spin on "updating the running VM"

refactor code

did some refactor such as rename boolean "spinner" to say "shoudSpin" since we already had a spinner object ! the could should be more readable now

closes http://github.com/kubernetes/minikube/issues/21148

Ideas for Follow up Todos

now that we have a Hiding Sub Step Mechanisim, we can break down the "🔥 Creating krunkit VM " Step to sub steps and Show and Hide while it is creaiting

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Aug 1, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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 approved Indicates a PR has been approved by an approver from all required OWNERS files. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 1, 2025
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 2, 2025
@medyagh medyagh changed the title wip: attempt to fix spinnier Refactor spinner and hide Sub Steps after spining Aug 2, 2025
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 2, 2025
@medyagh
Copy link
Member Author

medyagh commented Aug 2, 2025

/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 Aug 2, 2025
@minikube-pr-bot

This comment has been minimized.

@minikube-pr-bot

This comment has been minimized.

Copy link
Contributor

@nirs nirs left a comment

Choose a reason for hiding this comment

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

Hiding sub steps is confusing, and using progress bar for indeterminte progress is wrong. When we cannot tell the progress value we should use a spinner and not animated progress bar going forward and backward. I think Windows got this wrong in some versions bug we should not copy bad UI.

Can we separate the spinner fix without changing the behavior? Just restore the behavior of minikube 1.36. Do we have any issues about the previous behavior?

@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 Aug 4, 2025
@medyagh medyagh changed the title Refactor spinner and hide Sub Steps after spining Refactor spinner library & hide sub steps after spinning Aug 4, 2025
@medyagh
Copy link
Member Author

medyagh commented Aug 4, 2025

Hiding sub steps is confusing, and using progress bar for indeterminte progress is wrong. When we cannot tell the progress value we should use a spinner and not animated progress bar going forward and backward. I think Windows got this wrong in some versions bug we should not copy bad UI.

Can we separate the spinner fix without changing the behavior? Just restore the behavior of minikube 1.36. Do we have any issues about the previous behavior?

changed progress bar to simpler spining, the sub steps in original design were always meant to be hidden, we had never made it work because were not using the lib

@minikube-pr-bot
Copy link

kvm2 driver with docker runtime

┌────────────────┬──────────┬────────────────────────┐
│    COMMAND     │ MINIKUBE │ MINIKUBE  ( PR 21215 ) │
├────────────────┼──────────┼────────────────────────┤
│ minikube start │ 50.8s    │ 51.6s                  │
│ enable ingress │ 15.5s    │ 15.0s                  │
└────────────────┴──────────┴────────────────────────┘

Times for minikube ingress: 16.0s 15.0s 16.0s 15.0s 15.5s
Times for minikube (PR 21215) ingress: 15.0s 14.5s 15.5s 15.0s 15.0s

Times for minikube start: 50.0s 52.5s 50.9s 47.6s 53.1s
Times for minikube (PR 21215) start: 52.4s 51.0s 51.1s 52.1s 51.1s

docker driver with docker runtime

┌────────────────┬──────────┬────────────────────────┐
│    COMMAND     │ MINIKUBE │ MINIKUBE  ( PR 21215 ) │
├────────────────┼──────────┼────────────────────────┤
│ minikube start │ 24.2s    │ 24.5s                  │
│ enable ingress │ 12.9s    │ 13.2s                  │
└────────────────┴──────────┴────────────────────────┘

Times for minikube start: 23.3s 23.9s 25.8s 26.5s 21.6s
Times for minikube (PR 21215) start: 26.4s 25.9s 23.0s 23.9s 23.3s

Times for minikube ingress: 12.3s 12.8s 12.8s 12.8s 13.8s
Times for minikube (PR 21215) ingress: 13.8s 12.8s 12.9s 13.3s 13.3s

docker driver with containerd runtime

┌────────────────┬──────────┬────────────────────────┐
│    COMMAND     │ MINIKUBE │ MINIKUBE  ( PR 21215 ) │
├────────────────┼──────────┼────────────────────────┤
│ minikube start │ 22.7s    │ 22.9s                  │
│ enable ingress │ 26.8s    │ 22.8s                  │
└────────────────┴──────────┴────────────────────────┘

Times for minikube ingress: 38.8s 22.8s 22.8s 22.8s 26.8s
Times for minikube (PR 21215) ingress: 22.8s 22.8s 22.8s 22.8s 22.8s

Times for minikube (PR 21215) start: 23.5s 22.3s 20.9s 22.5s 25.2s
Times for minikube start: 22.1s 23.3s 21.6s 22.7s 23.9s

@medyagh medyagh requested a review from Copilot August 5, 2025 18:08
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the spinner functionality to fix display issues and introduces the ability to hide sub-steps after they've been shown during spinning operations. It also enables proper spinning on subsequent minikube starts.

  • Refactored spinner-related naming from "Spinner" to "ShouldSpin" for clarity
  • Added a new "HideAfterSpin" feature that hides sub-steps after displaying them once
  • Enabled spinning for restarting and running operations

Reviewed Changes

Copilot reviewed 3 out of 8 changed files in this pull request and generated 2 comments.

File Description
test/integration/error_spam_test.go Removes test validation for sub-steps that will now be hidden after spinning
pkg/minikube/style/style.go Refactors spinner options, adds HideAfterSpin feature, and enables spinning for more operations
pkg/minikube/registry/drvs/krunkit/krunkit.go Minor capitalization fix in error message

// Spinner is a character to place at ending of message
Spinner bool
// ShouldSpin is a character to place at ending of message
ShouldSpin bool
Copy link

Copilot AI Aug 5, 2025

Choose a reason for hiding this comment

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

[nitpick] Inconsistent field alignment: ShouldSpin has extra spacing while HideAfterSpin doesn't. Consider aligning the fields consistently for better readability.

Suggested change
ShouldSpin bool
ShouldSpin bool

Copilot uses AI. Check for mistakes.
// SpinnerCharacter is which of the spinner.CharSets to use
const SpinnerCharacter = 9

// SpinnerSubStepCharacter is Character to use for sub-steps in a spinner (it looks like a progress bar)
Copy link

Copilot AI Aug 5, 2025

Choose a reason for hiding this comment

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

The constant SpinnerSubStepCharacter = 40 lacks explanation of what character index 40 represents or why it was chosen. Consider adding a comment explaining what this character looks like or referencing the character set documentation.

Suggested change
// SpinnerSubStepCharacter is Character to use for sub-steps in a spinner (it looks like a progress bar)
// SpinnerSubStepCharacter is the index of the character to use for sub-steps in a spinner (it looks like a progress bar).
// Index 40 in spinner.CharSets corresponds to the '█' (full block) character, which visually represents progress.
// See: https://github.com/briandowns/spinner/blob/master/spinner.go#L50 for the character set details.

Copilot uses AI. Check for mistakes.
@medyagh medyagh merged commit 95d4cfe into kubernetes:master Aug 5, 2025
32 of 40 checks passed
pavansaikrishna78 pushed a commit to pavansaikrishna78/minikube that referenced this pull request Aug 11, 2025
…21215)

* remove omitnew line

* add new option to hide after spin

* refactor to use new return hideAfterSpin

* add new line by default only when not spinining and delegate spinner newline to spinner code

* add new func for ouptputing with spinner and pass fdwriter directly to the spininer func

* fix unit test

* fix lint for krunkit

* add comment and context

* use different spinning progress bar for sub steps

* make func private

* making more spinning icons

* integration test dont expect sub steps to be visible

* fix unit test and comment why

* change sub step spining icon not to be a progressbar

* pass the filewriter to the spinner library for the spinning steps
pavansaikrishna78 pushed a commit to pavansaikrishna78/minikube that referenced this pull request Aug 18, 2025
…21215)

* remove omitnew line

* add new option to hide after spin

* refactor to use new return hideAfterSpin

* add new line by default only when not spinining and delegate spinner newline to spinner code

* add new func for ouptputing with spinner and pass fdwriter directly to the spininer func

* fix unit test

* fix lint for krunkit

* add comment and context

* use different spinning progress bar for sub steps

* make func private

* making more spinning icons

* integration test dont expect sub steps to be visible

* fix unit test and comment why

* change sub step spining icon not to be a progressbar

* pass the filewriter to the spinner library for the spinning steps
pavansaikrishna78 pushed a commit to pavansaikrishna78/minikube that referenced this pull request Sep 9, 2025
…21215)

* remove omitnew line

* add new option to hide after spin

* refactor to use new return hideAfterSpin

* add new line by default only when not spinining and delegate spinner newline to spinner code

* add new func for ouptputing with spinner and pass fdwriter directly to the spininer func

* fix unit test

* fix lint for krunkit

* add comment and context

* use different spinning progress bar for sub steps

* make func private

* making more spinning icons

* integration test dont expect sub steps to be visible

* fix unit test and comment why

* change sub step spining icon not to be a progressbar

* pass the filewriter to the spinner library for the spinning steps
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/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants