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

Run podman as USER then as sudo in driver check #13061

Closed
wants to merge 1 commit into from

Conversation

djplt
Copy link

@djplt djplt commented Dec 1, 2021

Fixes #11973

@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 cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 1, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @djplt. 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 the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Dec 1, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

@minikube-bot
Copy link
Collaborator

Can one of the admins verify this patch?

cmd.Env = append(os.Environ(), "LANG=C", "LC_ALL=C") // sudo is localized
// Run podman as USER, if that fails run podman as sudo
o, err = cmd.Output()
if err != nil && sudoNeedsPassword() {
Copy link
Member

Choose a reason for hiding this comment

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

why we run this only if sudo needs password?
what if sudo does NOT need password, we dont wanna run it then?

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 very much for taking this issue @djplt
just minor comments

and please check the CLA singing

@@ -167,3 +174,8 @@ func status() registry.State {

return registry.State{Error: err, Installed: true, Healthy: false, Doc: docURL}
}

func sudoNeedsPassword() bool {
err := exec.Command("sudo", "-n", "ls").Run()
Copy link
Member

Choose a reason for hiding this comment

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

is there a cheaper way than executing a command ? (since this code is used in driver check it would worth to optimize second to miliseconds

how about this one ? https://askubuntu.com/questions/357220/how-to-check-if-sudo-password-has-been-entered-for-this-terminal-session#:~:text=If%20a%20password%20is%20required,2%3E%2Fdev%2Fnull%20.

if sudo -n true 2>/dev/null```

@AkihiroSuda
Copy link
Member

Can we rather use --rootless flag? #12901

Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

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

I don't think this works.

At least you have to let pkg/drivers/kic/oci.podmanSystemInfo() to report Rootless bool to the caller, otherwise kubelet and CRI can't work with Rootless Podman.

Please see #12901

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Dec 2, 2021
@djplt
Copy link
Author

djplt commented Dec 2, 2021

I think the changes are in conflict with #12901 and so I've merged with that branch (assuming it will be merged in). I've gone for a simpler approach where only root or rootless will be attempted in a given driver check.

@djplt
Copy link
Author

djplt commented Dec 2, 2021

I signed it

@k8s-ci-robot k8s-ci-robot added 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 Dec 2, 2021
@klaases
Copy link
Contributor

klaases commented Jan 12, 2022

hi @djplt, were you able to address @medyagh's comment above?

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 12, 2022
@djplt
Copy link
Author

djplt commented Jan 22, 2022

hi @djplt, were you able to address @medyagh's comment above?

@klaases yes I believe so. However, my changes were in conflict with #12901 so I merged those changes into this branch as per the comments of @AkihiroSuda.

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 22, 2022
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 2, 2022
@djplt
Copy link
Author

djplt commented May 2, 2022

@klaases and @AkihiroSuda I've merged in the latest master branch - it appears to be working now. Happy to get this re-reviewed thanks.

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 1, 2022
@k8s-ci-robot k8s-ci-robot added the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Jun 1, 2022
@djplt
Copy link
Author

djplt commented Jun 1, 2022

/remove-lifecycle rotten

@k8s-ci-robot k8s-ci-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Jun 1, 2022
@spowelljr
Copy link
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 Jun 7, 2022
@spowelljr
Copy link
Member

Hi @djplt, this PR has a merge conflict, could you please rebase and then push it up and then I can take a look at it, thanks!

@djplt djplt force-pushed the 11973-driver-sudo-check branch from 2276180 to 4635668 Compare June 17, 2022 12:02
@djplt
Copy link
Author

djplt commented Jun 17, 2022

@spowelljr that's been done now!

@minikube-pr-bot
Copy link

kvm2 driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 13061) |
+----------------+----------+---------------------+
| minikube start | 51.9s    | 50.2s               |
| enable ingress | 27.7s    | 29.0s               |
+----------------+----------+---------------------+

Times for minikube (PR 13061) start: 50.0s 49.5s 50.4s 50.6s 50.6s
Times for minikube start: 50.8s 51.8s 53.8s 51.7s 51.4s

Times for minikube ingress: 25.6s 29.1s 29.1s 29.1s 25.6s
Times for minikube (PR 13061) ingress: 28.1s 29.6s 29.0s 29.1s 29.1s

docker driver with docker runtime

+-------------------+----------+---------------------+
|      COMMAND      | MINIKUBE | MINIKUBE (PR 13061) |
+-------------------+----------+---------------------+
| minikube start    | 25.2s    | 24.8s               |
| ⚠️  enable ingress | 22.4s    | 34.9s ⚠️             |
+-------------------+----------+---------------------+

Times for minikube start: 24.6s 24.8s 25.7s 25.1s 25.7s
Times for minikube (PR 13061) start: 24.5s 24.9s 24.9s 24.8s 24.8s

Times for minikube ingress: 21.9s 22.4s 22.0s 23.9s 21.9s
Times for minikube (PR 13061) ingress: 21.9s 82.9s 23.9s 22.9s 22.9s

docker driver with containerd runtime

+-------------------+----------+---------------------+
|      COMMAND      | MINIKUBE | MINIKUBE (PR 13061) |
+-------------------+----------+---------------------+
| ⚠️  minikube start | 30.6s    | 35.7s ⚠️             |
| enable ingress    | 26.3s    | 25.9s               |
+-------------------+----------+---------------------+

Times for minikube start: 29.3s 38.4s 28.6s 28.3s 28.5s
Times for minikube (PR 13061) start: 29.8s 44.1s 31.6s 32.7s 40.2s

Times for minikube ingress: 22.4s 22.4s 32.4s 32.4s 21.9s
Times for minikube (PR 13061) ingress: 22.4s 17.9s 18.9s 47.9s 22.4s

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 15, 2022
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Oct 15, 2022
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

@k8s-ci-robot
Copy link
Contributor

@k8s-triage-robot: Closed this PR.

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

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.

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. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. 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.

minikube driver check should not call sudo, if sudo fails
9 participants