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

Renews cached NodeInfo with new vSphere connection #57978

Merged

Conversation

prashima
Copy link
Contributor

@prashima prashima commented Jan 8, 2018

What this PR does / why we need it:
This PR modifies two public functions of nodemanager.go- GetNodeInfo and GetNodeDetails. For both these functions NodeInfo object is renewed with new GoVmomiClient and new vclib VirtualMachine and Datacenter.

Which issue(s) this PR fixes :
Fixes vmware#404

Special notes for your reviewer:
Code has been structured to minimize impact on existing 1.9 release code and any side-effects due to NodeInfo modification. This is a quick solution for vSphere connection renewal problem. A more enhanced solution is target for upcoming major release.

Testing:

  • Successfully tried out pod creation, deletion with dynamic volume.
  • Successfully ran e2e tests.

Release note:

Fixes authentication problem faced during various vSphere operations.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. 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. labels Jan 8, 2018
@prashima
Copy link
Contributor Author

prashima commented Jan 8, 2018

/assign @luomiao

return nil, err
}
}
vm := nodeInfo.vm.RenewVM(vsphereInstance.conn.GoVmomiClient)
Copy link

Choose a reason for hiding this comment

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

It looks like you have created a new VM object and new datacenter object and replaced the old nodeinfo. Then do you need to release/destroy the old VM and datacenter object? There is a DeleteVM method in virtualmachine.go. I am wondering if replace current NodeInfo with new objects will leave dangling objects behind.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@luomiao the DeleteVM function does deletion of actual vSphere VM. We don't want to do that. Our intention here is just to renew the vclib VirtualMachine struct, which in turn extends govmomi VirtualMachine, by setting up new client object. The vSphere VM should remain intact.

Any on going operation that still has handle to older vclib VirtualMachine object can continue to use it without any foreseeable race condition (for now at least :)). Once those operations finish the older VirtualMachine struct instance, which is no longer being referenced by NodeInfo or any other ongoing operation, will get garbage collected.

Hope that answers your concern.

Copy link

Choose a reason for hiding this comment

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

Got it, thanks for the explanation :)

@luomiao
Copy link

luomiao commented Jan 9, 2018

/approve
/ok-to-test

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 9, 2018
@gmarek
Copy link
Contributor

gmarek commented Jan 9, 2018

Looks good generally. The only thing missing is some unit tests.

@prashima
Copy link
Contributor Author

prashima commented Jan 9, 2018

@gmarek I can add some unit tests once #55918 goes in.

@luomiao
Copy link

luomiao commented Jan 9, 2018

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 9, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: luomiao, prashima

Associated issue: #404

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 57511, 57978). If you want to cherry-pick this change to another branch, please follow the instructions here.

@mbohlool
Copy link
Contributor

In the rest of kubernetes code, we do not capitalize start of error messages as they may be merged together. It is not critical to fix this for cherry pick but please fix it for the main repo PR.

k8s-github-robot pushed a commit that referenced this pull request Jan 17, 2018
…-upstream-release-1.9

Automatic merge from submit-queue.

Automated cherry pick of #57978 upstream release-1.9

Cherry pick of #57978 on release-1.9
#57978: Renews cached NodeInfo with new vSphere connection

**Release note:**
```
Fixes authentication problem faced during various vSphere operations.
```

cc: @prashima
@prashima prashima deleted the fix-vsphere-connection branch January 30, 2018 17:39
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

Attach failing with NotAuthenticated error.
7 participants