diff --git a/etc/conf.d/tiny-cloud b/etc/conf.d/tiny-cloud.example similarity index 100% rename from etc/conf.d/tiny-cloud rename to etc/conf.d/tiny-cloud.example diff --git a/lib/mdev/vnic-eth-hotplug b/lib/mdev/vnic-eth-hotplug index 5ffea1b..a8adb9f 100755 --- a/lib/mdev/vnic-eth-hotplug +++ b/lib/mdev/vnic-eth-hotplug @@ -27,11 +27,6 @@ ip() { fi } -assemble_interfaces() { - log info "Rebuilding $IFACE_CFG" - /lib/tiny-cloud/network-interfaces -} - interface_up() { log info "Bringing up $MDEV" # umask so udhcpc PID file isn't non-owner writeable @@ -67,11 +62,11 @@ if exec 200>>"$IFACE_CFG"; then if flock 200; then case $ACTION in add|"") - assemble_interfaces + assemble-interfaces is_networking_started && interface_up ;; remove) - assemble_interfaces + assemble-interfaces is_networking_started && cleanup_interface ;; *) diff --git a/lib/tiny-cloud/aws/tiny-cloud b/lib/tiny-cloud/aws/tiny-cloud new file mode 100644 index 0000000..b5359b2 --- /dev/null +++ b/lib/tiny-cloud/aws/tiny-cloud @@ -0,0 +1,30 @@ +# Tiny Cloud configuration + +# REQUIRED: The instance's cloud provider (valid: aws, azure, gcp, oci) +# valid: aws, azure, gcp, oci +CLOUD=aws + +# User account where instance SSH keys are installed +#CLOUD_USER=alpine + +# Filename of userdata file (in TINY_CLOUD_VAR directory) +#CLOUD_USERDATA=user-data + +# IMDS token validity, in seconds (AWS only) +#IMDS_TOKEN_TTL=5 + +# Location of var directory +#TINY_CLOUD_VAR=/var/lib/cloud + +# Location of log directory +#TINY_CLOUD_LOGS=/var/log + +# Hotplug Method (valid: mdev) +#HOTPLUG_TYPE=mdev + +# Cloud-related Hotplug Modules +# valid: vnic_eth_hotplug, nvme_ebs_links (aws) +HOTPLUG_MODULES=" + vnic_eth_hotplug + nvme_ebs_links +" diff --git a/lib/tiny-cloud/azure/tiny-cloud b/lib/tiny-cloud/azure/tiny-cloud new file mode 100644 index 0000000..5ebbf0b --- /dev/null +++ b/lib/tiny-cloud/azure/tiny-cloud @@ -0,0 +1,27 @@ +# Tiny Cloud configuration + +# REQUIRED: The instance's cloud provider (valid: aws, azure, gcp, oci) +# valid: aws, azure, gcp, oci +CLOUD=azure + +# User account where instance SSH keys are installed +#CLOUD_USER=alpine + +# Filename of userdata file (in TINY_CLOUD_VAR directory) +#CLOUD_USERDATA=user-data + +# IMDS token validity, in seconds (AWS only) +#IMDS_TOKEN_TTL=5 + +# Location of var directory +#TINY_CLOUD_VAR=/var/lib/cloud + +# Location of log directory +#TINY_CLOUD_LOGS=/var/log + +# Hotplug Method (valid: mdev) +#HOTPLUG_TYPE=mdev + +# Cloud-related Hotplug Modules +# valid: vnic_eth_hotplug, nvme_ebs_links (aws) +#HOTPLUG_MODULES= diff --git a/lib/tiny-cloud/gcp/tiny-cloud b/lib/tiny-cloud/gcp/tiny-cloud new file mode 100644 index 0000000..d25c871 --- /dev/null +++ b/lib/tiny-cloud/gcp/tiny-cloud @@ -0,0 +1,27 @@ +# Tiny Cloud configuration + +# REQUIRED: The instance's cloud provider (valid: aws, azure, gcp, oci) +# valid: aws, azure, gcp, oci +CLOUD=gcp + +# User account where instance SSH keys are installed +#CLOUD_USER=alpine + +# Filename of userdata file (in TINY_CLOUD_VAR directory) +#CLOUD_USERDATA=user-data + +# IMDS token validity, in seconds (AWS only) +#IMDS_TOKEN_TTL=5 + +# Location of var directory +#TINY_CLOUD_VAR=/var/lib/cloud + +# Location of log directory +#TINY_CLOUD_LOGS=/var/log + +# Hotplug Method (valid: mdev) +#HOTPLUG_TYPE=mdev + +# Cloud-related Hotplug Modules +# valid: vnic_eth_hotplug, nvme_ebs_links (aws) +#HOTPLUG_MODULES= diff --git a/lib/tiny-cloud/init-early b/lib/tiny-cloud/init-early index e429fda..bc4bd37 100644 --- a/lib/tiny-cloud/init-early +++ b/lib/tiny-cloud/init-early @@ -22,8 +22,6 @@ expand_root() { resize2fs "$mountpoint" } -assemble_interfaces() { /lib/tiny-cloud/network-interfaces; } - has_cloud_hotplugs() { [ -n "$HOTPLUG_MODULES" ]; } install_hotplugs() { @@ -40,4 +38,4 @@ install_hotplugs() { } HOTPLUG_TYPE=${HOTPLUG_TYPE:-mdev} -source /lib/tiny-cloud/"$HOTPLUG_TYPE" \ No newline at end of file +[ -f /lib/tiny-cloud/"$HOTPLUG_TYPE" ] && source /lib/tiny-cloud/"$HOTPLUG_TYPE" diff --git a/lib/tiny-cloud/mdev b/lib/tiny-cloud/mdev index 63b79ad..7e5ea25 100644 --- a/lib/tiny-cloud/mdev +++ b/lib/tiny-cloud/mdev @@ -23,13 +23,15 @@ install_before() { # hotpluggable VNICs (multi-cloud) mod__vnic_eth_hotplug() { + [ -f /lib/mdev/vnic-eth-hotplug ] || return 1 + install_before '^eth' \ 'eth[0-9] root:root 0644 */lib/mdev/vnic-eth-hotplug' # NICs attached at launch don't get added with mdev -s - assemble_interfaces + assemble-interfaces } # load cloud-specific functions -[ -f /lib/tiny-cloud/"$CLOUD"/mdev ] && source /lib/tiny-cloud/"$CLOUD"/mdev \ No newline at end of file +[ -f /lib/tiny-cloud/"$CLOUD"/mdev ] && source /lib/tiny-cloud/"$CLOUD"/mdev diff --git a/lib/tiny-cloud/oci/tiny-cloud b/lib/tiny-cloud/oci/tiny-cloud new file mode 100644 index 0000000..a177fc8 --- /dev/null +++ b/lib/tiny-cloud/oci/tiny-cloud @@ -0,0 +1,27 @@ +# Tiny Cloud configuration + +# REQUIRED: The instance's cloud provider (valid: aws, azure, gcp, oci) +# valid: aws, azure, gcp, oci +CLOUD=oci + +# User account where instance SSH keys are installed +#CLOUD_USER=alpine + +# Filename of userdata file (in TINY_CLOUD_VAR directory) +#CLOUD_USERDATA=user-data + +# IMDS token validity, in seconds (AWS only) +#IMDS_TOKEN_TTL=5 + +# Location of var directory +#TINY_CLOUD_VAR=/var/lib/cloud + +# Location of log directory +#TINY_CLOUD_LOGS=/var/log + +# Hotplug Method (valid: mdev) +#HOTPLUG_TYPE=mdev + +# Cloud-related Hotplug Modules +# valid: vnic_eth_hotplug, nvme_ebs_links (aws) +#HOTPLUG_MODULES= diff --git a/lib/tiny-cloud/network-interfaces b/sbin/assemble-interfaces similarity index 100% rename from lib/tiny-cloud/network-interfaces rename to sbin/assemble-interfaces