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 issue 2513 #3148

Merged
merged 13 commits into from
Sep 27, 2018
Merged

Fix issue 2513 #3148

merged 13 commits into from
Sep 27, 2018

Conversation

mheese
Copy link
Contributor

@mheese mheese commented Sep 21, 2018

This fixes issue #2513, and also effectively does the following:

  • fixes creation of the private network
  • separates activation and creation of networks
  • ensures to generates separate MACs for the NICs
  • fixed the documentation link
  • hardens the deletion of the network: checks if it really is not used by any other VM, and only deletes it if this instance of the minikube VM is the last one using it

It's been a while that I've written these fixes, and because of the big delay on our company's side with signing the CNCF CLA, this PR comes rather late. I'm happy it's sorted out though, and I can create the PR. Looking over the code again though, it looks like everything is in place.

@tstromberg, fyi, as you wanted to be referenced

@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.


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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 21, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mheese
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: dlorenc

If they are not already assigned, you can assign the PR to them by writing /assign @dlorenc in a comment when ready.

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

@minikube-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@mheese
Copy link
Contributor Author

mheese commented Sep 21, 2018

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 Sep 21, 2018
@dlorenc
Copy link
Contributor

dlorenc commented Sep 24, 2018

@minikube-bot OK to test

Copy link
Contributor

@dlorenc dlorenc left a comment

Choose a reason for hiding this comment

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

Thanks! This looks great. A few nits.

return errors.Wrapf(err, "defining network from xml: %s", networkXML.String())
// fail if there are 0 domains
if len(doms) == 0 {
return fmt.Errorf("list of domains is 0 lenght")
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: typo. What's the correct fix here? It would be good to include some steps the user could take to create the domain.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah ... good point to think about what this error means to the user ... it's one of those statements that will/should never happen ... I think there is two things we could do to address this:

  1. turn this into a panic()
  2. simply remove the check: at the end of the day, it would just mean that something else deleted even our own minikube domain while we're trying to delete this network, and then there is no point of further iteration through the domains.

I'd personally opt for (2), but I let you make that decision @dlorenc. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's not panic: https://github.com/golang/go/wiki/CodeReviewComments#dont-panic

I like your #2 option, since this is just at the deletion stage, but just in case it helps a future debugger, do you mind putting a log.Warningf in about the unexpected case?

Thanks again for your contribution.

network, err := conn.LookupNetworkByName(d.PrivateNetwork)
// Tear down network if it exists and is not in use by another minikube instance
log.Debug("Trying to delete the networks (if possible)")
err = d.deleteNetwork()
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: inline the if statement here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fair enough, inlining this statement right now

return errors.Wrapf(err, "defining network from xml: %s", networkXML.String())
// fail if there are 0 domains
if len(doms) == 0 {
return fmt.Errorf("list of domains is 0 lenght")
Copy link
Contributor

Choose a reason for hiding this comment

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

spelling of length.

return errors.Wrapf(err, "defining network from xml: %s", networkXML.String())
// fail if there are 0 domains
if len(doms) == 0 {
return fmt.Errorf("list of domains is 0 lenght")
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's not panic: https://github.com/golang/go/wiki/CodeReviewComments#dont-panic

I like your #2 option, since this is just at the deletion stage, but just in case it helps a future debugger, do you mind putting a log.Warningf in about the unexpected case?

Thanks again for your contribution.

@tstromberg tstromberg added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 27, 2018
@tstromberg tstromberg merged commit 74f8e49 into kubernetes:master Sep 27, 2018
tstromberg added a commit to tstromberg/minikube that referenced this pull request Oct 9, 2018
tstromberg added a commit that referenced this pull request Oct 19, 2018
v0.30.0: Specifically call out the fixed CVE and omitted #3148
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. 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.

5 participants