-
Notifications
You must be signed in to change notification settings - Fork 655
CloudStack datasource support #1255
Comments
The tricky thing about CloudStack is just getting the IP of the metadata service. If we know the IP, you can just use the existing EC2 datasource we have today and override the URL. I think one could get cloudstack to work with a long fancy post-up networking command that finds the IP doing https://github.com/coreos/coreos-overlay/blob/master/coreos-base/oem-cloudstack/files/cloudstack-dhcp and then calls |
@ibuildthecloud , |
I've found lease binary in get_dhcp_ip() {
local found=0
while true; do
for eth in $(sudo system-docker exec network sh -c 'ls /var/db/dhcpcd-*.lease' | sed -r 's/.*dhcpcd-(.*)\.lease/\1/'); do
dhcp_server_ip=$(sudo system-docker exec network dhcpcd -U $eth 2> /dev/null | awk -F= '/dhcp_server_identifier/ { print $2 }')
if [[ -n "${dhcp_server_ip}" ]]; then
metadata_url="http://${dhcp_server_ip}/latest/meta-data/"
if wget -q -O /dev/null "${metadata_url}"; then
echo $dhcp_server_ip
found=1
break
fi
fi
done
[[ $found -eq 0 ]] || break
sleep .5
done
} |
I appended below when #cloud-config
write_files:
- path: /usr/bin/cloudstack-dhcp
permissions: "0755"
owner: root
content: |
#!/bin/bash
get_dhcp_ip() {
local found=1
local retry=0
until [[ $found -eq 0 || retry -ge 20 ]]; do
sleep $((retry++))
for eth in $(sudo system-docker exec network sh -c 'ls /var/db/dhcpcd-*.lease' | sed -r 's/.*dhcpcd-(.*)\.lease/\1/'); do
dhcp_server_ip=$(sudo system-docker exec network dhcpcd -U $eth 2> /dev/null | awk -F= '/dhcp_server_identifier/ { print $2 }')
if [[ -n "${dhcp_server_ip}" ]]; then
metadata_url="http://${dhcp_server_ip}/latest/meta-data/"
if wget -qO /dev/null "${metadata_url}"; then
echo $dhcp_server_ip
found=0
break
fi
fi
done
done
return $found
}
- path: /usr/bin/cloudstack-cloudinit
permissions: "0755"
owner: root
content: |
#!/bin/bash
. /usr/bin/cloudstack-dhcp
DHCP_SERVER=$(get_dhcp_ip)
KEY_URL="http://${DHCP_SERVER}/latest/meta-data/public-keys"
cat <<EOT > /var/lib/rancher/conf/cloud-config.d/cloudstack.yml
rancher:
cloud_init:
datasources:
- ec2:http://${DHCP_SERVER}
ssh_authorized_keys:
EOT
{ wget -qO- "${KEY_URL}"; echo; } | while read -r line
do
echo "- ${line}" >> /var/lib/rancher/conf/cloud-config.d/cloudstack.yml
done
if [[ ! -f /tmp/.cloudstack-cloudinit ]]; then
touch /tmp/.cloudstack-cloudinit
cloud-init-execute -pre-console -console
rm /tmp/.cloudstack-cloudinit
fi
runcmd:
- [/usr/bin/cloudstack-cloudinit] |
May I ask for a status on this one? Cloudstack support is requested by users at Exoscale too. |
We would be interested in contributing the Cloudstack support. @ibuildthecloud, @niusmallnan would you be interested having this included directly into rancheros? Our company is currently evaluating RancherOs for CloudStack providers, we are also looking into using Exoscale. @retrack as I've seen you are working at Exoscale, any chance we could arrange for a test-account where we could test the new integration? That would be really awesome 😄 |
@stffabi We welcome all kinds of PRs, I can help review and merge if needed. |
@niusmallnan awesome, I've just started with the implementation. I'll let you know as soon as I've created the PR, so we could discuss the enhancements. |
@stffabi Current version Rancher works out of the box with Exoscale, just enable the driver in settings. Just use this one-off link to try it out: https://portal.exoscale.com/register?coupon=RANCHER4stffabi |
@retrack thanks for you coupon. Unfortunately we would like to use RancherOS as base system instead of Ubuntu/Debian/..., so we are looking for a new Template for "RancherOS". I'm currently implementing the support that cloud-init from RancherOS could directly use the meta-data and user-data information provided by Cloudstack. That would be needed to give Exoscale and other CloudProviders the ability to provide a template for RancherOS. The next question would be if Exoscale is interested in providing such a template. |
@stffabi sorry I totally confused OS and Platform! As soon as a template with the appropriate cloud-init support is ready we would integrate it. Let us know. |
@retrack you could find a first version of a cloudstack qcow2 template here. Unfortunately I currently don't have any cloudstack infrastructure to test it. Would it be possible for you to test it on your infrastructure? Or would it be possible for you to activate the template creation future for my trial Exoscale account? |
@stffabi I can test it on our CS infrastructure. I have very little experience with RancherOS, but we are interested in the possibility of using it in our new 2.0 infrastructure. Also, are you deploying the template straight through the ui or with docker-machine? |
I was able to deploy the template successfully with docker-machine to cloudstack |
@dahendel oh great, thanks so much for testing it. Were you also able to login into the machine with through ssh with |
@stffabi I was. Thanks for you work on this btw. |
@niusmallnan I've created the corresponding PR #2326, thanks for any help to bring it into state where it could be merged in. |
RancherOs 1.4.0 with cloud-stack support and an appropriate image has been released, would it be possible for you @retrack to trigger the image creation at exoscale? That would be really awesome and we could start using RancherOs at exoscale. |
@retrack works like a charm, thanks so much... |
RancherOS Version: 0.6.1
Where are you running RancherOS? baremetal
I would like to see CloudStack datasource support in RancherOS.
It's supported by many other distributions like ubuntu/redhat and oem coreos builds.
/hw
The text was updated successfully, but these errors were encountered: