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

Specify the network when deploying the VM from content library #2407

Merged

Conversation

abhinavmpandey08
Copy link
Member

Description of changes:
Provide a network when deploying VM from a template in the content library.
If the network is not provided, vSphere will pick some network and try to deploy the vm on that network which can have unintended consequences.

Tested and verified with both bottlerocket and ubuntu

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@eks-distro-bot eks-distro-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 14, 2022
@codecov
Copy link

codecov bot commented Jun 14, 2022

Codecov Report

Merging #2407 (b585a79) into main (7ef2ca8) will increase coverage by 0.28%.
The diff coverage is 81.25%.

@@            Coverage Diff             @@
##             main    #2407      +/-   ##
==========================================
+ Coverage   56.25%   56.54%   +0.28%     
==========================================
  Files         304      305       +1     
  Lines       24689    24798     +109     
==========================================
+ Hits        13889    14021     +132     
+ Misses       9507     9479      -28     
- Partials     1293     1298       +5     
Impacted Files Coverage Δ
pkg/providers/vsphere/vsphere.go 64.36% <ø> (ø)
pkg/executables/govc.go 58.85% <78.57%> (+0.60%) ⬆️
pkg/providers/vsphere/defaults.go 71.18% <100.00%> (ø)
...kg/providers/vsphere/internal/templates/factory.go 92.20% <100.00%> (+0.10%) ⬆️
pkg/providers/snow/fetch.go 100.00% <0.00%> (ø)
pkg/clusterapi/fetch.go 100.00% <0.00%> (ø)
pkg/clusterapi/apibuilder.go 93.20% <0.00%> (+0.10%) ⬆️
pkg/providers/snow/apibuilder.go 84.87% <0.00%> (+0.20%) ⬆️
pkg/clusterapi/name.go 89.28% <0.00%> (+1.78%) ⬆️
pkg/providers/snow/objects.go 81.89% <0.00%> (+2.72%) ⬆️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7ef2ca8...b585a79. Read the comment docs.

Copy link
Member

@g-gaston g-gaston left a comment

Choose a reason for hiding this comment

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

Looks good, minor suggestions :)

pkg/executables/govc.go Outdated Show resolved Hide resolved
pkg/executables/govc_test.go Show resolved Hide resolved
@eks-distro-bot eks-distro-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 14, 2022
@abhinavmpandey08 abhinavmpandey08 force-pushed the provide-network-during-deploy branch from ad1264c to fed3ea3 Compare June 14, 2022 21:09
pkg/executables/govc.go Outdated Show resolved Hide resolved
pkg/executables/govc_test.go Outdated Show resolved Hide resolved
@abhinavmpandey08 abhinavmpandey08 force-pushed the provide-network-during-deploy branch from c158605 to 7e387ab Compare June 14, 2022 21:58
Signed-off-by: Abhinav Pandey <abhinavmpandey08@gmail.com>
@abhinavmpandey08 abhinavmpandey08 force-pushed the provide-network-during-deploy branch from 7e387ab to b585a79 Compare June 14, 2022 22:08
@@ -269,9 +276,9 @@ func (g *Govc) CreateLibrary(ctx context.Context, datastore, library string) err
return nil
}

func (g *Govc) DeployTemplateFromLibrary(ctx context.Context, templateDir, templateName, library, datacenter, datastore, resourcePool string, resizeBRDisk bool) error {
func (g *Govc) DeployTemplateFromLibrary(ctx context.Context, templateDir, templateName, library, datacenter, datastore, network, resourcePool string, resizeBRDisk bool) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Idk, if you have looked at my tink e2e PR yet, but I had to do very similar thing as I wanted to use this code to deploy OVA's in the lab. I tried to change as little as possible as I only needed it for the tests, but there are a ton more options in deploy options. Rather, than passing them individually why don't we just take deploy options as a param to account for all possible deploy options?

You can see the options I am using for tink e2e here: https://github.com/aws/eks-anywhere/pull/2031/files#diff-5dfd6bc5a441b6e4027710c63250668f8e0af8e594dfcb6c3c11067cca3e5845

But there are many more options available that we could support.

Copy link
Contributor

Choose a reason for hiding this comment

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

Link above is code in test package, actual govc changes I made were minimal to not disrupt. You can see them here: https://github.com/aws/eks-anywhere/pull/2031/files#diff-1b2bffa403bbd82a1ba98650cb15df32447b074ad23e1cc1cf7df592eca4554d

Thoughts?

Copy link
Member Author

Choose a reason for hiding this comment

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

oh just saw your comment. For CAPV provider, I think we only needed the network option. The disk provisioning option is static. But if more options are needed, then yeah we can make it more generic and provide a slice of options

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, cool. I'm fine revisiting later as if needed.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah seems like you already handled that in your PR. Will review it and try to get it merged tomorrow so you don't have to deal with a bunch of merge conflicts

Copy link
Contributor

Choose a reason for hiding this comment

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

Yea, I have to get code build in order before merging, but please do review as I want to merge before end of week.

@abhinavmpandey08
Copy link
Member Author

/approve

@eks-distro-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abhinavmpandey08

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

@eks-distro-bot eks-distro-bot merged commit f95e2fa into aws:main Jun 14, 2022
@abhinavmpandey08 abhinavmpandey08 deleted the provide-network-during-deploy branch December 14, 2022 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm 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.

4 participants