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

Replace fixed time wait with wait function for docker-env cmd #9973

Closed

Conversation

azhao155
Copy link
Contributor

fixes #9938

In docker-env, instead of waiting for 5s for api server to be up, wait for api server pid to show up.

Start minikube:
zyanshu@zyanshukvm:~/minikube$ ./out/minikube start -p p1
😄 [p1] minikube v1.16.0-beta.0 on Debian rodete
▪ MINIKUBE_ACTIVE_DOCKERD=p1
✨ Automatically selected the docker driver
👍 Starting control plane node p1 in cluster p1
🚜 Pulling base image ...
💾 Downloading Kubernetes v1.20.0 preload ...
> preloaded-images-k8s-v7-v1....: 490.47 MiB / 490.47 MiB 100.00% 36.11 Mi
🔥 Creating docker container (CPUs=2, Memory=26100MB) ...
🐳 Preparing Kubernetes v1.20.0 on Docker 20.10.0 ...
🔎 Verifying Kubernetes components...
🌟 Enabled addons: storage-provisioner, default-storageclass
🏄 Done! kubectl is now configured to use "p1" cluster and "default" namespace by default

Run docker-env cmd:
zyanshu@zyanshukvm:~/minikube$ ./out/minikube docker-env -p p1 --alsologtostderr
I1216 09:02:56.000487 2711966 out.go:221] Setting OutFile to fd 1 ...
I1216 09:02:56.000826 2711966 out.go:273] isatty.IsTerminal(1) = true
I1216 09:02:56.000848 2711966 out.go:234] Setting ErrFile to fd 2...
I1216 09:02:56.000898 2711966 out.go:273] isatty.IsTerminal(2) = true
I1216 09:02:56.001040 2711966 root.go:279] Updating PATH: /usr/local/google/home/zyanshu/.minikube/bin
I1216 09:02:56.001095 2711966 oci.go:526] shell is pointing to dockerd inside minikube. will unset to use host
I1216 09:02:56.001425 2711966 mustload.go:66] Loading cluster: p1
I1216 09:02:56.002362 2711966 cli_runner.go:111] Run: docker container inspect p1 --format={{.State.Status}}
I1216 09:02:56.063844 2711966 host.go:66] Checking if "p1" exists ...
W1216 09:02:56.064205 2711966 docker-env.go:193] dockerd is not active will try to reload it...
I1216 09:02:56.064821 2711966 ssh_runner.go:148] Run: systemctl --version
I1216 09:02:56.064922 2711966 cli_runner.go:111] Run: docker container inspect -f "'{{(index (index .NetworkSettings.Ports "22/tcp") 0).HostPort}}'" p1
I1216 09:02:56.123186 2711966 sshutil.go:45] new ssh client: &{IP:127.0.0.1 Port:33563 SSHKeyPath:/usr/local/google/home/zyanshu/.minikube/machines/p1/id_rsa Username:docker}
I1216 09:02:56.225523 2711966 ssh_runner.go:148] Run: sudo systemctl daemon-reload
I1216 09:02:56.399247 2711966 ssh_runner.go:148] Run: sudo systemctl reload docker
W1216 09:02:56.419070 2711966 docker-env.go:195] will try to restart dockerd because reload failed: sudo systemctl reload docker: Process exited with status 1
stdout:

