Skip to content

Conversation

@divysinghvi
Copy link
Contributor

This PR improves the Binary function in binary.go to better handle Kubernetes binary downloads. It adds logic to skip downloads when the --no-kubernetes flag is set, ensures not downloading unnecessary downloads with version v0.0.0
Before
Screenshot 2025-07-25 at 1 05 43 PM
After
Screenshot 2025-07-25 at 1 08 30 PM
This pr Fixes the issue #21107

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 25, 2025
@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 Jul 25, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @divysinghvi. 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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jul 25, 2025
@minikube-bot
Copy link
Collaborator

Can one of the admins verify this patch?

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 @divysinghvi please consider adding an integraiton test sub-test to

https://vscode.dev/github/kubernetes/minikube/blob/separate-hack/test/integration/no_kubernetes_test.go#L32

before {"StartNoK8sWithVersion", validateStartNoK8sWithVersion}, you can do --download-only and check using -minikube ssh -- ls path/to/binary/- that the file doesnt exist

@divysinghvi
Copy link
Contributor Author

@medyagh Thanks for the suggestion! Just to clarify, for the integration test you mentioned, which exact Kubernetes binary path should I check for in the VM after running minikube with --no-kubernetes --download-only?
but i am confused what exact binary path should i check for

@medyagh
Copy link
Member

medyagh commented Jul 28, 2025

Lets also try not setting k8s version to 0.0.0 and see what breaks and why did we have to that

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.

lets add a sub test that that checks this folder should not exist
~/.minikube/cache/linux/amd64/v0.0.0/

@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 10, 2025
@medyagh
Copy link
Member

medyagh commented Aug 10, 2025

ok-to-test

defer PostMortemLogs(t, profile)

// Start minikube with --no-kubernetes flag
args := append([]string{"start", "-p", profile, "--no-kubernetes", "--memory=2048"}, StartArgs()...)
Copy link
Member

Choose a reason for hiding this comment

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

no need to start another minikube, use the Existing started minikube and simply add a sub test
like this
{"StartNoK8sWithVersion", validateStartNoK8sWithVersion},
---> {"VerifyNok8sNoK8sDownloads", },

		{"StartWithK8s", validateStartWithK8S},
		{"StartWithStopK8s", validateStartWithStopK8s},

Copy link
Contributor Author

Choose a reason for hiding this comment

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

since in StartNoK8sWithVersion we pass a Kubernetes version with --no-kubernetes isn't that suppose to exits with an error and that won't leave a running cluster to reuse i guess.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

maybe we are reuse this instance {"Start", validateStartNoK8S}, since it will be fresh working instance

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 11, 2025
@divysinghvi divysinghvi requested a review from medyagh August 12, 2025 06:32
@medyagh
Copy link
Member

medyagh commented Sep 8, 2025

/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 Sep 8, 2025
defer PostMortemLogs(t, profile)

// Reuse the minikube instance started by validateStartNoK8S.
homeDir := os.Getenv("HOME")
Copy link
Member

Choose a reason for hiding this comment

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

check other tests, see if we have already sometihng for minikube home

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In no_kubernetes_test.go no other has a home path, since they mostly interact was with minikube using via CLI commands, for the minikube home thing i found one instance in cache_binaries_test.go they use MINIKUBE_HOME , can you suggest any other way i can check this thanks

Copy link
Member

Choose a reason for hiding this comment

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

@divysinghvi you shoud use localpath.MiniPath()
here is an example in test/integration/aaa_download_only_test.go

				// checking binaries downloaded (kubelet,kubeadm)
				for _, bin := range constants.KubernetesReleaseBinaries {
					fp := filepath.Join(localpath.MiniPath(), "cache", "linux", runtime.GOARCH, v, bin)
					_, err := os.Stat(fp)
					if err != nil {
						t.Errorf("expected the file for binary exist at %q but got error %v", fp, err)
					}
				}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for help i will look into it

@minikube-pr-bot

This comment has been minimized.

@minikube-pr-bot

This comment has been minimized.

@divysinghvi
Copy link
Contributor Author

/retest

@divysinghvi
Copy link
Contributor Author

/retest-required

@minikube-pr-bot

This comment has been minimized.

@minikube-pr-bot

This comment has been minimized.

@divysinghvi
Copy link
Contributor Author

/retest

@minikube-pr-bot

This comment has been minimized.

@minikube-pr-bot

This comment has been minimized.

