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

Don't allow enabling addon on a paused cluster #15868

Merged
merged 8 commits into from Jul 14, 2023

Conversation

norshtein
Copy link
Contributor

fixes #15857

Tested in my local environment, when trying to enable auto-pause on a paused cluster, it gives following output and exit immediately:

$ minikube addons enable auto-pause
💡  auto-pause is an addon maintained by Google. For any concerns contact minikube on GitHub.
You can view the list of minikube maintainers at: https://github.com/kubernetes/minikube/blob/master/OWNERS
🤷  Can't enable addon on a paused cluster, please unpause the cluster firstly.
    ▪ auto-pause addon is an alpha feature and still in early development. Please file issues to help us make it better.
    ▪ https://github.com/kubernetes/minikube/labels/co/auto-pause

❌  Exiting due to MK_ADDON_ENABLE: run callbacks: running callbacks: [Can't enable addon on a paused cluster, please unpause the cluster firstly.]

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 16, 2023
@k8s-ci-robot
Copy link
Contributor

Welcome @norshtein!

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 @norshtein. 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/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 16, 2023
@minikube-bot
Copy link
Collaborator

Can one of the admins verify this patch?

pkg/addons/addons.go Outdated Show resolved Hide resolved
pkg/addons/addons.go Outdated Show resolved Hide resolved
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.

I rather we exit before showing the information about the addon, since it is useless for the users and makes it harder to read the error message

@norshtein
Copy link
Contributor Author

I rather we exit before showing the information about the addon, since it is useless for the users and makes it harder to read the error message

Thanks for reviewing! The information about the addon is shown at the very first when enabling addon https://github.com/kubernetes/minikube/blob/master/cmd/minikube/cmd/config/enable.go#L54, should we put the code for checking runtime status before that?

@medyagh
Copy link
Member

medyagh commented Feb 16, 2023

I rather we exit before showing the information about the addon, since it is useless for the users and makes it harder to read the error message

Thanks for reviewing! The information about the addon is shown at the very first when enabling addon https://github.com/kubernetes/minikube/blob/master/cmd/minikube/cmd/config/enable.go#L54, should we put the code for checking runtime status before that?

I rather it be like this


$ minikube addons enable auto-pause
🤷  Can't enable addon on a paused cluster, please unpause the cluster firstly.

❌  Exiting due to MK_ADDON_ENABLE_PAUSED:


we should also create a new Exit Error Code something unique that summaries the problem
something like MK_ADDON_ENABLE_PAUSED

@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 Feb 17, 2023
@norshtein
Copy link
Contributor Author

Hi @medyagh , I've updated the code, now the output becomes:

$ minikube addons enable auto-pause
🤷  can't enable addon on a paused cluster, please unpause the cluster firstly.

❌  Exiting due to MK_ADDON_ENABLE_PAUSED: can't enable addon on a paused cluster, please unpause the cluster firstly.

pkg/addons/addons.go Outdated Show resolved Hide resolved
pkg/addons/addons.go Outdated Show resolved Hide resolved
pkg/addons/addons.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 18, 2023
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 18, 2023
@norshtein
Copy link
Contributor Author

Hi @spowelljr , I've rebased on main branch and updated the code based on your code review, could you please take a look?

pkg/addons/addons.go Outdated Show resolved Hide resolved
@medyagh
Copy link
Member

medyagh commented Mar 1, 2023

norshtein this PR is close to be finihsed, please let me know when you update, we could merge it

@medyagh medyagh changed the title feat: when enabling addon on a paused cluster, give a warning and exit early Don't allow enabling addon on a paused cluster Mar 1, 2023
@norshtein
Copy link
Contributor Author

@medyagh sorry I was busy with some affairs last week, will update this PR soon.

@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 Mar 6, 2023
@minikube-pr-bot

This comment has been minimized.

@minikube-pr-bot

This comment has been minimized.

@spowelljr
Copy link
Member

Looks like this is causing some failures on TestAddons/StoppedEnableDisable

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 11, 2023
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all 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:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this 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 Jun 9, 2023
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.

The problem looks like it's not checking if the cluster is stopped before trying to check if the pods are paused. If the cluster is stopped have VerifyNotPaused return nil, otherwise then check if kube-system is paused or not. Trying to check the pods on a stopped cluster will result in errors.

@medyagh
Copy link
Member

medyagh commented Jul 12, 2023

The problem looks like it's not checking if the cluster is stopped before trying to check if the pods are paused. If the cluster is stopped have VerifyNotPaused return nil, otherwise then check if kube-system is paused or not. Trying to check the pods on a stopped cluster will result in errors.

@norshtein are you still working on this PR?

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 12, 2023
@minikube-pr-bot

This comment has been minimized.

@minikube-pr-bot

This comment has been minimized.

@spowelljr
Copy link
Member

Fixed throwing an error on a stopped cluster

Before:

$ minikube addons enable dashboard

❌  Exiting due to MK_ADDON_ENABLE_PAUSED: enabled failed: check paused: list paused: docker: NewSession: new client: new client: Error creating new ssh host from driver: Error getting ssh port for driver: get ssh host-port: unable to inspect a not running container to get SSH port

╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                         │
│    😿  If the above advice does not help, please let us know:                                                           │
│    👉  https://github.com/kubernetes/minikube/issues/new/choose                                                         │
│                                                                                                                         │
│    Please run `minikube logs --file=logs.txt` and attach logs.txt to the GitHub issue.                                  │
│    Please also attach the following file to the GitHub issue:                                                           │
│    - /var/folders/9l/6wpxv6wd1b901m1146r579wc00rqw3/T/minikube_addons_72a2d59c3bf8ff14a7f994656d47b6b59ed7b266_0.log    │
│                                                                                                                         │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

After:

$ minikube addons enable dashboard

💡  dashboard is an addon maintained by Kubernetes. For any concerns contact minikube on GitHub.
You can view the list of minikube maintainers at: https://github.com/kubernetes/minikube/blob/master/OWNERS
💡  Some dashboard features require the metrics-server addon. To enable all features please run:

	minikube addons enable metrics-server	


🌟  The 'dashboard' addon is enabled

@minikube-pr-bot

This comment has been minimized.

@minikube-pr-bot

This comment has been minimized.

@minikube-pr-bot
Copy link

kvm2 driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 15868) |
+----------------+----------+---------------------+
| minikube start | 52.6s    | 52.2s               |
| enable ingress | 28.3s    | 28.2s               |
+----------------+----------+---------------------+

