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

--kubernetes-version: assume latest patch version if not specified by user #16569

Merged
merged 9 commits into from Jun 1, 2023

Conversation

JudahNour
Copy link
Contributor

@JudahNour JudahNour commented May 23, 2023

Closes #16558

Before:

$ mk start --kubernetes-version=1.26
πŸ˜„  minikube v1.30.1 on Debian rodete (amd64)

❌  Exiting due to MK_USAGE: Unable to parse "1.26": No Major.Minor.Patch elements found

After:

$ mk start --kubernetes-version=1.26
πŸ˜„  minikube v1.30.1 on Debian rodete (amd64)
πŸ‘‰  Using Kubernetes 1.26.5 since patch version was unspecified
✨  Automatically selected the docker driver
πŸ“Œ  Using Docker driver with root privileges
πŸ‘  Starting control plane node minikube in cluster minikube
🚜  Pulling base image ...
πŸ”₯  Creating docker container (CPUs=2, Memory=8000MB) ...
🐳  Preparing Kubernetes v1.26.5 on Docker 24.0.0 ...
    β–ͺ Generating certificates and keys ...
    β–ͺ Booting up control plane ...
    β–ͺ Configuring RBAC rules ...
πŸ”—  Configuring bridge CNI (Container Networking Interface) ...
    β–ͺ Using image gcr.io/k8s-minikube/storage-provisioner:v5
πŸ”Ž  Verifying Kubernetes components...
🌟  Enabled addons: storage-provisioner, default-storageclass
πŸ„  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

Before:

$ mk start --kubernetes-version=1.50
πŸ˜„  minikube v1.30.1 on Debian rodete (amd64)

❌  Exiting due to MK_USAGE: Unable to parse "1.50": No Major.Minor.Patch elements found

After:

$ mk start --kubernetes-version=1.50
πŸ˜„  minikube v1.30.1 on Debian rodete (amd64)

❌  Exiting due to MK_PATCH_NOT_FOUND: Unable to detect the latest patch release for specified major.minor version v1.50
πŸ’‘  Suggestion: Specify --kubernetes-version in v<major>.<minor.<build> form. example: 'v1.1.14'

After:

$ mk start --kubernetes-version=hahahahha
πŸ˜„  minikube v1.30.1 on Debian rodete (amd64)

❌  Exiting due to MK_USAGE: Unable to parse "hahahahha": No Major.Minor.Patch elements found

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented May 23, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label May 23, 2023
@k8s-ci-robot
Copy link
Contributor

Welcome @JudahNour!

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 May 23, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @JudahNour. 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 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 May 23, 2023
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 make

