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

Fix pre command flags #13995

Merged
merged 2 commits into from
Apr 21, 2022
Merged

Conversation

spowelljr
Copy link
Member

@spowelljr spowelljr commented Apr 20, 2022

Fixes #13994

Problem:
Having a flag before the command (ex. minikube --alsologtostderr start) would break instances that were coded to look for the command using os.Args[1]. This would result in issues such as not creating a lastStart.txt and not properly detecting if a purge delete was occurring.

Solution:
Replaced instances of os.Args[1] with pflag.Arg(0). pflag.Arg returns all args from os.Args[1:] that aren't flags, resulting in only true args (ex. minikube --alsologtostderr start --driver docker -> pflag.Args() = ["start"]). pflag.Arg() will also return an empty string if trying to access a non-existing arg index.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 20, 2022
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 20, 2022
@sharifelgamal
Copy link
Collaborator

/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 Apr 21, 2022
@minikube-pr-bot
Copy link

kvm2 driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 13995) |
+----------------+----------+---------------------+
| minikube start | 51.8s    | 51.6s               |
| enable ingress | 32.0s    | 29.4s               |
+----------------+----------+---------------------+

Times for minikube start: 55.9s 50.8s 50.3s 50.4s 51.4s
Times for minikube (PR 13995) start: 52.8s 51.0s 51.1s 51.1s 52.0s

Times for minikube ingress: 30.8s 38.6s 30.6s 30.0s 30.1s
Times for minikube (PR 13995) ingress: 30.2s 29.1s 29.5s 31.0s 27.1s

docker driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 13995) |
+----------------+----------+---------------------+
| minikube start | 25.7s    | 24.5s               |
| enable ingress | 23.6s    | 23.9s               |
+----------------+----------+---------------------+

Times for minikube ingress: 24.4s 22.9s 23.9s 24.0s 22.9s
Times for minikube (PR 13995) ingress: 23.0s 23.4s 23.4s 27.0s 22.9s

Times for minikube start: 28.9s 24.9s 25.3s 24.5s 24.7s
Times for minikube (PR 13995) start: 25.5s 25.3s 23.8s 24.2s 23.6s

docker driver with containerd runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 13995) |
+----------------+----------+---------------------+
| minikube start | 41.8s    | 41.8s               |
| enable ingress | 19.9s    | 23.7s               |
+----------------+----------+---------------------+

Times for minikube ingress: 17.9s 17.9s 17.9s 17.9s 27.9s
Times for minikube (PR 13995) ingress: 18.4s 21.9s 27.9s 21.9s 28.4s

Times for minikube (PR 13995) start: 43.7s 39.3s 43.8s 39.4s 42.9s
Times for minikube start: 33.4s 43.8s 44.0s 43.7s 44.2s

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sharifelgamal, spowelljr

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:
  • OWNERS [sharifelgamal,spowelljr]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@spowelljr spowelljr merged commit a799c83 into kubernetes:master Apr 21, 2022
@spowelljr spowelljr deleted the fixPreCommandFlags branch April 21, 2022 16:54
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.

Putting flag before command results in lastStart.txt not being produced
4 participants