Times for minikube (PR 15868) ingress: 28.8s 28.3s 27.4s 28.3s 28.3s
Times for minikube ingress: 27.7s 29.3s 27.9s 27.7s 28.9s

Times for minikube start: 52.1s 53.8s 52.4s 51.9s 52.6s
Times for minikube (PR 15868) start: 51.6s 53.6s 52.9s 53.3s 49.8s

docker driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 15868) |
+----------------+----------+---------------------+
| minikube start | 23.5s    | 23.7s               |
| enable ingress | 48.8s    | 48.8s               |
+----------------+----------+---------------------+

Times for minikube start: 22.7s 25.3s 23.4s 23.5s 22.8s
Times for minikube (PR 15868) start: 21.7s 24.3s 26.0s 23.0s 23.3s

Times for minikube ingress: 48.9s 49.4s 48.9s 48.4s 48.4s
Times for minikube (PR 15868) ingress: 48.4s 48.9s 48.3s 48.3s 49.9s

docker driver with containerd runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 15868) |
+----------------+----------+---------------------+
| minikube start | 22.6s    | 22.8s               |
| enable ingress | 31.4s    | 29.3s               |
+----------------+----------+---------------------+

Times for minikube start: 24.1s 23.4s 20.9s 24.0s 20.4s
Times for minikube (PR 15868) start: 23.6s 20.4s 21.8s 24.1s 24.1s

Times for minikube ingress: 31.4s 31.4s 31.4s 31.4s 31.4s
Times for minikube (PR 15868) ingress: 30.9s 32.4s 18.9s 31.9s 32.4s

@minikube-pr-bot
Copy link

These are the flake rates of all failed tests.

Environment Failed Tests Flake Rate (%)
Hyperkit_macOS TestNoKubernetes/serial/StartWithStopK8s (gopogh) 1.20 (chart)
Hyperkit_macOS TestNoKubernetes/serial/StartWithK8s (gopogh) 1.80 (chart)
Hyperkit_macOS TestNetworkPlugins/group/enable-default-cni/Start (gopogh) 3.59 (chart)
Hyperkit_macOS TestMinikubeProfile (gopogh) 5.39 (chart)
Hyperkit_macOS TestNetworkPlugins/group/calico/Start (gopogh) 5.39 (chart)
Hyperkit_macOS TestRunningBinaryUpgrade (gopogh) 9.58 (chart)

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

@spowelljr spowelljr merged commit a4a1ba5 into kubernetes:master Jul 14, 2023
26 of 38 checks passed
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: norshtein, 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:

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 Jul 14, 2023
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. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. 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.

Prevent users from modifying addons while cluster is paused
7 participants