Skip to content

Update MINIKUBE_HOME usage#18648

Merged
spowelljr merged 1 commit into
kubernetes:masterfrom
tony-sol:master
Jul 18, 2024
Merged

Update MINIKUBE_HOME usage#18648
spowelljr merged 1 commit into
kubernetes:masterfrom
tony-sol:master

Conversation

@tony-sol

Copy link
Copy Markdown
Contributor

Resolves #15835

Make MINIKUBE_HOME env variable usage more convenient with backward compatibility.

Current logic of MINIKUBE_HOME env usage isn't really obvious:

  • If env var is not set, it uses ${HOME}/.minikube as default.
  • If env var is set, it checks its basename (for some reason??):
    • If basename equals .minikube - use env var
    • Else it appends .minikube to env var value (for some reason??)

It's very implicit logic and goes against the conventional use of *_HOME env vars.

With this changes, the logic changes a bit:

  • If env var is not set, it uses ${HOME}/.minikube as default (as it's now)
  • If env var is set, it checks its basename (as it's now)
    • If basename equals .minikube - use env var (as it's now)
    • Else it checks existence of .minikube inside path, provided via env var (for backward compatibility)
      • If ${MINIKUBE_HOME}/.minikube exists - use this legacy path (for backward compatibility)
      • Else - use MINIKUBE_HOME as is (new)

So, here is example cases:

  1. Env is unset:
    $ export MINIKUBE_HOME=""
    $ # run minikube
    $ ls -hAF ~ | grep minikube
    .minikube/
    $ ls -hAF ~/.minikube
    addons/   cache/    certs/    config/   files/    logs/     machines/
    
  2. Env is set AND its basename is .minikube:
    $ export MINIKUBE_HOME="${XDG_DATA_HOME}/.minikube"
    $ # run minikube
    $ ls -hAF $XDG_DATA_HOME | grep minikube
    .minikube/
    $ ls -hAF $XDG_DATA_HOME/.minikube
    addons/   cache/    certs/    config/   files/    logs/     machines/
    
  3. Env is set AND its basename is not .minikube AND there is NO .minikube inside:
    $ export MINIKUBE_HOME="${XDG_DATA_HOME}/minikube"
    $ ls -hAF $MINIKUBE_HOME
    $ # MINIKUBE_HOME is empty
    $ # run minikube
    $ ls -hAF $MINIKUBE_HOME
    addons/   cache/    certs/    config/   files/    logs/     machines/
    
  4. Env is set AND its basename is not .minikube AND there is .minikube inside provided path:
    $ export MINIKUBE_HOME="${XDG_DATA_HOME}/minikube"
    $ ls -hAF $MINIKUBE_HOME
    .minikube/
    $ # MINIKUBE_HOME has state from previous version
    $ # run minikube
    $ ls -hAF $MINIKUBE_HOME
    .minikube/
    $ ls -hAF $MINIKUBE_HOME/.minikube
    addons/   cache/    certs/    config/   files/    logs/     machines/
    

@linux-foundation-easycla

linux-foundation-easycla Bot commented Apr 15, 2024

Copy link
Copy Markdown

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: tony-sol / name: Tony Soloveyv (6f03675)

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Apr 15, 2024
@minikube-bot

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

Welcome @tony-sol!

It looks like this is your first PR to kubernetes/minikube 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/minikube has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@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 Apr 15, 2024
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

Hi @tony-sol. 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.

Details

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 size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Apr 15, 2024
@spowelljr

Copy link
Copy Markdown
Member

/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 Jul 4, 2024
@minikube-pr-bot

Copy link
Copy Markdown

kvm2 driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 18648) |
+----------------+----------+---------------------+
| minikube start | 47.9s    | 51.0s               |
| enable ingress | 25.7s    | 25.2s               |
+----------------+----------+---------------------+
Details

Times for minikube start: 48.1s 46.9s 48.9s 48.3s 47.0s
Times for minikube (PR 18648) start: 47.6s 50.4s 51.5s 54.1s 51.3s

Times for minikube ingress: 24.5s 27.0s 28.0s 25.0s 24.0s
Times for minikube (PR 18648) ingress: 27.5s 23.9s 25.0s 24.0s 25.5s

docker driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 18648) |
+----------------+----------+---------------------+
| minikube start | 23.1s    | 23.2s               |
| enable ingress | 21.9s    | 22.2s               |
+----------------+----------+---------------------+
Details

Times for minikube ingress: 21.3s 21.8s 21.8s 22.8s 21.8s
Times for minikube (PR 18648) ingress: 21.8s 21.8s 22.8s 22.8s 21.8s

Times for minikube start: 23.3s 24.0s 21.0s 23.6s 23.7s
Times for minikube (PR 18648) start: 23.7s 24.5s 24.2s 21.8s 21.8s

docker driver with containerd runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 18648) |
+----------------+----------+---------------------+
| minikube start | 21.0s    | 20.8s               |
| enable ingress | 29.6s    | 31.9s               |
+----------------+----------+---------------------+
Details

Times for minikube start: 20.4s 18.8s 22.2s 20.3s 23.0s
Times for minikube (PR 18648) start: 20.0s 19.9s 23.3s 20.6s 20.2s

Times for minikube ingress: 32.8s 32.3s 18.8s 32.3s 31.8s
Times for minikube (PR 18648) ingress: 31.8s 32.3s 32.3s 32.3s 30.8s

@minikube-pr-bot

Copy link
Copy Markdown

These are the flake rates of all failed tests.

Environment Failed Tests Flake Rate (%)
Docker_Linux_crio TestMultiControlPlane/serial/RestartCluster (gopogh) 2.08 (chart)

To see the flake rates of all tests by environment, click here.

@spowelljr spowelljr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me, thanks for the PR!

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: spowelljr, tony-sol

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

The pull request process is described here

Details 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 Jul 18, 2024
@spowelljr spowelljr merged commit 6bd4b79 into kubernetes:master Jul 18, 2024
toshipp added a commit to topolvm/topolvm that referenced this pull request Oct 21, 2024
Because minikube changed MINIKUBE_HOME usage[1], chown now fails. To
address this, use the minikube function to set permissions.

[1]: kubernetes/minikube#18648

Signed-off-by: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
toshipp added a commit to topolvm/topolvm that referenced this pull request Oct 22, 2024
Because minikube changed MINIKUBE_HOME usage[1], chown now fails. To
address this, use the minikube function to set permissions.

[1]: kubernetes/minikube#18648

Signed-off-by: Toshikuni Fukaya <toshikuni-fukaya@cybozu.co.jp>
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/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Current MINIKUBE_HOME environment variable setting logic is confusing

5 participants