mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-20 05:51:18 +02:00
exoscale public cloud provider support
This commit is contained in:
parent
868de6f62e
commit
926adecebb
44
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-exoscale/files/cloud-config.yml
vendored
Normal file
44
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-exoscale/files/cloud-config.yml
vendored
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#cloud-config
|
||||||
|
|
||||||
|
coreos:
|
||||||
|
units:
|
||||||
|
- name: exoscale-ssh-key.service
|
||||||
|
command: restart
|
||||||
|
runtime: yes
|
||||||
|
content: |
|
||||||
|
[Unit]
|
||||||
|
Description=Sets SSH key from metadata
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
StandardOutput=journal+console
|
||||||
|
ExecStart=/usr/share/oem/bin/exoscale-ssh-key
|
||||||
|
- name: exoscale-network.service
|
||||||
|
command: restart
|
||||||
|
runtime: yes
|
||||||
|
content: |
|
||||||
|
[Unit]
|
||||||
|
Description=Optimize network parameters for performance
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
StandardOutput=journal+console
|
||||||
|
ExecStart=/usr/share/oem/bin/exoscale-setup-network
|
||||||
|
- name: exoscale-cloudinit.service
|
||||||
|
command: restart
|
||||||
|
runtime: yes
|
||||||
|
content: |
|
||||||
|
[Unit]
|
||||||
|
Description=Cloudinit from exoscale (cloudstack-style) metadata
|
||||||
|
Requires=coreos-setup-environment.service
|
||||||
|
After=coreos-setup-environment.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
EnvironmentFile=/etc/environment
|
||||||
|
ExecStart=/usr/share/oem/bin/exoscale-coreos-cloudinit
|
||||||
|
oem:
|
||||||
|
id: exoscale
|
||||||
|
name: exoscale
|
||||||
|
home-url: http://www.exoscale.ch
|
||||||
|
bug-report-url: https://github.com/coreos/coreos-overlay
|
@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
ENV=$1
|
||||||
|
|
||||||
|
if [[ -z "$ENV" ]]; then
|
||||||
|
echo "usage: $0 /etc/environment" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make sure that the file is writable
|
||||||
|
touch $ENV
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo "$0: unable to modify ${ENV}" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
sed -i -e '/^COREOS_PUBLIC_IPV4=/d' \
|
||||||
|
-e '/^COREOS_PRIVATE_IPV4=/d' \
|
||||||
|
"${ENV}"
|
||||||
|
|
||||||
|
. /usr/share/oem/bin/exoscale-dhcp
|
||||||
|
|
||||||
|
DHCP_SERVER=$(get_dhcp_ip)
|
||||||
|
METADATA_URL="http://${DHCP_SERVER}/latest/"
|
||||||
|
|
||||||
|
block-until-url "${METADATA_URL}"
|
||||||
|
|
||||||
|
PUBLIC_IP=$(curl --fail -s "${METADATA_URL}public-ipv4")
|
||||||
|
echo COREOS_PUBLIC_IPV4=${PUBLIC_IP} >> $ENV
|
||||||
|
|
||||||
|
PRIVATE_IP=$(curl --fail -s "${METADATA_URL}local-ipv4")
|
||||||
|
echo COREOS_PRIVATE_IPV4=${PRIVATE_IP} >> $ENV
|
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
. /usr/share/oem/bin/exoscale-dhcp
|
||||||
|
|
||||||
|
DHCP_SERVER=$(get_dhcp_ip)
|
||||||
|
USERDATA_URL="http://${DHCP_SERVER}/latest/user-data"
|
||||||
|
|
||||||
|
block-until-url "${USERDATA_URL}"
|
||||||
|
coreos-cloudinit --from-url="${USERDATA_URL}"
|
23
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-exoscale/files/exoscale-dhcp
vendored
Normal file
23
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-exoscale/files/exoscale-dhcp
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
get_dhcp_ip() {
|
||||||
|
local leases_dir="/run/systemd/netif/leases"
|
||||||
|
while true; do
|
||||||
|
if [[ "$(find "${leases_dir}" -type f -size +1c)" ]]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep .5
|
||||||
|
done
|
||||||
|
|
||||||
|
for leasefile in "${leases_dir}/"*; do
|
||||||
|
dhcp_server_ip=$(cat $leasefile | awk -F= '/SERVER_ADDRESS/ { print $2 }')
|
||||||
|
if [[ -n "${dhcp_server_ip}" ]]; then
|
||||||
|
metadata_url="http://${dhcp_server_ip}/latest/meta-data/"
|
||||||
|
curl --fail -s "${metadata_url}" >/dev/null
|
||||||
|
if [[ $? -eq 0 ]]; then
|
||||||
|
echo $dhcp_server_ip
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
/usr/sbin/ethtool -K eth0 tso off gso off
|
9
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-exoscale/files/exoscale-ssh-key
vendored
Normal file
9
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-exoscale/files/exoscale-ssh-key
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
. /usr/share/oem/bin/exoscale-dhcp
|
||||||
|
|
||||||
|
DHCP_SERVER=$(get_dhcp_ip)
|
||||||
|
KEY_URL="http://${DHCP_SERVER}/latest/public-keys"
|
||||||
|
|
||||||
|
block-until-url "${KEY_URL}"
|
||||||
|
curl --fail -s "${KEY_URL}" | update-ssh-keys -a exoscale
|
32
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-exoscale/oem-exoscale-0.0.1.ebuild
vendored
Normal file
32
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-exoscale/oem-exoscale-0.0.1.ebuild
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
|
||||||
|
# Copyright (c) 2014 CoreOS, Inc.. All rights reserved.
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
# $Header:$
|
||||||
|
#
|
||||||
|
|
||||||
|
EAPI=5
|
||||||
|
|
||||||
|
DESCRIPTION="OEM suite for Exoscale images"
|
||||||
|
HOMEPAGE=""
|
||||||
|
SRC_URI=""
|
||||||
|
|
||||||
|
LICENSE="Apache-2.0"
|
||||||
|
SLOT="0"
|
||||||
|
KEYWORDS="amd64 x86"
|
||||||
|
IUSE=""
|
||||||
|
|
||||||
|
# no source directory
|
||||||
|
S="${WORKDIR}"
|
||||||
|
|
||||||
|
src_install() {
|
||||||
|
into "/usr/share/oem"
|
||||||
|
dobin ${FILESDIR}/exoscale-dhcp
|
||||||
|
dobin ${FILESDIR}/exoscale-ssh-key
|
||||||
|
dobin ${FILESDIR}/exoscale-coreos-cloudinit
|
||||||
|
dobin ${FILESDIR}/coreos-setup-environment
|
||||||
|
dobin ${FILESDIR}/exoscale-setup-network
|
||||||
|
|
||||||
|
insinto "/usr/share/oem"
|
||||||
|
doins ${FILESDIR}/cloud-config.yml
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user