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 faster profile list command with -l or --light option. #10380

Merged
merged 1 commit into from Feb 11, 2021

Conversation

daehyeok
Copy link
Contributor

@daehyeok daehyeok commented Feb 5, 2021

If option is true, Doens't try to get profiles from container and read
current status.

fix #10147

❯ minikube profile list -h
Lists all valid minikube profiles and detects all possible invalid profiles.

Options:
  -l, --light=false: If true, only display vaild profiles and do not check status.
  -o, --output='table': The output format. One of 'json', 'table'

Usage:
  minikube profile list [flags] [options]

Use "minikube options" for a list of global command-line options (applies to all commands).
❯ minikube profile list
|--------------------------------|-----------|---------|---------------|------|---------|---------|-------|
|            Profile             | VM Driver | Runtime |      IP       | Port | Version | Status  | Nodes |
|--------------------------------|-----------|---------|---------------|------|---------|---------|-------|
| minikube                       | docker    | docker  | 192.168.49.2  | 8443 | v1.20.0 | Stopped |     1 |
| multinode-20210127144027-24120 | docker    | docker  | 192.168.49.57 | 8443 | v1.20.2 | Stopped |     2 |
|--------------------------------|-----------|---------|---------------|------|---------|---------|-------|
❯ minikube profile list -l
|--------------------------------|-----------|---------|---------------|------|---------|---------|-------|
|            Profile             | VM Driver | Runtime |      IP       | Port | Version | Status  | Nodes |
|--------------------------------|-----------|---------|---------------|------|---------|---------|-------|
| minikube                       | docker    | docker  | 192.168.49.2  | 8443 | v1.20.0 | Skipped |     1 |
| multinode-20210127144027-24120 | docker    | docker  | 192.168.49.57 | 8443 | v1.20.2 | Skipped |     2 |
|--------------------------------|-----------|---------|---------------|------|---------|---------|-------|
❯ minikube profile list --light
|--------------------------------|-----------|---------|---------------|------|---------|---------|-------|
|            Profile             | VM Driver | Runtime |      IP       | Port | Version | Status  | Nodes |
|--------------------------------|-----------|---------|---------------|------|---------|---------|-------|
| minikube                       | docker    | docker  | 192.168.49.2  | 8443 | v1.20.0 | Skipped |     1 |
| multinode-20210127144027-24120 | docker    | docker  | 192.168.49.57 | 8443 | v1.20.2 | Skipped |     2 |
|--------------------------------|-----------|---------|---------------|------|---------|---------|-------|

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

Hi @daehyeok. 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 /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.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Feb 5, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: daehyeok
To complete the pull request process, please assign sharifelgamal after the PR has been reviewed.
You can assign the PR to them by writing /assign @sharifelgamal in a comment when ready.

The full list of commands accepted by this bot can be found 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 size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 5, 2021
@minikube-bot
Copy link
Collaborator

Can one of the admins verify this patch?

test/integration/functional_test.go Outdated Show resolved Hide resolved
test/integration/functional_test.go Outdated Show resolved Hide resolved
@daehyeok daehyeok force-pushed the profile_list_light branch 3 times, most recently from 8223ade to 23ca443 Compare February 6, 2021 04:00
@daehyeok daehyeok requested a review from medyagh February 6, 2021 04:20
@medyagh
Copy link
Member

medyagh commented Feb 7, 2021

@daehyeok thank you for this PR I verified manually it is much faster !


medya@~/workspace/minikube (profile_list_light) $ time ./out/minikube profile list 
|----------|-----------|------------|--------------|------|---------|---------|-------|
| Profile  | VM Driver |  Runtime   |      IP      | Port | Version | Status  | Nodes |
|----------|-----------|------------|--------------|------|---------|---------|-------|
| minikube | docker    | containerd | 192.168.49.2 | 8443 | v1.20.2 | Running |     1 |
| p1       | docker    | docker     | 192.168.59.2 | 8443 | v1.20.2 | Running |     1 |
|----------|-----------|------------|--------------|------|---------|---------|-------|

real    0m1.359s
user    0m0.784s
sys     0m0.391s
medya@~/workspace/minikube (profile_list_light) $ time ./out/minikube profile list --light
|----------|-----------|------------|--------------|------|---------|---------|-------|
| Profile  | VM Driver |  Runtime   |      IP      | Port | Version | Status  | Nodes |
|----------|-----------|------------|--------------|------|---------|---------|-------|
| minikube | docker    | containerd | 192.168.49.2 | 8443 | v1.20.2 | Skipped |     1 |
| p1       | docker    | docker     | 192.168.59.2 | 8443 | v1.20.2 | Skipped |     1 |
|----------|-----------|------------|--------------|------|---------|---------|-------|

real    0m0.118s
user    0m0.057s

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.

@daehyeok thank you for this PR , please see comments

