-
Notifications
You must be signed in to change notification settings - Fork 124
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
Add support for OpenNebula as a cloud provider #1450
Add support for OpenNebula as a cloud provider #1450
Conversation
Hi @nilsding. Thanks for your PR. I'm waiting for a kubermatic member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the 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. |
4e99e1b
to
94806ba
Compare
94806ba
to
538bdbc
Compare
538bdbc
to
2d09954
Compare
2d09954
to
00f566a
Compare
Signed-off-by: Georg Gadinger <nilsding@nilsding.org>
Signed-off-by: Georg Gadinger <nilsding@nilsding.org>
00f566a
to
8f670ea
Compare
Signed-off-by: Georg Gadinger <nilsding@nilsding.org>
Hi, we (adidas Runtastic) are testing this provider now for some month in some small user-clusters and it works fine for us. A review and approval would be much aprechiated @xrstf or @ahmedwaleedmalik - Thanks in advance! Cheers, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks good, just a few comments that I think could be addressed.
fmt.Sprintf("<< YOUR_DATASTORE_NAME >>=%s", oneDatastore), | ||
fmt.Sprintf("<< YOUR_NETWORK_NAME >>=%s", oneNetwork), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be an option to also prefix these with ONE_
instead of YOUR_
, so we know that these variable belong to OpenNebula setups?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, can do :)
vcpu: 2 | ||
memory: 1024 | ||
|
||
image: "<< OS_IMAGE >>" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similar to the other comment, can we maybe make sure that this is prefixed to be specific for OpenNebula? e.g. ONE_OS_IMAGE
? This way we can avoid collision with the OpenStack image reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'll rename this to ONE_IMAGE
then, as OS_
is the prefix for OpenStack
// create VM from the generated template above | ||
vmID, err := controller.VMs().Create(tpl.String(), false) | ||
if err != nil { | ||
return nil, err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be helpful to contextualise the error message returned by the upstream SDK here, e.g. with this:
return nil, err | |
return nil, fmt.Errorf("failed to create VM: %w", err) |
|
||
vm, err := controller.VM(vmID).Info(false) | ||
if err != nil { | ||
return nil, err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. I'm not exactly sure what this does, but the error should probably look something like this:
return nil, err | |
return nil, fmt.Errorf("failed to fetch VM information: %w", err) |
client := getClient(c) | ||
controller := goca.NewController(client) | ||
|
||
vmctrl := controller.VM(instance.(*openNebulaInstance).vm.ID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to say I'm not a huge fan of the type assertions here and later in the code since it can introduce run-time panics. I understand it's required to get the OpenNebula specific information, but e.g. the AWS provider implements a private version of get
to return the provider-specific instance, which in turn is then called by the public Get
interface implementation:
func (p *provider) get(ctx context.Context, machine *clusterv1alpha1.Machine) (*awsInstance, error) { |
Have you considered that approach, so you can get the actual instance type you need here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this hasn't come across my mind, will try to adapt this then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the initial review :)
fmt.Sprintf("<< YOUR_DATASTORE_NAME >>=%s", oneDatastore), | ||
fmt.Sprintf("<< YOUR_NETWORK_NAME >>=%s", oneNetwork), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, can do :)
vcpu: 2 | ||
memory: 1024 | ||
|
||
image: "<< OS_IMAGE >>" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'll rename this to ONE_IMAGE
then, as OS_
is the prefix for OpenStack
client := getClient(c) | ||
controller := goca.NewController(client) | ||
|
||
vmctrl := controller.VM(instance.(*openNebulaInstance).vm.ID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this hasn't come across my mind, will try to adapt this then.
Signed-off-by: Georg Gadinger <nilsding@nilsding.org>
Signed-off-by: Georg Gadinger <nilsding@nilsding.org>
/ok-to-test |
@nilsding please address the linter issues as well. The PR should be good to go afterwards. |
Signed-off-by: Georg Gadinger <nilsding@nilsding.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
LGTM label has been added. Git tree hash: 457cb4afe9416faa791b8155ae0674826563b67b
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: embik, nilsding 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 |
Thank you for your contribution, @nilsding! |
/retest |
/retest Review the full test history Silence the bot with an |
3 similar comments
/retest Review the full test history Silence the bot with an |
/retest Review the full test history Silence the bot with an |
/retest Review the full test history Silence the bot with an |
* add cloud provider for opennebula Signed-off-by: Georg Gadinger <nilsding@nilsding.org> * use a flatcar image in example opennebula machinedeployment Signed-off-by: Georg Gadinger <nilsding@nilsding.org> * opennebula: update function signatures to include logger Signed-off-by: Georg Gadinger <nilsding@nilsding.org> * opennebula: update after review Signed-off-by: Georg Gadinger <nilsding@nilsding.org> * opennebula: add SET_HOSTNAME to context Signed-off-by: Georg Gadinger <nilsding@nilsding.org> * opennebula: fix lints Signed-off-by: Georg Gadinger <nilsding@nilsding.org> --------- Signed-off-by: Georg Gadinger <nilsding@nilsding.org>
What this PR does / why we need it:
This PR adds support for OpenNebula as a cloud provider. Similar to OpenStack it can be hosted on your own infrastructure.
We're using OpenNebula for many years already, and adding (basic?) support for it seemed to be easy enough.
What type of PR is this?
/kind feature
Special notes for your reviewer:
I'm not too fond of GoLang, so if there's anything that's not idiomatic please point it out.
Also I would still like to figure out automated end-to-end tests, any support with that is welcome. I tested it manually on a small kubernetes cluster (just some basic creation of the VMs) and it seems to work fine so far.
Does this PR introduce a user-facing change? Then add your Release Note here:
Documentation:
(?)