func VerifyNoK8sDownloadCache(ctx context.Context, t *testing.T, profile string) {
defer PostMortemLogs(t, profile)

cachePath := filepath.Join(localpath.MiniPath(), "cache", "linux", runtime.GOARCH, "v0.0.0")
Copy link
Member

Choose a reason for hiding this comment

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

this should not be tested only on linux !
the reason it is passing on your machine it is beecause it checks to see if linux doesnt exist

you can use goos to get os

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks medhya i have now used GOOS to get current os, and yes it passes on my system now also
=== RUN TestNoKubernetes/serial/VerifyNok8sNoK8sDownloads no_kubernetes_test.go:91: Checking cache directory: /Users/divysinghvi/.minikube/cache/darwin/arm64/v0.0.0 no_kubernetes_test.go:104: No cache directory found (as expected)
also found a function in binary.go TransferBinaries this maybe creating directories so testing it now

@minikube-pr-bot

This comment has been minimized.

@divysinghvi
Copy link
Contributor Author

@medyagh i tired putting a lot of checks but was not able to identify what is causing the directory to get created but we are able to step the files being created, directory thing i am not able to verify what is causing that you also told me to check localpath.go but i was not able to identify specific for our purpose , now we have either one option we go with the only file approach and have directory check but the test fails only when we have the files in those or figure out a way for finding directory thing in linux

@minikube-pr-bot

This comment has been minimized.

@medyagh
Copy link
Member

medyagh commented Oct 15, 2025

it is interesting on my mac and personal linux it does not create v0.0.0 folder but in CI machines it does ! this is a mystrie !

@divysinghvi
Copy link
Contributor Author

yes @medyagh i have tried everything i could find like i am still not able to figure how folder is getting created in the ci testing it is so weird , since now even you have verified it is not creating the v 0.0.0 when are testing it locally how should be proceed it next? easiest approach would be to check for files within the folder and let it pass when the directory is empty or anything other in mind ??

@minikube-pr-bot

This comment has been minimized.

@divysinghvi
Copy link
Contributor Author

/retest

@minikube-pr-bot

This comment has been minimized.

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Nov 9, 2025

@divysinghvi: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-minikube-integration acfd8b7 link true /test pull-minikube-integration
integration-kvm-crio-linux-x86-64 c4345f2 link true /test integration-kvm-crio-linux-x86-64
integration-kvm-containerd-linux-x86-64 c4345f2 link true /test integration-kvm-containerd-linux-x86-64
integration-docker-docker-linux-x86-64 c4345f2 link true /test integration-docker-docker-linux-x86-64
integration-docker-containerd-linux-x86-64 c4345f2 link true /test integration-docker-containerd-linux-x86-64
integration-docker-crio-linux-x86-64 c4345f2 link true /test integration-docker-crio-linux-x86-64
integration-none-docker-linux-x86-64 c4345f2 link true /test integration-none-docker-linux-x86-64

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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

@minikube-pr-bot
Copy link

kvm2 driver with docker runtime

┌────────────────┬──────────┬────────────────────────┐
│    COMMAND     │ MINIKUBE │ MINIKUBE  ( PR 21139 ) │
├────────────────┼──────────┼────────────────────────┤
│ minikube start │ 40.4s    │ 40.7s                  │
│ enable ingress │ 18.2s    │ 18.4s                  │
└────────────────┴──────────┴────────────────────────┘

Times for minikube start: 41.0s 41.6s 39.3s 40.5s 39.5s
Times for minikube (PR 21139) start: 39.6s 42.4s 40.9s 40.9s 39.7s

Times for minikube ingress: 15.7s 15.7s 16.2s 27.7s 15.8s
Times for minikube (PR 21139) ingress: 15.7s 28.2s 15.7s 15.7s 16.7s

docker driver with docker runtime

┌────────────────┬──────────┬────────────────────────┐
│    COMMAND     │ MINIKUBE │ MINIKUBE  ( PR 21139 ) │
├────────────────┼──────────┼────────────────────────┤
│ minikube start │ 22.9s    │ 23.8s                  │
│ enable ingress │ 12.6s    │ 12.2s                  │
└────────────────┴──────────┴────────────────────────┘

Times for minikube start: 23.2s 23.0s 23.4s 22.8s 21.9s
Times for minikube (PR 21139) start: 25.9s 22.7s 24.6s 22.9s 23.1s

Times for minikube ingress: 13.7s 11.6s 13.6s 10.7s 13.7s
Times for minikube (PR 21139) ingress: 10.7s 10.6s 11.6s 15.6s 12.6s

docker driver with containerd runtime

┌────────────────┬──────────┬────────────────────────┐
│    COMMAND     │ MINIKUBE │ MINIKUBE  ( PR 21139 ) │
├────────────────┼──────────┼────────────────────────┤
│ minikube start │ 20.4s    │ 21.4s                  │
│ enable ingress │ 20.9s    │ 20.9s                  │
└────────────────┴──────────┴────────────────────────┘

Times for minikube start: 19.8s 22.6s 19.9s 19.6s 20.2s
Times for minikube (PR 21139) start: 19.1s 20.0s 22.9s 23.3s 21.8s

Times for minikube ingress: 22.1s 21.1s 21.1s 20.1s 20.1s
Times for minikube (PR 21139) ingress: 20.1s 20.1s 21.1s 20.1s 23.1s

@minikube-pr-bot
Copy link

Here are the number of top 10 failed tests in each environments with lowest flake rate.

Environment Test Name Flake Rate
Docker_Windows (2 failed) TestErrorSpam/setup(gopogh) Unknown
Docker_Windows (2 failed) TestMissingContainerUpgrade(gopogh) Unknown

Besides the following environments also have failed tests:

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

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: divysinghvi, 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 Nov 10, 2025
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.

5 participants