cmd/minikube/cmd/config/profile_list.go Show resolved Hide resolved
site/content/en/docs/commands/profile.md Outdated Show resolved Hide resolved
test/integration/functional_test.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 Feb 9, 2021
@daehyeok daehyeok requested a review from medyagh February 9, 2021 07:21
test/integration/functional_test.go Show resolved Hide resolved
test/integration/functional_test.go Show resolved Hide resolved
test/integration/functional_test.go Show resolved Hide resolved
test/integration/functional_test.go Outdated Show resolved Hide resolved
@daehyeok
Copy link
Contributor Author

daehyeok commented Feb 9, 2021

Resolved comment

=== RUN   TestFunctional/parallel/ProfileCmd/profile_list
    functional_test.go:785: (dbg) Run:  out/minikube profile list
    functional_test.go:785: (dbg) Done: out/minikube profile list: (9.835436564s)
    functional_test.go:790: Took "9.835598408s" to run "out/minikube profile list"
    functional_test.go:799: (dbg) Run:  out/minikube profile list -l
    functional_test.go:804: Took "345.226888ms" to run "out/minikube profile list -l"

@daehyeok daehyeok requested a review from medyagh February 9, 2021 23:26
@medyagh
Copy link
Member

medyagh commented Feb 10, 2021

since -l is super fast
we can make the integraiton test to check for it be less than 3 seconds as well
so how about we add an integration test that if proflile list -l took more than 3 seconds it should fail
that profile list -l should not take long

If option is true, Doens't try to get profiles from container and read
current status.
@medyagh
Copy link
Member

medyagh commented Feb 10, 2021

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 10, 2021
@minikube-pr-bot
Copy link

kvm2 Driver
Times for minikube: 67.6s 69.1s 67.2s
Average time for minikube: 68.0s

Times for Minikube (PR 10380): 69.5s 67.2s 69.1s
Average time for Minikube (PR 10380): 68.6s

Averages Time Per Log

+--------------------------------+----------+---------------------+
|              LOG               | MINIKUBE | MINIKUBE (PR 10380) |
+--------------------------------+----------+---------------------+
| * minikube v1.17.1 on Debian   | 0.0s     | 0.0s                |
| 9.11 (kvm/amd64)               |          |                     |
| * Using the kvm2 driver based  | 0.0s     | 0.0s                |
| on user configuration          |          |                     |
| * Starting control plane node  | 0.0s     | 0.0s                |
| minikube in cluster minikube   |          |                     |
| * Creating kvm2 VM (CPUs=2,    | 40.9s    | 41.8s               |
| Memory=3700MB, Disk=20000MB)   |          |                     |
| ...                            |          |                     |
| * Preparing Kubernetes v1.20.2 | 2.3s     | 9.5s                |
| on Docker 20.10.2 ...          |          |                     |
|   - Generating certificates    | 4.5s     | 2.3s                |
| and keys ...                   |          |                     |
|   - Booting up control plane   | 16.3s    | 11.3s               |
| ...                            |          |                     |
|   - Configuring RBAC rules ... | 1.5s     | 1.2s                |
| * Verifying Kubernetes         | 1.7s     | 1.6s                |
| components...                  |          |                     |
| * Enabled addons:              | 0.6s     |                     |
| default-storageclass,          |          |                     |
| storage-provisioner            |          |                     |
| * Done! kubectl is now         | 0.0s     | 0.0s                |
| configured to use "minikube"   |          |                     |
| cluster and "default"          |          |                     |
| namespace by default           |          |                     |
+--------------------------------+----------+---------------------+

docker Driver
Times for minikube: 26.4s 25.8s 24.9s
Average time for minikube: 25.7s

Times for Minikube (PR 10380): 25.2s 27.0s 25.4s
Average time for Minikube (PR 10380): 25.9s

Averages Time Per Log

+--------------------------------+----------+---------------------+
|              LOG               | MINIKUBE | MINIKUBE (PR 10380) |
+--------------------------------+----------+---------------------+
| * minikube v1.17.1 on Debian   | 0.2s     | 0.2s                |
| 9.11 (kvm/amd64)               |          |                     |
| * 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    | 9.9s     | 9.9s                |
| (CPUs=2, Memory=3700MB) ...    |          |                     |
| * Preparing Kubernetes v1.20.2 | 14.4s    | 14.6s               |
| on Docker 20.10.2 ...          |          |                     |
| * Verifying Kubernetes         | 0.9s     | 0.9s                |
| 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           |          |                     |
+--------------------------------+----------+---------------------+

@medyagh medyagh merged commit a3609d3 into kubernetes:master Feb 11, 2021
@medyagh medyagh changed the title Add -l/--light option for profile list command. Add faster profile list command with -l or --light option. Feb 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

add --light option to invoke profile list without checking status (for cheaper and faster)
5 participants