mirror of
https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud.git
synced 2025-12-14 19:02:45 +03:00
More Cloud Autodetects
This commit is contained in:
parent
98928e89a2
commit
697957f8c0
13
CHANGELOG.md
13
CHANGELOG.md
@ -1,5 +1,18 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 2024-xx-xx - Tiny Cloud v3.1.0
|
||||
|
||||
* Default to "/usr merge" friendly installation locations
|
||||
|
||||
* Configure cloud provider via kernel cmdline or DMI system serial -- either
|
||||
with `ds=<cloud>` or `tinycloud=cloud=<cloud>` (we may introduce additional
|
||||
cmdline Tiny Cloud config settings in the future).
|
||||
|
||||
* Autodetection of `aws`, `azure`, `gcp`, and `oci` cloud providers via DMI
|
||||
information.
|
||||
|
||||
* Make sure all user-data handlers get installed.
|
||||
|
||||
## 2024-11-04 - Tiny Cloud v3.0.8
|
||||
|
||||
* Officially add Makefile targets and flesh out tests for newer cloud modules:
|
||||
|
||||
15
Makefile
15
Makefile
@ -27,14 +27,17 @@ openrc:
|
||||
aws:
|
||||
install -Dm644 -t "$(PREFIX)"/usr/lib/tiny-cloud/cloud/aws \
|
||||
lib/tiny-cloud/cloud/aws/*
|
||||
chmod 0755 "$(PREFIX)"/usr/lib/tiny-cloud/cloud/aws/autodetect
|
||||
|
||||
azure:
|
||||
install -Dm644 -t "$(PREFIX)"/usr/lib/tiny-cloud/cloud/azure \
|
||||
lib/tiny-cloud/cloud/azure/*
|
||||
chmod 0755 "$(PREFIX)"/usr/lib/tiny-cloud/cloud/azure/autodetect
|
||||
|
||||
gcp:
|
||||
install -Dm644 -t "$(PREFIX)"/usr/lib/tiny-cloud/cloud/gcp \
|
||||
lib/tiny-cloud/cloud/gcp/*
|
||||
chmod 0755 "$(PREFIX)"/usr/lib/tiny-cloud/cloud/gcp/autodetect
|
||||
|
||||
hetzner:
|
||||
install -Dm644 -t "$(PREFIX)"/usr/lib/tiny-cloud/cloud/hetzner \
|
||||
@ -42,20 +45,18 @@ hetzner:
|
||||
|
||||
incus:
|
||||
install -Dm644 -t "$(PREFIX)"/usr/lib/tiny-cloud/cloud/incus \
|
||||
lib/tiny-cloud/cloud/incus/imds
|
||||
install -Dm755 -t "$(PREFIX)"/usr/lib/tiny-cloud/cloud/incus \
|
||||
lib/tiny-cloud/cloud/incus/autodetect
|
||||
lib/tiny-cloud/cloud/incus/*
|
||||
chmod 0755 "$(PREFIX)"/usr/lib/tiny-cloud/cloud/incus/autodetect
|
||||
|
||||
nocloud:
|
||||
install -Dm644 -t "$(PREFIX)"/usr/lib/tiny-cloud/cloud/nocloud \
|
||||
lib/tiny-cloud/cloud/nocloud/init \
|
||||
lib/tiny-cloud/cloud/nocloud/imds
|
||||
install -Dm755 -t "$(PREFIX)"/usr/lib/tiny-cloud/cloud/nocloud \
|
||||
lib/tiny-cloud/cloud/nocloud/autodetect
|
||||
lib/tiny-cloud/cloud/nocloud/*
|
||||
chmod 0755 "$(PREFIX)"/usr/lib/tiny-cloud/cloud/nocloud/autodetect
|
||||
|
||||
oci:
|
||||
install -Dm644 -t "$(PREFIX)"/usr/lib/tiny-cloud/cloud/oci \
|
||||
lib/tiny-cloud/cloud/oci/*
|
||||
chmod 0755 "$(PREFIX)"/usr/lib/tiny-cloud/cloud/oci/autodetect
|
||||
|
||||
scaleway:
|
||||
install -Dm644 -t "$(PREFIX)"/usr/lib/tiny-cloud/cloud/scaleway \
|
||||
|
||||
5
lib/tiny-cloud/cloud/aws/autodetect
Executable file
5
lib/tiny-cloud/cloud/aws/autodetect
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
# vim:set filetype=sh:
|
||||
# shellcheck shell=sh
|
||||
|
||||
grep -qi amazon "$ROOT"/sys/class/dmi/id/modalias 2>/dev/null && echo "10 aws"
|
||||
5
lib/tiny-cloud/cloud/azure/autodetect
Executable file
5
lib/tiny-cloud/cloud/azure/autodetect
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
# vim:set filetype=sh:
|
||||
# shellcheck shell=sh
|
||||
|
||||
grep -qi microsoft "$ROOT"/sys/class/dmi/id/modalias 2>/dev/null && echo "10 azure"
|
||||
5
lib/tiny-cloud/cloud/gcp/autodetect
Executable file
5
lib/tiny-cloud/cloud/gcp/autodetect
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
# vim:set filetype=sh:
|
||||
# shellcheck shell=sh
|
||||
|
||||
grep -qi google "$ROOT"/sys/class/dmi/id/modalias 2>/dev/null && echo "10 gcp"
|
||||
@ -1,3 +1,5 @@
|
||||
#!/bin/sh
|
||||
# vim:set filetype=sh:
|
||||
# shellcheck shell=sh
|
||||
|
||||
test -e "$ROOT"/dev/incus/sock && echo "10 incus"
|
||||
|
||||
@ -1,10 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Tiny Cloud - Autodetect
|
||||
# vim:set filetype=sh:
|
||||
# shellcheck shell=sh
|
||||
|
||||
# kernel cmdline & DMI product serial are checked in common
|
||||
findfs LABEL=cidata >/dev/null 2>&1 \
|
||||
|| findfs LABEL=CIDATA >/dev/null 2>&1 \
|
||||
&& echo "10 nocloud"
|
||||
|
||||
5
lib/tiny-cloud/cloud/oci/autodetect
Executable file
5
lib/tiny-cloud/cloud/oci/autodetect
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
# vim:set filetype=sh:
|
||||
# shellcheck shell=sh
|
||||
|
||||
grep -qi oraclecloud "$ROOT"/sys/class/dmi/id/chassis_asset_tag 2>/dev/null && echo "10 oci"
|
||||
@ -23,11 +23,17 @@ init_tests \
|
||||
set_ssh_keys \
|
||||
userdata_type \
|
||||
run_userdata \
|
||||
autodetect_unknown \
|
||||
autodetect_aws_cmdline \
|
||||
autodetect_aws_nitro \
|
||||
autodetect_aws_xen \
|
||||
autodetect_azure \
|
||||
autodetect_gcp \
|
||||
autodetect_incus \
|
||||
autodetect_nocloud_cmdline \
|
||||
autodetect_nocloud_dmi \
|
||||
autodetect_nocloud_volume
|
||||
autodetect_nocloud_volume \
|
||||
autodetect_oci \
|
||||
autodetect_unknown
|
||||
|
||||
PROVIDERS="aws azure gcp nocloud oci scaleway hetzner"
|
||||
|
||||
@ -230,6 +236,54 @@ autodetect_unknown_body() {
|
||||
sh -c ". \"$lib\"; echo \$CLOUD"
|
||||
}
|
||||
|
||||
autodetect_aws_cmdline_body() {
|
||||
mkdir -p proc
|
||||
echo "quiet tinycloud=cloud=aws console=ttyS0" > proc/cmdline
|
||||
atf_check \
|
||||
-o match:"aws" \
|
||||
sh -c ". \"$lib\"; echo \$CLOUD"
|
||||
}
|
||||
|
||||
autodetect_aws_nitro_body() {
|
||||
mkdir -p sys/class/dmi/id
|
||||
cat > sys/class/dmi/id/modalias <<-EOT
|
||||
dmi:bvnAmazonEC2:bvr1.0:bd10/16/2017:br1.0:svnAmazonEC2:pnm6g.metal:pvr1.0:rvnAmazonEC2:rnNotSpecified:rvrNotSpecified:cvnAmazonEC2:ct1:cvrNotSpecified:skuNotSpecified:
|
||||
EOT
|
||||
atf_check \
|
||||
-o match:"aws" \
|
||||
sh -c ". \"$lib\"; echo \$CLOUD"
|
||||
}
|
||||
|
||||
autodetect_aws_xen_body() {
|
||||
mkdir -p sys/class/dmi/id
|
||||
cat > sys/class/dmi/id/modalias <<-EOT
|
||||
dmi:bvnXen:bvr4.11.amazon:bd08/24/2006:svnXen:pnHVMdomU:pvr4.11.amazon:cvnXen:ct1:cvr
|
||||
EOT
|
||||
atf_check \
|
||||
-o match:"aws" \
|
||||
sh -c ". \"$lib\"; echo \$CLOUD"
|
||||
}
|
||||
|
||||
autodetect_azure_body() {
|
||||
mkdir -p sys/class/dmi/id
|
||||
cat > sys/class/dmi/id/modalias <<-EOT
|
||||
dmi:bvnMicrosoftCorporation:bvrHyper-VUEFIReleasev4.1:bd03/08/2024:br4.1:svnMicrosoftCorporation:pnVirtualMachine:pvrHyper-VUEFIReleasev4.1:rvnMicrosoftCorporation:rnVirtualMachine:rvrHyper-VUEFIReleasev4.1:cvnMicrosoftCorporation:ct3:cvrHyper-VUEFIReleasev4.1:skuNone:
|
||||
EOT
|
||||
atf_check \
|
||||
-o match:"azure" \
|
||||
sh -c ". \"$lib\"; echo \$CLOUD"
|
||||
}
|
||||
|
||||
autodetect_gcp_body() {
|
||||
mkdir -p sys/class/dmi/id
|
||||
cat > sys/class/dmi/id/modalias <<-EOT
|
||||
dmi:bvnGoogle:bvrGoogle:bd10/22/2024:br1.0:svnGoogle:pnGoogleComputeEngine:pvr:rvnKVM:rnGoogleComputeEngine:rvr:cvnGoogle:ct1:cvr:sku:
|
||||
EOT
|
||||
atf_check \
|
||||
-o match:"gcp" \
|
||||
sh -c ". \"$lib\"; echo \$CLOUD"
|
||||
}
|
||||
|
||||
autodetect_incus_body() {
|
||||
mkdir -p dev/incus
|
||||
touch dev/incus/sock
|
||||
@ -268,3 +322,11 @@ autodetect_nocloud_volume_body() {
|
||||
-o match:"nocloud" \
|
||||
sh -c ". \"$lib\"; echo \$CLOUD"
|
||||
}
|
||||
|
||||
autodetect_oci_body() {
|
||||
mkdir -p sys/class/dmi/id
|
||||
echo OracleCloud.com > sys/class/dmi/id/chassis_asset_tag
|
||||
atf_check \
|
||||
-o match:"oci" \
|
||||
sh -c ". \"$lib\"; echo \$CLOUD"
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user