-
Notifications
You must be signed in to change notification settings - Fork 526
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: support http downloads for assets in talosctl cluster create
This allows to pass direct URLs to Image Factory assets for disk image/ISO/vmlinuz/initramfs, so that we can test Image Factory with Talos. Also add an integration test for Image Factory. Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
- Loading branch information
Showing
4 changed files
with
249 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eou pipefail | ||
|
||
# shellcheck source=/dev/null | ||
source ./hack/test/e2e.sh | ||
|
||
PROVISIONER=qemu | ||
CLUSTER_NAME="e2e-${PROVISIONER}" | ||
|
||
FACTORY_HOSTNAME=${FACTORY_HOSTNAME:-factory.talos.dev} | ||
PXE_FACTORY_HOSTNAME=${PXE_FACTORY_HOSTNAME:-pxe.factory.talos.dev} | ||
FACTORY_SCHEME=${FACTORY_SCHEME:-https} | ||
INSTALLER_IMAGE_NAME=${INSTALLER_IMAGE_NAME:-installer} | ||
|
||
case "${FACTORY_BOOT_METHOD:-iso}" in | ||
iso) | ||
QEMU_FLAGS+=("--iso-path=${FACTORY_SCHEME}://${FACTORY_HOSTNAME}/image/${FACTORY_SCHEMATIC}/${FACTORY_VERSION}/metal-amd64.iso") | ||
;; | ||
disk-image) | ||
QEMU_FLAGS+=("--disk-image-path=${FACTORY_SCHEME}://${FACTORY_HOSTNAME}/image/${FACTORY_SCHEMATIC}/${FACTORY_VERSION}/metal-amd64.raw.xz") | ||
;; | ||
ipxe) | ||
QEMU_FLAGS+=("--ipxe-boot-script=${FACTORY_SCHEME}://${PXE_FACTORY_HOSTNAME}/pxe/${FACTORY_SCHEMATIC}/${FACTORY_VERSION}/metal-amd64") | ||
;; | ||
secureboot-iso) | ||
QEMU_FLAGS+=("--iso-path=${FACTORY_SCHEME}://${FACTORY_HOSTNAME}/image/${FACTORY_SCHEMATIC}/${FACTORY_VERSION}/metal-amd64-secureboot.iso" "--with-tpm2" "--encrypt-ephemeral" "--encrypt-state" "--disk-encryption-key-types=tpm") | ||
INSTALLER_IMAGE_NAME=installer-secureboot | ||
;; | ||
esac | ||
|
||
function assert_secureboot { | ||
if [[ "${FACTORY_BOOT_METHOD:-iso}" != "secureboot-iso" ]]; then | ||
return | ||
fi | ||
|
||
${TALOSCTL} get securitystate -o json | ||
${TALOSCTL} get securitystate -o json | jq -e '.spec.secureBoot == true' | ||
} | ||
|
||
function create_cluster { | ||
build_registry_mirrors | ||
|
||
"${TALOSCTL}" cluster create \ | ||
--provisioner="${PROVISIONER}" \ | ||
--name="${CLUSTER_NAME}" \ | ||
--kubernetes-version="${KUBERNETES_VERSION}" \ | ||
--controlplanes=3 \ | ||
--workers="${QEMU_WORKERS:-1}" \ | ||
--disk=15360 \ | ||
--mtu=1450 \ | ||
--memory=2048 \ | ||
--memory-workers="${QEMU_MEMORY_WORKERS:-2048}" \ | ||
--cpus="${QEMU_CPUS:-2}" \ | ||
--cpus-workers="${QEMU_CPUS_WORKERS:-2}" \ | ||
--cidr=172.20.1.0/24 \ | ||
--cni-bundle-url="${ARTIFACTS}/talosctl-cni-bundle-\${ARCH}.tar.gz" \ | ||
--skip-injecting-config \ | ||
--with-apply-config \ | ||
--talos-version="${FACTORY_VERSION}" \ | ||
--install-image="${FACTORY_HOSTNAME}/${INSTALLER_IMAGE_NAME}/${FACTORY_SCHEMATIC}:${FACTORY_VERSION}" \ | ||
--crashdump \ | ||
"${REGISTRY_MIRROR_FLAGS[@]}" \ | ||
"${QEMU_FLAGS[@]}" | ||
|
||
${TALOSCTL} config node 172.20.1.2 | ||
} | ||
|
||
function destroy_cluster() { | ||
"${TALOSCTL}" cluster destroy --name "${CLUSTER_NAME}" --provisioner "${PROVISIONER}" | ||
} | ||
|
||
create_cluster | ||
|
||
${TALOSCTL} health --run-e2e | ||
${TALOSCTL} version | grep "${FACTORY_VERSION}" | ||
${TALOSCTL} get extensions | grep "${FACTORY_SCHEMATIC}" | ||
assert_secureboot | ||
|
||
if [[ "${FACTORY_UPGRADE:-false}" == "true" ]]; then | ||
${TALOSCTL} upgrade -i "${FACTORY_HOSTNAME}/${INSTALLER_IMAGE_NAME}/${FACTORY_UPGRADE_SCHEMATIC:-$FACTORY_SCHEMATIC}:${FACTORY_UPGRADE_VERSION:-$FACTORY_VERSION}" | ||
${TALOSCTL} version | grep "${FACTORY_UPGRADE_VERSION:-$FACTORY_VERSION}" | ||
${TALOSCTL} get extensions | grep "${FACTORY_UPGRADE_SCHEMATIC:-$FACTORY_SCHEMATIC}" | ||
assert_secureboot | ||
fi | ||
|
||
destroy_cluster |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters