From 6e674b26d3ba4316146a28c5ee46cc960012a155 Mon Sep 17 00:00:00 2001 From: Mathieu Tortuyaux Date: Thu, 24 Oct 2024 14:56:56 +0200 Subject: [PATCH 1/2] oem: provide proxmox images MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Kai Lüke Signed-off-by: Mathieu Tortuyaux --- build_library/vm_image_util.sh | 9 +++++++++ changelog/changes/2024-10-24-proxmoxve.md | 1 + ci-automation/vms.sh | 2 +- .../afterburn/files/coreos-metadata.service | 2 ++ ...s-0-r8.ebuild => common-oem-files-0-r9.ebuild} | 1 + .../files/proxmoxve/grub.cfg.frag | 1 + ...-r196.ebuild => coreos-init-0.0.1-r197.ebuild} | 0 .../coreos-init/coreos-init-9999.ebuild | 2 +- .../coreos-base/oem-proxmoxve/metadata.xml | 4 ++++ .../oem-proxmoxve/oem-proxmoxve-0.ebuild | 15 +++++++++++++++ ...38-r33.ebuild => bootengine-0.0.38-r34.ebuild} | 0 .../sys-kernel/bootengine/bootengine-9999.ebuild | 2 +- 12 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 changelog/changes/2024-10-24-proxmoxve.md rename sdk_container/src/third_party/coreos-overlay/coreos-base/common-oem-files/{common-oem-files-0-r8.ebuild => common-oem-files-0-r9.ebuild} (99%) create mode 100644 sdk_container/src/third_party/coreos-overlay/coreos-base/common-oem-files/files/proxmoxve/grub.cfg.frag rename sdk_container/src/third_party/coreos-overlay/coreos-base/coreos-init/{coreos-init-0.0.1-r196.ebuild => coreos-init-0.0.1-r197.ebuild} (100%) create mode 100644 sdk_container/src/third_party/coreos-overlay/coreos-base/oem-proxmoxve/metadata.xml create mode 100644 sdk_container/src/third_party/coreos-overlay/coreos-base/oem-proxmoxve/oem-proxmoxve-0.ebuild rename sdk_container/src/third_party/coreos-overlay/sys-kernel/bootengine/{bootengine-0.0.38-r33.ebuild => bootengine-0.0.38-r34.ebuild} (100%) diff --git a/build_library/vm_image_util.sh b/build_library/vm_image_util.sh index ecaa792d5a5..38033ef998b 100644 --- a/build_library/vm_image_util.sh +++ b/build_library/vm_image_util.sh @@ -25,6 +25,7 @@ VALID_IMG_TYPES=( openstack_mini packet parallels + proxmoxve pxe qemu_uefi rackspace @@ -57,6 +58,7 @@ VALID_OEM_PACKAGES=( kubevirt openstack packet + proxmoxve qemu rackspace rackspace-onmetal @@ -332,6 +334,13 @@ IMG_akamai_OEM_PACKAGE=common-oem-files IMG_akamai_OEM_USE=akamai IMG_akamai_OEM_SYSEXT=oem-akamai +# proxmoxve +IMG_proxmoxve_DISK_FORMAT=qcow2 +IMG_proxmoxve_DISK_LAYOUT=vm +IMG_proxmoxve_OEM_PACKAGE=common-oem-files +IMG_proxmoxve_OEM_USE=proxmoxve +IMG_proxmoxve_OEM_SYSEXT=oem-proxmoxve + ########################################################### # Print the default vm type for the specified board diff --git a/changelog/changes/2024-10-24-proxmoxve.md b/changelog/changes/2024-10-24-proxmoxve.md new file mode 100644 index 00000000000..2470ec3616a --- /dev/null +++ b/changelog/changes/2024-10-24-proxmoxve.md @@ -0,0 +1 @@ +- Added Proxmox Virtual Environment images ([scripts#1783](https://github.com/flatcar/scripts/pull/1783)) diff --git a/ci-automation/vms.sh b/ci-automation/vms.sh index 79156b4d695..dac30bb3b08 100644 --- a/ci-automation/vms.sh +++ b/ci-automation/vms.sh @@ -138,7 +138,7 @@ function _vm_build_impl() { COMPRESSION_FORMAT="bz2,none" elif [[ "${format}" =~ ^(hyperv|hyperv_vhdx)$ ]];then COMPRESSION_FORMAT="zip" - elif [[ "${format}" =~ ^(scaleway|kubevirt)$ ]];then + elif [[ "${format}" =~ ^(scaleway|kubevirt|proxmoxve)$ ]];then COMPRESSION_FORMAT="none" elif [[ "${format}" =~ ^(akamai)$ ]];then COMPRESSION_FORMAT="gz" diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/afterburn/files/coreos-metadata.service b/sdk_container/src/third_party/coreos-overlay/coreos-base/afterburn/files/coreos-metadata.service index facc01224db..ad64b983b47 100644 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/afterburn/files/coreos-metadata.service +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/afterburn/files/coreos-metadata.service @@ -25,6 +25,8 @@ ConditionKernelCommandLine=|flatcar.oem.id=kubevirt ConditionKernelCommandLine=|flatcar.oem.id=akamai +ConditionKernelCommandLine=|flatcar.oem.id=proxmoxve + Description=Flatcar Metadata Agent [Service] diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/common-oem-files/common-oem-files-0-r8.ebuild b/sdk_container/src/third_party/coreos-overlay/coreos-base/common-oem-files/common-oem-files-0-r9.ebuild similarity index 99% rename from sdk_container/src/third_party/coreos-overlay/coreos-base/common-oem-files/common-oem-files-0-r8.ebuild rename to sdk_container/src/third_party/coreos-overlay/coreos-base/common-oem-files/common-oem-files-0-r9.ebuild index 9c69deac343..53f2a48e2f6 100644 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/common-oem-files/common-oem-files-0-r8.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/common-oem-files/common-oem-files-0-r9.ebuild @@ -35,6 +35,7 @@ COMMON_OEMIDS=( hetzner openstack packet + proxmoxve qemu scaleway kubevirt diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/common-oem-files/files/proxmoxve/grub.cfg.frag b/sdk_container/src/third_party/coreos-overlay/coreos-base/common-oem-files/files/proxmoxve/grub.cfg.frag new file mode 100644 index 00000000000..4f9e06c2c8c --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/common-oem-files/files/proxmoxve/grub.cfg.frag @@ -0,0 +1 @@ +set linux_append="flatcar.autologin" diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/coreos-init/coreos-init-0.0.1-r196.ebuild b/sdk_container/src/third_party/coreos-overlay/coreos-base/coreos-init/coreos-init-0.0.1-r197.ebuild similarity index 100% rename from sdk_container/src/third_party/coreos-overlay/coreos-base/coreos-init/coreos-init-0.0.1-r196.ebuild rename to sdk_container/src/third_party/coreos-overlay/coreos-base/coreos-init/coreos-init-0.0.1-r197.ebuild diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/coreos-init/coreos-init-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/coreos-base/coreos-init/coreos-init-9999.ebuild index 33408561800..23b8771e711 100644 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/coreos-init/coreos-init-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/coreos-init/coreos-init-9999.ebuild @@ -8,7 +8,7 @@ EGIT_REPO_URI="https://github.com/flatcar/init.git" if [[ "${PV}" == 9999 ]]; then KEYWORDS="~amd64 ~arm ~arm64 ~x86" else - EGIT_COMMIT="05b4b2aafbe706bdd65265c7a7103ed75fee14d2" # flatcar-master + EGIT_COMMIT="b5a6cbcfaabe605e28e075b8ac674edaf576a0eb" # flatcar-master KEYWORDS="amd64 arm arm64 x86" fi diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-proxmoxve/metadata.xml b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-proxmoxve/metadata.xml new file mode 100644 index 00000000000..097975e3adc --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-proxmoxve/metadata.xml @@ -0,0 +1,4 @@ + + + + diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-proxmoxve/oem-proxmoxve-0.ebuild b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-proxmoxve/oem-proxmoxve-0.ebuild new file mode 100644 index 00000000000..bb7fa6e0629 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-proxmoxve/oem-proxmoxve-0.ebuild @@ -0,0 +1,15 @@ +# Copyright (c) 2013 CoreOS, Inc.. All rights reserved. +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DESCRIPTION="OEM suite for Proxmox VE" +HOMEPAGE="https://www.proxmox.com/en/proxmox-virtual-environment/" +SRC_URI="" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="amd64 arm64" +IUSE="" + +OEM_NAME="Proxmox VE" diff --git a/sdk_container/src/third_party/coreos-overlay/sys-kernel/bootengine/bootengine-0.0.38-r33.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-kernel/bootengine/bootengine-0.0.38-r34.ebuild similarity index 100% rename from sdk_container/src/third_party/coreos-overlay/sys-kernel/bootengine/bootengine-0.0.38-r33.ebuild rename to sdk_container/src/third_party/coreos-overlay/sys-kernel/bootengine/bootengine-0.0.38-r34.ebuild diff --git a/sdk_container/src/third_party/coreos-overlay/sys-kernel/bootengine/bootengine-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-kernel/bootengine/bootengine-9999.ebuild index 58c4897cbf1..edf2ceed2b0 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-kernel/bootengine/bootengine-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/sys-kernel/bootengine/bootengine-9999.ebuild @@ -7,7 +7,7 @@ EGIT_REPO_URI="https://github.com/flatcar/bootengine.git" if [[ "${PV}" == 9999 ]]; then KEYWORDS="~amd64 ~arm ~arm64 ~x86" else - EGIT_COMMIT="f3c80fb02fe65dd3be2b0bb4727fc10985acfa9d" # flatcar-master + EGIT_COMMIT="c9de038b73621165f81573c77ca0d0c2f9e886db" # flatcar-master KEYWORDS="amd64 arm arm64 x86" fi From c1cd33684bd0e62b968ee518657e207d7121a667 Mon Sep 17 00:00:00 2001 From: Mathieu Tortuyaux Date: Wed, 6 Nov 2024 15:24:19 +0100 Subject: [PATCH 2/2] coreos-base/afterburn: fix instance boots Without configdrive the instance is failing to boot - this patch is currently under review on PR#1128 (coreos/afterburn) Signed-off-by: Mathieu Tortuyaux --- .../afterburn/tormath1-proxmox.patch | 126 ++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 sdk_container/src/third_party/coreos-overlay/coreos/user-patches/coreos-base/afterburn/tormath1-proxmox.patch diff --git a/sdk_container/src/third_party/coreos-overlay/coreos/user-patches/coreos-base/afterburn/tormath1-proxmox.patch b/sdk_container/src/third_party/coreos-overlay/coreos/user-patches/coreos-base/afterburn/tormath1-proxmox.patch new file mode 100644 index 00000000000..a9791f1bca6 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/coreos/user-patches/coreos-base/afterburn/tormath1-proxmox.patch @@ -0,0 +1,126 @@ +From e6824a223057ca1379d3890ec58773f7549f6ec2 Mon Sep 17 00:00:00 2001 +From: Mathieu Tortuyaux +Date: Wed, 6 Nov 2024 14:51:42 +0100 +Subject: [PATCH 1/2] add noop provider + +Signed-off-by: Mathieu Tortuyaux +--- + src/providers/noop/mod.rs | 28 ++++++++++++++++++++++++++++ + 1 file changed, 28 insertions(+) + create mode 100644 src/providers/noop/mod.rs + +diff --git a/src/providers/noop/mod.rs b/src/providers/noop/mod.rs +new file mode 100644 +index 0000000..c722297 +--- /dev/null ++++ b/src/providers/noop/mod.rs +@@ -0,0 +1,28 @@ ++// Copyright 2023 CoreOS, Inc. ++// ++// Licensed under the Apache License, Version 2.0 (the "License"); ++// you may not use this file except in compliance with the License. ++// You may obtain a copy of the License at ++// ++// http://www.apache.org/licenses/LICENSE-2.0 ++// ++// Unless required by applicable law or agreed to in writing, software ++// distributed under the License is distributed on an "AS IS" BASIS, ++// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++// See the License for the specific language governing permissions and ++// limitations under the License. ++ ++use anyhow::Result; ++ ++use crate::providers::MetadataProvider; ++ ++/// Noop provider ++pub struct NoopProvider {} ++ ++impl NoopProvider { ++ pub fn try_new() -> Result { ++ Ok(Self { }) ++ } ++} ++ ++impl MetadataProvider for NoopProvider {} +-- +2.44.2 + +From fce6d962436fad9c0700174c7fab99ba35d653fd Mon Sep 17 00:00:00 2001 +From: Mathieu Tortuyaux +Date: Wed, 6 Nov 2024 15:14:26 +0100 +Subject: [PATCH 2/2] proxmox: use noop provider if no configdrive + +Signed-off-by: Mathieu Tortuyaux +--- + src/metadata.rs | 4 ++-- + src/providers/mod.rs | 1 + + src/providers/proxmoxve/mod.rs | 14 ++++++++++++++ + 3 files changed, 17 insertions(+), 2 deletions(-) + +diff --git a/src/metadata.rs b/src/metadata.rs +index 94f9238..bd311f7 100644 +--- a/src/metadata.rs ++++ b/src/metadata.rs +@@ -33,7 +33,7 @@ use crate::providers::openstack; + use crate::providers::openstack::network::OpenstackProviderNetwork; + use crate::providers::packet::PacketProvider; + use crate::providers::powervs::PowerVSProvider; +-use crate::providers::proxmoxve::ProxmoxVEConfigDrive; ++use crate::providers::proxmoxve; + use crate::providers::scaleway::ScalewayProvider; + use crate::providers::vmware::VmwareProvider; + use crate::providers::vultr::VultrProvider; +@@ -71,7 +71,7 @@ pub fn fetch_metadata(provider: &str) -> Result box_result!(OpenstackProviderNetwork::try_new()?), + "packet" => box_result!(PacketProvider::try_new()?), + "powervs" => box_result!(PowerVSProvider::try_new()?), +- "proxmoxve" => box_result!(ProxmoxVEConfigDrive::try_new()?), ++ "proxmoxve" => proxmoxve::try_config_drive_else_leave(), + "scaleway" => box_result!(ScalewayProvider::try_new()?), + "vmware" => box_result!(VmwareProvider::try_new()?), + "vultr" => box_result!(VultrProvider::try_new()?), +diff --git a/src/providers/mod.rs b/src/providers/mod.rs +index e17d551..dab07e1 100644 +--- a/src/providers/mod.rs ++++ b/src/providers/mod.rs +@@ -35,6 +35,7 @@ pub mod ibmcloud; + pub mod ibmcloud_classic; + pub mod kubevirt; + pub mod microsoft; ++pub mod noop; + pub mod openstack; + pub mod packet; + pub mod powervs; +diff --git a/src/providers/proxmoxve/mod.rs b/src/providers/proxmoxve/mod.rs +index 14146b0..a965162 100644 +--- a/src/providers/proxmoxve/mod.rs ++++ b/src/providers/proxmoxve/mod.rs +@@ -12,6 +12,11 @@ + // See the License for the specific language governing permissions and + // limitations under the License. + ++use anyhow::Result; ++use crate::providers; ++use crate::providers::noop::NoopProvider; ++use slog_scope::warn; ++ + mod configdrive; + pub use configdrive::*; + +@@ -20,3 +25,12 @@ pub use cloudconfig::*; + + #[cfg(test)] + mod tests; ++ ++pub fn try_config_drive_else_leave() -> Result> { ++ if let Ok(config_drive) = ProxmoxVEConfigDrive::try_new() { ++ Ok(Box::new(config_drive)) ++ } else { ++ warn!("failed to locate config-drive - aborting ProxmoxVE provider"); ++ Ok(Box::new(NoopProvider::try_new()?)) ++ } ++} +-- +2.44.2 +