stderr:
Job for docker.service failed.
See "systemctl status docker.service" and "journalctl -xe" for details.
I1216 09:02:56.419193 2711966 ssh_runner.go:148] Run: sudo systemctl daemon-reload
I1216 09:02:56.565812 2711966 ssh_runner.go:148] Run: sudo systemctl restart docker
I1216 09:02:57.949276 2711966 ssh_runner.go:188] Completed: sudo systemctl restart docker: (1.383387846s)
W1216 09:02:57.949350 2711966 docker-env.go:202] waiting to ensure apisever container is up...
I1216 09:02:57.949366 2711966 docker-env.go:209] waiting for apiserver process to appear ...
I1216 09:02:57.949446 2711966 ssh_runner.go:148] Run: sudo pgrep -xnf kube-apiserver.minikube.
I1216 09:02:58.467167 2711966 ssh_runner.go:148] Run: sudo pgrep -xnf kube-apiserver.minikube.
I1216 09:02:58.967199 2711966 ssh_runner.go:148] Run: sudo pgrep -xnf kube-apiserver.minikube.
I1216 09:02:59.467186 2711966 ssh_runner.go:148] Run: sudo pgrep -xnf kube-apiserver.minikube.
I1216 09:02:59.967177 2711966 ssh_runner.go:148] Run: sudo pgrep -xnf kube-apiserver.minikube.
I1216 09:03:00.467170 2711966 ssh_runner.go:148] Run: sudo pgrep -xnf kube-apiserver.minikube.
I1216 09:03:00.967182 2711966 ssh_runner.go:148] Run: sudo pgrep -xnf kube-apiserver.minikube.
I1216 09:03:01.039794 2711966 docker-env.go:229] duration metric: took 3.090415908s to wait for apiserver process to appear ...
I1216 09:03:01.039925 2711966 cli_runner.go:111] Run: docker container inspect -f "'{{(index (index .NetworkSettings.Ports "22/tcp") 0).HostPort}}'" p1
I1216 09:03:01.097569 2711966 docker-env.go:459] Testing Docker connectivity with: /usr/bin/docker version --format={{.Server}}
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.49.2:2376"
export DOCKER_CERT_PATH="/usr/local/google/home/zyanshu/.minikube/certs"
export MINIKUBE_ACTIVE_DOCKERD="p1"

To point your shell to minikube's docker-daemon, run:

eval $(minikube -p p1 docker-env)

medyagh and others added 30 commits November 25, 2020 14:22
…-VerifyKubernetesImages

fix TestStartStop crio VerifyKubernetesImages serial test
update kicbase and iso images on head
If user had a podman environment configured before podman-env,
restore it on unset (similar to existing code for docker-env)
There is a lot of code duplication from docker-env

Most of it also applies for podman (CONTAINER_HOST)
Update conformance tests for multinode testing
Add --cancel-scheduled flag to cancel all existing scheduled stops
Change back to the version-pinned cri-o channel
Site: Auto detect user OS and default tabs to it
fix base image when using with custom image repository
Also store commit in the metadata of binaries in GCS so it's easy to figure out what commit they were built at.
…changed

Only rebuild minikube latest binaries if commit has changed
Remove the "recommendation" from the arm64 deb
@k8s-ci-robot
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please sign in with your organization's credentials at https://identity.linuxfoundation.org/projects/cncf to be authorized.
  • If you have done the above and are still having issues with the CLA being reported as unsigned, please log a ticket with the Linux Foundation Helpdesk: https://support.linuxfoundation.org/
  • Should you encounter any issues with the Linux Foundation Helpdesk, send a message to the backup e-mail support address at: [email protected]

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

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

Welcome @azhao155!

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
Copy link
Contributor

Hi @azhao155. 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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 16, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: azhao155
To complete the pull request process, please assign tstromberg after the PR has been reviewed.
You can assign the PR to them by writing /assign @tstromberg 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

@azhao155
Copy link
Contributor Author

@medyagh

@minikube-bot
Copy link
Collaborator

Can one of the admins verify this patch?

time.Sleep(time.Second * 5)
klog.Warningf("waiting to ensure apisever container is up...")
startTime := time.Now()
if err = WaitForAPIServerProcess(runner, startTime, time.Second*5); 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.

lets increase the timeout to be 30 seconds

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated pr

@azhao155 azhao155 force-pushed the yzhao/feature/dockerEnvWaitForApiServer branch from adaef45 to 92953d5 Compare December 21, 2020 20:24
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 21, 2020
@k8s-ci-robot
Copy link
Contributor

@azhao155: PR needs rebase.

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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Dec 21, 2020
@azhao155
Copy link
Contributor Author

close this one since commits has mess up.
Sent a new pr: #10021

@azhao155 azhao155 closed this Dec 21, 2020
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. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Verify Apiserver in docker-env