-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Initial support for a Cloudstack builder #922
Initial support for a Cloudstack builder #922
Conversation
Comments are highly appreciated. |
} | ||
} | ||
|
||
func ipAddressToListenOn() *net.IPNet { |
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.
Not 100% pleased with this part, will always return the last unicast IP. Needed to template out the userdata which will contain the URL to a kickstart file hosted by this web server.
Add support for Apache Cloudstack (https://cloudstack.apache.org) as a builder. Supports creating new templates of existing templates as well as booting from ISO to PXE boot a full installation to an empty block device. To be able to bootstrap a template from an empty block device we need to be able to netboot and kickstart a OS installation. To do this we spin up a HTTP web server to send files to the virtual machine. We assume the virtual machine will be booting from a iPXE ISO which will chain boot off the userdata we provide when deploying the virtual machine. This also supports passing in templated userdata to be downloaded from the booted virtual machine.
CloudStack should be Cloudstack, also correct some minor spelling nits.
Newest version of gopherstack adds option to skip certificate validation. Should only be used for testing.
Correct bug when trying to template out userdata variables which had not been set. We solve this by setting userdata to an empty string. Also save dummy values for both HTTP IP and port. Also align printout of 'SSH'.
Ensure we have the neccessary values to perform a proper deployVirtualMachine API call.
If a cloudstack build is cancelled/halted we display a message back to the user.
Corrected naming of Cloudstack in underlaying library. Updating usage accordingly.
* Only detach ISOs from virtual machine if it's actually attached * Add configuration option to specify time to wait until we detach ISO
To make debugging of HTTP server problems easier we print both the IP adress and the port where the HTTP server has been exposed.
This looks decent. Unfortunately, I don't want to merge this without having access to a CloudStack installation that I can use for testing. Do you know any vendors that would be willing to provide a free account for basic testing of this builder? Until then, please make this a plugin, it would work great! I'll work on vendors as well. Let me know if you can get me access. I'm going to close for now, but will reopen when/if I can get access. Waah! |
Exoscale (exoscale.ch) has trial accounts with a free tier. Also the Apache CloudStack project might have installation endpoints with latest master / development snapshots located widely. I've reached out to the project to help with this. Hopefully, someone will come back here with the needed info. |
@mitchellh Thanks for the feedback. I have some contact with Exoscale and I'll try reaching out to them. |
@mindjiver If you have any issues with Exoscale, we at Datapipe might be able to provide access to a CloudStack cloud. |
Exoscale sounds good. Please let me know if anything comes through. The Packer project only needs basic access (spin up and down a few machines very rarely) to test this sort of thing. Thanks! |
Hello all, this sounds great. Always happy to help. @mitchellh you can register on https://portal.exoscale.ch/register with the code PACKERROCKS We will meet at DotScale next month. Happy testing. |
I can also provide access to a cloudstack instance for you. |
Checking to see if this is going to open back up due to offers of cloudstack access? |
@retrack @mitchellh Did you guys manage to meet up and get the ball rolling? |
How is this going? I'm interested in cloudstack support for packer as well? |
Couldn't we use |
Using apache-libcloud would add a dependency on python and libcloud. Currently packer ships as a self contained binary in a zip file. Starting to depend on something on as complicated as python would require "real" packages, this would add lots of reoccurring work for the maintainers. |
What @rickard-von-essen said. However a switch to gocs as the underlaying cloudstack API library would be something to look at. But after this has been merged, if it ever gets merged 😄 |
@rickard-von-essen: right, forgot this convenient binary-shipping thing :( One could do a plugin that depends on this library (or CLI tools that uses this library)? |
@C-Duv to extract this builder into a stand-alone plugin for packer you mean? Sure, that would be possible if this won't be merged. To use the underlaying Golang-library in another project, that would also be possible but gopherstack was pretty tailormade for the things needed in packer. |
@mindjiver yes, but even if this PR gets merged. An apache-libcloud dependent Packer builder plugin (say "LibCloudBuilder") may provide building feature for all the LibCloud-compatible cloud providers. But I'm realizing this PR is not the place for that. |
Any update on this? |
@abayer Nope.. I have merged some PRs on my fork which now has been some more action on more Cloudstack installations, versions and hypervisors. But I still think the main issue is to get @mitchellh a good reliable account at a provider which uses Cloudstack so he can test towards it. |
@mindjiver I (and my company) are also interested with this cloudstack support. I'm trying to learn and build packer from your repo but do you have precompiled binaries for Windows/Unix ? |
ping @mindjiver @retrack Any news ? |
@dduportal nope, no news. I might work on making a separate builder which I will build and package for all the necessary platforms. Internally at Klarna we have been using this for over 9 months now. |
@mindjiver Do you have docs for the CloudStack builder by any chance? |
@mindjiver I'm looking for a bit of help here as well. I was able to get packer compiled with your pull request using instructions from a mail archive but I'm wondering if you have any guidance for spinning up from ISO and PXE? For others looking, here's what I had to do to get Packer compiled with this pull request: Prereqs: golang, git, hg and bzr installed (hg is part of mercurial) go get github.com/mitchellh/gox export GOPATH=$HOME/go After running make for the first time, it will fail. There are two errors that need to be fixed: Fix first error:
Fix ssh issue:
Now run make again in $GOPATH/src/github.com/mitchellh/packer/ and it should successfully build and place packer under $GOPATH/bin/ Here's an example template.json: {
] Add "insecure_skip_verify": "true", if you don't have a valid cert on your CloudStack instance. Hope this helps. |
Hi @chobbs- @abayer : I'm planning on working on releasing this a separate builder with some further instructions on how to build templates for Cloudstack using Packer. Including on how to go from an empty block device via iPXE to a auto-installed operating system. I just need some time to setup the proper infrastructure at work to get this going :) |
Thanks for the instructions ! I could not build packer from my compatny, because we got a corporate HTTP / HTTPS-only proxy, and the go get seems to be stuck (while git, docker, curl, wget are working perfectly. What the What ?) :
But guess what, i'm going to publish a container on the Dockerhub like boot2docker iso, which will embed a pre-compiled version, and you will use it to rebuild if wanted :) Wait & see some days, i'll publish the link here. |
OK guys, First build try (Linux 64 only at this time, i need to cross compile for Mac OS / Windows) : So you just have to :
Native build on Windows confirmed work (except the post-build script, which role is to rename packer_packer to packer). Base testing are running |
@mindjiver Hello great work on the Cloudstack builder, just wondering if you have any existing template examples which take a Centos base iso all the way through Packer to Cloudstack using your PR. |
@benjimcc See the following diagram The special chain boot iPXE ISO was built from latest HEAD of master for iPXE with the following embedded script, see http://ipxe.org/embed for more details on how to built the ISO:
The JSON payload for packer-cloudstack looks like this example:
I'm serving the vmlinuz, initrd and kickstart files form the webserver packer spins up on the local workstation that is also performing the API calls to Cloudstack. |
@vogxn @fifthecho @retrack @ddoc @jwthomp @C-Duv @ericlathrop @abayer @dduportal @chobbs- @benjimcc Lets move all discussion over to my initial builder release here: |
Add support for Apache Cloudstack (https://cloudstack.apache.org) as a
builder. Supports creating new templates of existing templates as well
as booting from ISO to PXE boot a full installation to an empty block
device.
To be able to bootstrap a template from an empty block device we need
to be able to netboot and kickstart a OS installation. To do this we
spin up a HTTP web server to send files to the virtual machine. We
assume the virtual machine will be booting from a iPXE ISO which will
chain boot off the userdata we provide when deploying the virtual
machine.
This also supports passing in templated userdata to be downloaded from
the booted virtual machine.