Skip to content

Commit

Permalink
distro/fedora: align the vhd image to the official version
Browse files Browse the repository at this point in the history
I took the kickstart from Fedora and reimplemented it here. This should fix
a lot of issues like missing cloud-init. Since the kickstart for azure is
inheriting the kickstart from the base cloud image, I did the same thing
in our code to mimic that.

See
https://pagure.io/fedora-kickstarts/blob/58c856ae882a93362f025b4efae143fbd778edc9/f/fedora-cloud-base-azure.ks
  • Loading branch information
ondrejbudai authored and achilleas-k committed Sep 8, 2023
1 parent b630dc2 commit 3d8388e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 49 deletions.
48 changes: 19 additions & 29 deletions pkg/distro/fedora/distro.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,35 +247,6 @@ var (
basePartitionTables: defaultBasePartitionTables,
}

vhdImgType = imageType{
name: "vhd",
filename: "disk.vhd",
mimeType: "application/x-vhd",
packageSets: map[string]packageSetFunc{
osPkgsKey: vhdCommonPackageSet,
},
defaultImageConfig: &distro.ImageConfig{
Locale: common.ToPtr("en_US.UTF-8"),
EnabledServices: []string{
"sshd",
},
DefaultTarget: common.ToPtr("multi-user.target"),
DisabledServices: []string{
"proc-sys-fs-binfmt_misc.mount",
"loadmodules.service",
},
},
kernelOptions: defaultKernelOptions,
bootable: true,
defaultSize: 2 * common.GibiByte,
image: diskImage,
buildPipelines: []string{"build"},
payloadPipelines: []string{"os", "image", "vpc"},
exports: []string{"vpc"},
basePartitionTables: defaultBasePartitionTables,
environment: &environment.Azure{},
}

vmdkDefaultImageConfig = &distro.ImageConfig{
Locale: common.ToPtr("en_US.UTF-8"),
EnabledServices: []string{
Expand Down Expand Up @@ -572,6 +543,25 @@ func newDistro(version int) distro.Distro {
openstackImgType := qcow2ImgType
openstackImgType.name = "openstack"

vhdImgType := qcow2ImgType
vhdImgType.name = "vhd"
vhdImgType.filename = "disk.vhd"
vhdImgType.mimeType = "application/x-vhd"
vhdImgType.payloadPipelines = []string{"os", "image", "vpc"}
vhdImgType.exports = []string{"vpc"}
vhdImgType.environment = &environment.Azure{}
vhdImgType.packageSets = map[string]packageSetFunc{
osPkgsKey: vhdCommonPackageSet,
}
vhdConfig := distro.ImageConfig{
SshdConfig: &osbuild.SshdConfigStageOptions{
Config: osbuild.SshdConfigConfig{
ClientAliveInterval: common.ToPtr(120),
},
},
}
vhdImgType.defaultImageConfig = vhdConfig.InheritFrom(qcow2ImgType.defaultImageConfig)

x86_64.addImageTypes(
&platform.X86{
BIOS: true,
Expand Down
36 changes: 16 additions & 20 deletions pkg/distro/fedora/package_sets.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ import (
"github.com/osbuild/images/pkg/rpmmd"
)

func qcow2CommonPackageSet(t *imageType) rpmmd.PackageSet {
func cloudBaseSet(t *imageType) rpmmd.PackageSet {
return rpmmd.PackageSet{
Include: []string{
"@Fedora Cloud Server",
"chrony", // not mentioned in the kickstart, anaconda pulls it when setting the timezone
"langpacks-en",
"qemu-guest-agent",
},
Exclude: []string{
"dracut-config-rescue",
Expand All @@ -29,25 +28,22 @@ func qcow2CommonPackageSet(t *imageType) rpmmd.PackageSet {
}
}

func qcow2CommonPackageSet(t *imageType) rpmmd.PackageSet {
return cloudBaseSet(t).Append(
rpmmd.PackageSet{
Include: []string{
"qemu-guest-agent",
},
})
}

func vhdCommonPackageSet(t *imageType) rpmmd.PackageSet {
return rpmmd.PackageSet{
Include: []string{
"@core",
"chrony",
"langpacks-en",
"net-tools",
"ntfsprogs",
"libxcrypt-compat",
"initscripts",
"glibc-all-langpacks",
},
Exclude: []string{
"dracut-config-rescue",
"geolite2-city",
"geolite2-country",
"zram-generator-defaults",
},
}
return cloudBaseSet(t).Append(
rpmmd.PackageSet{
Include: []string{
"WALinuxAgent",
},
})
}

func vmdkCommonPackageSet(t *imageType) rpmmd.PackageSet {
Expand Down

0 comments on commit 3d8388e

Please sign in to comment.