@@ -1757,8 +1757,17 @@ $ minikube config unset kubernetes-version`)
} else if strings.EqualFold(strings.ToLower(paramVersion), "latest") || strings.EqualFold(strings.ToLower(paramVersion), "newest") {
paramVersion = constants.NewestKubernetesVersion
}

nvs, err := semver.Make(strings.TrimPrefix(paramVersion, version.VersionPrefix))
kubernetesSemver := strings.TrimPrefix(paramVersion, version.VersionPrefix)
Copy link
Member

Choose a reason for hiding this comment

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

lets make sure we notify the user that we chose latest patch for them since they didn't provide a patch version

Copy link
Member

Choose a reason for hiding this comment

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

also a better PR title would be, "--kubernetes-version: assume latest patch ver if not specified by user"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. I abstracted out the majorMinor check and print it out in validateKubernetesVersion. The function uses the param version so this could be slightly redundant as we do that processing of the param in getKubernetesVersion already and thus redo some of it in validateKubernetesVersion so we can run the check there as well.

@spowelljr
Copy link
Member

/check-cla

@minikube-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@JudahNour JudahNour changed the title accept kubernetes version without patch version --kubernetes-version: assume latest patch version if not specified by user May 23, 2023
@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 May 24, 2023
cmd/minikube/cmd/start.go Outdated Show resolved Hide resolved
@@ -1659,6 +1659,13 @@ func validateKubernetesVersion(old *config.ClusterConfig) {
newestVersion := semver.MustParse(strings.TrimPrefix(constants.NewestKubernetesVersion, version.VersionPrefix))
zeroVersion := semver.MustParse(strings.TrimPrefix(constants.NoKubernetesVersion, version.VersionPrefix))

paramVersion := viper.GetString(kubernetesVersion)
Copy link
Member

Choose a reason for hiding this comment

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

while we are at there could u plz check if captical V works too ? if not I suggest while we are touching this, convert the version to lowercase

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Capital V does not work. Do we want it so that the paramVersion is completely set to lowercase so that this is accounted for? Or do we want it to specifically set the first character to lowercase? I think the former would mean someone could input something like "StAble" as the flag and it would recognize it as "stable"

Copy link
Member

Choose a reason for hiding this comment

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

yeah lets convert the user input to lowercase for all cases, that makes our life easier

@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 May 25, 2023
kubernetesSemver = potentialPatch
} else {
return potentialPatch, ErrPatchNotFound
}
}
nvs, err := semver.Make(kubernetesSemver)
if err != nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if here we want to send back an error here instead of just exiting. With the error return value it could be better to now return an error and handle it outside getKubernetesVersion

Copy link
Member

Choose a reason for hiding this comment

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

good point and good catch ! I think since it is already been implemented like that we can leave this one alone, and if we want we can refactor it in a follow up PR (for sake of keeping this PR small)

cmd/minikube/cmd/start.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/start.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/start.go Outdated Show resolved Hide resolved
kubernetesSemver = potentialPatch
} else {
return potentialPatch, ErrPatchNotFound
}
}
nvs, err := semver.Make(kubernetesSemver)
if err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

good point and good catch ! I think since it is already been implemented like that we can leave this one alone, and if we want we can refactor it in a follow up PR (for sake of keeping this PR small)

cmd/minikube/cmd/start.go Show resolved Hide resolved
@medyagh
Copy link
Member

medyagh commented May 30, 2023

@JudahNour thank for updating the PR, do you mind also re-doing the Before/After after comming the last changes to ensure it is still good

cmd/minikube/cmd/start.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/start.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/start.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/start.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/start.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/start.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/start.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/start.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/start.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/start.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/start_flags.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/start_test.go Outdated Show resolved Hide resolved
Copy link
Member

@spowelljr spowelljr left a comment

Choose a reason for hiding this comment

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

Run make generate-docs to update translations

cmd/minikube/cmd/start.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/start.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/start.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/start.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/start.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/start_test.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/start_test.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/start_test.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/start_test.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/start_test.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/start_test.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/start.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/start_test.go Show resolved Hide resolved
cmd/minikube/cmd/start_test.go Outdated Show resolved Hide resolved
@medyagh
Copy link
Member

medyagh commented May 31, 2023

/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 May 31, 2023
@minikube-pr-bot
Copy link

kvm2 driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 16569) |
+----------------+----------+---------------------+
| minikube start | 53.5s    | 52.7s               |
| enable ingress | 27.7s    | 28.1s               |
+----------------+----------+---------------------+

Times for minikube start: 53.3s 53.4s 56.2s 52.2s 52.2s
Times for minikube (PR 16569) start: 54.2s 52.6s 51.3s 52.2s 53.2s

Times for minikube ingress: 28.2s 27.2s 27.2s 28.2s 27.7s
Times for minikube (PR 16569) ingress: 28.2s 28.2s 28.3s 27.7s 28.2s

docker driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 16569) |
+----------------+----------+---------------------+
| minikube start | 24.1s    | 23.0s               |
| enable ingress | 20.8s    | 21.2s               |
+----------------+----------+---------------------+

Times for minikube start: 21.8s 25.3s 22.2s 25.3s 25.8s
Times for minikube (PR 16569) start: 21.6s 22.1s 21.8s 24.5s 24.7s

Times for minikube ingress: 20.9s 20.4s 20.9s 21.9s 19.9s
Times for minikube (PR 16569) ingress: 21.4s 20.9s 21.9s 20.9s 20.9s

docker driver with containerd runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 16569) |
+----------------+----------+---------------------+
| minikube start | 22.8s    | 22.1s               |
| enable ingress | 32.4s    | 31.4s               |
+----------------+----------+---------------------+

Times for minikube start: 20.4s 24.8s 21.3s 23.6s 24.0s
Times for minikube (PR 16569) start: 23.6s 23.0s 20.1s 22.7s 21.4s

Times for minikube ingress: 31.4s 46.4s 31.4s 19.4s 33.4s
Times for minikube (PR 16569) ingress: 31.4s 31.4s 31.3s 31.4s 31.4s

@minikube-pr-bot
Copy link

These are the flake rates of all failed tests.

Environment Failed Tests Flake Rate (%)
Docker_Linux_crio TestFunctional/parallel/ImageCommands/ImageBuild (gopogh) 0.62 (chart)
Docker_Linux_crio_arm64 TestPause/serial/SecondStartNoReconfiguration (gopogh) 22.88 (chart)

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: JudahNour, 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 Jun 1, 2023
@medyagh
Copy link
Member

medyagh commented Jun 1, 2023

looks good to me ! Congratulations on your first contribution ! looking forward to see more !

@medyagh medyagh merged commit 0168d63 into kubernetes:master Jun 1, 2023
31 of 42 checks passed
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.

--kubernetes-version without patch version should use latest patch
6 participants