Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OEM: IONOS Cloud Images #2389

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions build_library/disk_layout.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,16 @@
"fs_type":"ext2"
}
},
"ionoscloud":{
"6":{
"fs_type":"ext4"
},
"9":{
"label":"ROOT",
"fs_label":"ROOT",
"blocks":"12943360"
}
},
"container":{
"1":{
"type":"blank"
Expand Down
20 changes: 20 additions & 0 deletions build_library/vm_image_util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ VALID_IMG_TYPES=(
vmware_ova
vmware_raw
xen
ionoscloud
)

#list of oem package names, minus the oem- prefix
Expand All @@ -68,6 +69,7 @@ VALID_OEM_PACKAGES=(
vagrant-virtualbox
virtualbox
vmware
ionoscloud
)

# Set at runtime to one of the above types
Expand Down Expand Up @@ -341,6 +343,14 @@ IMG_proxmoxve_OEM_PACKAGE=common-oem-files
IMG_proxmoxve_OEM_USE=proxmoxve
IMG_proxmoxve_OEM_SYSEXT=oem-proxmoxve

## ionoscloud
IMG_ionoscloud_OEM_USE=ionoscloud
IMG_ionoscloud_OEM_PACKAGE=oem-ionoscloud
IMG_ionoscloud_DISK_LAYOUT=ionoscloud
IMG_ionoscloud_DISK_FORMAT=qcow2
IMG_ionoscloud_DISK_EXTENSION=qcow2
IMG_ionoscloud_FS_HOOK=ionoscloud

###########################################################

# Print the default vm type for the specified board
Expand Down Expand Up @@ -619,6 +629,16 @@ _run_box_fs_hook() {
sudo rm -fr "${VM_TMP_ROOT}/oem/box"
}

_run_ionoscloud_fs_hook() {
# Prepare root partition for IONOS Cloud legacy injection
# This is a workaround until the IONOS Cloud introduces a metadata server
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tuunit can you put a date on when a metadata server will be introduced by IONOS Cloud? I wouldn't want this workaround to stay around forever, as it is likely to interfere with evolutions to the rootfs.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately not, I can ask again internally but it will most definitely stay like this for a long time. Up to a year or longer.

sudo mount -o remount,rw "${VM_TMP_ROOT}"
sudo mkdir -p "${VM_TMP_ROOT}/var/lib/cloud/seed/nocloud"
sudo mkdir -p "${VM_TMP_ROOT}/etc/cloud"
sudo touch "${VM_TMP_ROOT}/etc/cloud/cloud.cfg"
sudo mount -o remount,ro "${VM_TMP_ROOT}"
}

# Write the vm disk image to the target directory in the proper format
write_vm_disk() {
if [[ $(_get_vm_opt PARTITIONED_IMG) -eq 1 ]]; then
Expand Down
2 changes: 1 addition & 1 deletion ci-automation/vms.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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|proxmoxve)$ ]];then
elif [[ "${format}" =~ ^(scaleway|kubevirt|proxmoxve|ionoscloud)$ ]];then
COMPRESSION_FORMAT="none"
elif [[ "${format}" =~ ^(akamai)$ ]];then
COMPRESSION_FORMAT="gz"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ ConditionKernelCommandLine=|flatcar.oem.id=akamai

ConditionKernelCommandLine=|flatcar.oem.id=proxmoxve

ConditionKernelCommandLine=|flatcar.oem.id=ionoscloud

Description=Flatcar Metadata Agent

[Service]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
# Distributed under the terms of the GNU General Public License v2

EAPI=7
EGIT_REPO_URI="https://github.com/flatcar/coreos-cloudinit.git"
EGIT_REPO_URI="https://github.com/tuunit/flatcar-cloudinit.git"
COREOS_GO_PACKAGE="github.com/flatcar/coreos-cloudinit"
COREOS_GO_GO111MODULE="on"
inherit git-r3 systemd toolchain-funcs udev coreos-go

if [[ "${PV}" == 9999 ]]; then
KEYWORDS="~amd64 ~arm64"
else
EGIT_COMMIT="f3aaab923de5075524780716635f25564b5e6934" # flatcar-master
EGIT_COMMIT="a0a73022ef2af493b029b145d4235b5a8360afe1" # feat/ionoscloud-support
KEYWORDS="amd64 arm64"
fi

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@
# Distributed under the terms of the GNU General Public License v2

EAPI=7
EGIT_REPO_URI="https://github.com/flatcar/init.git"
EGIT_REPO_URI="https://github.com/tuunit/flatcar-init.git"
PYTHON_COMPAT=( python3_{9..11} )

inherit git-r3 systemd python-any-r1

if [[ "${PV}" == 9999 ]]; then
KEYWORDS="~amd64 ~arm ~arm64 ~x86"
else
EGIT_COMMIT="b5a6cbcfaabe605e28e075b8ac674edaf576a0eb" # flatcar-master
EGIT_COMMIT="5e39ca5d2e5e85217704cefdfa9f2f128ecf822f" # feat/ionoscloud-support
KEYWORDS="amd64 arm arm64 x86"
fi

PYTHON_COMPAT=( python3_{9..11} )

inherit git-r3 systemd python-any-r1

DESCRIPTION="Init scripts for CoreOS"
HOMEPAGE="http://www.coreos.com/"
SRC_URI=""
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# DO NOT EDIT FILE
# MANAGED BY IONOS CLOUD
#
# INDICATOR FILE FOR USER DATA INJECTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Flatcar GRUB settings

set oem_id="ionoscloud"
set linux_append="flatcar.autologin"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
</pkgmetadata>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 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 IONOS Cloud"
HOMEPAGE="https://cloud.ionos.com"
SRC_URI=""

LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="amd64"

# no source directory
S="${WORKDIR}"

src_install() {
insinto "/oem"
doins "${FILESDIR}/grub.cfg"
doins "${FILESDIR}/USER_DATA_INJECTION"
}
Loading