distro/rhel8: use azure-rhui pkg set and image config for vhd

Extract the non-RHUI specific package set and image configuration into a
common definitions, which will be used by both image types.

Redefine the package sets and default image configuration used by both
image types to inherit from a common definition.

Regenerate image manifests for RHEL-8 / c8s `vhd` and `azure-rhui`
images.

There is no change in the resulting manifest for the `azure-rhui` image
type. However there are substantial changes to the `vhd` image
definition, which is now almost identical to the `azure-rhui` image
type, to provide consistent experience regardless if using RHUI or not.

The default partition table used by the `vhd` image type has been kept
as it was before, since there is yet no consensus on what size to
standardize for both image types.
This commit is contained in:
Tomas Hozza 2022-09-02 17:04:06 +02:00 committed by Christian Kellner
parent b4abacbaa2
commit f4aed3e6e2
13 changed files with 19031 additions and 1696 deletions

View file

@ -14,35 +14,9 @@ import (
// PACKAGE SETS
func vhdCommonPackageSet(t *imageType) rpmmd.PackageSet {
return rpmmd.PackageSet{
Include: []string{
// Defaults
"@Core",
"langpacks-en",
// From the lorax kickstart
"chrony",
"cloud-init",
"cloud-utils-growpart",
"gdisk",
"net-tools",
"python3",
"selinux-policy-targeted",
"WALinuxAgent",
// removed from defaults but required to boot in azure
"dhcp-client",
},
Exclude: []string{
"dracut-config-rescue",
"rng-tools",
},
}.Append(bootPackageSet(t))
}
func azureRhuiCommonPackageSet(t *imageType) rpmmd.PackageSet {
return rpmmd.PackageSet{
// Common Azure image package set
func azureCommonPackageSet(t *imageType) rpmmd.PackageSet {
ps := rpmmd.PackageSet{
Include: []string{
"@Server",
"NetworkManager",
@ -60,9 +34,7 @@ func azureRhuiCommonPackageSet(t *imageType) rpmmd.PackageSet {
"bzip2",
"langpacks-en",
"grub2-pc",
"rhc",
"yum-utils",
"rhui-azure-rhel8",
"WALinuxAgent",
"cloud-init",
"cloud-utils-growpart",
@ -122,7 +94,32 @@ func azureRhuiCommonPackageSet(t *imageType) rpmmd.PackageSet {
"rhnlib",
"usb_modeswitch",
},
}.Append(bootPackageSet(t))
}.Append(bootPackageSet(t)).Append(distroSpecificPackageSet(t))
if t.arch.distro.isRHEL() {
ps.Append(rpmmd.PackageSet{
Include: []string{
"insights-client",
"rhc",
},
})
}
return ps
}
// Azure BYOS image package set
func azurePackageSet(t *imageType) rpmmd.PackageSet {
return azureCommonPackageSet(t)
}
// Azure RHUI image package set
func azureRhuiPackageSet(t *imageType) rpmmd.PackageSet {
return rpmmd.PackageSet{
Include: []string{
"rhui-azure-rhel8",
},
}.Append(azureCommonPackageSet(t))
}
// PARTITION TABLES
@ -285,52 +282,11 @@ func vhdPipelines(compress bool) pipelinesFunc {
// IMAGE DEFINITIONS
var vhdImgType = imageType{
name: "vhd",
filename: "disk.vhd",
mimeType: "application/x-vhd",
packageSets: map[string]packageSetFunc{
buildPkgsKey: distroBuildPackageSet,
osPkgsKey: vhdCommonPackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
defaultImageConfig: &distro.ImageConfig{
EnabledServices: []string{
"sshd",
"waagent",
},
DefaultTarget: common.StringToPtr("multi-user.target"),
},
kernelOptions: "ro biosdevname=0 rootdelay=300 console=ttyS0 earlyprintk=ttyS0 net.ifnames=0",
bootable: true,
defaultSize: 4 * common.GibiByte,
pipelines: vhdPipelines(false),
buildPipelines: []string{"build"},
payloadPipelines: []string{"os", "image", "vpc"},
exports: []string{"vpc"},
basePartitionTables: defaultBasePartitionTables,
}
var defaultAzureKernelOptions = "ro crashkernel=auto console=tty1 console=ttyS0 earlyprintk=ttyS0 rootdelay=300"
var azureRhuiImgType = imageType{
name: "azure-rhui",
filename: "disk.vhd.xz",
mimeType: "application/xz",
packageSets: map[string]packageSetFunc{
buildPkgsKey: ec2BuildPackageSet,
osPkgsKey: azureRhuiCommonPackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
defaultImageConfig: &distro.ImageConfig{
var defaultAzureImageConfig = &distro.ImageConfig{
Timezone: common.StringToPtr("Etc/UTC"),
Locale: common.StringToPtr("en_US.UTF-8"),
GPGKeyFiles: []string{
"/etc/pki/rpm-gpg/RPM-GPG-KEY-microsoft-azure-release",
"/etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release",
},
Keyboard: &osbuild.KeymapStageOptions{
Keymap: "us",
X11Keymap: &osbuild.X11KeymapOptions{
@ -439,32 +395,6 @@ var azureRhuiImgType = imageType{
RDEnableSwap: common.BoolToPtr(false),
},
},
RHSMConfig: map[distro.RHSMSubscriptionStatus]*osbuild.RHSMStageOptions{
distro.RHSMConfigNoSubscription: {
DnfPlugins: &osbuild.RHSMStageOptionsDnfPlugins{
SubscriptionManager: &osbuild.RHSMStageOptionsDnfPlugin{
Enabled: false,
},
},
SubMan: &osbuild.RHSMStageOptionsSubMan{
Rhsmcertd: &osbuild.SubManConfigRHSMCERTDSection{
AutoRegistration: common.BoolToPtr(true),
},
Rhsm: &osbuild.SubManConfigRHSMSection{
ManageRepos: common.BoolToPtr(false),
},
},
},
distro.RHSMConfigWithSubscription: {
SubMan: &osbuild.RHSMStageOptionsSubMan{
Rhsmcertd: &osbuild.SubManConfigRHSMCERTDSection{
AutoRegistration: common.BoolToPtr(true),
},
// do not disable the redhat.repo management if the user
// explicitly request the system to be subscribed
},
},
},
Grub2Config: &osbuild.GRUB2Config{
TerminalInput: []string{"serial", "console"},
TerminalOutput: []string{"serial", "console"},
@ -503,8 +433,136 @@ var azureRhuiImgType = imageType{
},
},
DefaultTarget: common.StringToPtr("multi-user.target"),
}
// Azure non-RHEL image type
var azureImgType = imageType{
name: "vhd",
filename: "disk.vhd",
mimeType: "application/x-vhd",
packageSets: map[string]packageSetFunc{
// the ec2 buildroot is required due to the cloud-init stage and dependency on YAML
buildPkgsKey: ec2BuildPackageSet,
osPkgsKey: azurePackageSet,
},
kernelOptions: "ro crashkernel=auto console=tty1 console=ttyS0 earlyprintk=ttyS0 rootdelay=300",
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
defaultImageConfig: defaultAzureImageConfig,
kernelOptions: defaultAzureKernelOptions,
bootable: true,
defaultSize: 4 * common.GibiByte,
pipelines: vhdPipelines(false),
buildPipelines: []string{"build"},
payloadPipelines: []string{"os", "image", "vpc"},
exports: []string{"vpc"},
basePartitionTables: defaultBasePartitionTables,
}
// Diff of the default Image Config compare to the `defaultAzureImageConfig`
var defaultAzureByosImageConfig = &distro.ImageConfig{
GPGKeyFiles: []string{
"/etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release",
},
RHSMConfig: map[distro.RHSMSubscriptionStatus]*osbuild.RHSMStageOptions{
distro.RHSMConfigNoSubscription: {
SubMan: &osbuild.RHSMStageOptionsSubMan{
Rhsmcertd: &osbuild.SubManConfigRHSMCERTDSection{
AutoRegistration: common.BoolToPtr(true),
},
// Don't disable RHSM redhat.repo management on the GCE
// image, which is BYOS and does not use RHUI for content.
// Otherwise subscribing the system manually after booting
// it would result in empty redhat.repo. Without RHUI, such
// system would have no way to get Red Hat content, but
// enable the repo management manually, which would be very
// confusing.
},
},
distro.RHSMConfigWithSubscription: {
SubMan: &osbuild.RHSMStageOptionsSubMan{
Rhsmcertd: &osbuild.SubManConfigRHSMCERTDSection{
AutoRegistration: common.BoolToPtr(true),
},
// do not disable the redhat.repo management if the user
// explicitly request the system to be subscribed
},
},
},
}
// Azure BYOS image type
var azureByosImgType = imageType{
name: "vhd",
filename: "disk.vhd",
mimeType: "application/x-vhd",
packageSets: map[string]packageSetFunc{
// the ec2 buildroot is required due to the cloud-init stage and dependency on YAML
buildPkgsKey: ec2BuildPackageSet,
osPkgsKey: azurePackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
defaultImageConfig: defaultAzureByosImageConfig.InheritFrom(defaultAzureImageConfig),
kernelOptions: defaultAzureKernelOptions,
bootable: true,
defaultSize: 4 * common.GibiByte,
pipelines: vhdPipelines(false),
buildPipelines: []string{"build"},
payloadPipelines: []string{"os", "image", "vpc"},
exports: []string{"vpc"},
basePartitionTables: defaultBasePartitionTables,
}
// Diff of the default Image Config compare to the `defaultAzureImageConfig`
var defaultAzureRhuiImageConfig = &distro.ImageConfig{
GPGKeyFiles: []string{
"/etc/pki/rpm-gpg/RPM-GPG-KEY-microsoft-azure-release",
"/etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release",
},
RHSMConfig: map[distro.RHSMSubscriptionStatus]*osbuild.RHSMStageOptions{
distro.RHSMConfigNoSubscription: {
DnfPlugins: &osbuild.RHSMStageOptionsDnfPlugins{
SubscriptionManager: &osbuild.RHSMStageOptionsDnfPlugin{
Enabled: false,
},
},
SubMan: &osbuild.RHSMStageOptionsSubMan{
Rhsmcertd: &osbuild.SubManConfigRHSMCERTDSection{
AutoRegistration: common.BoolToPtr(true),
},
Rhsm: &osbuild.SubManConfigRHSMSection{
ManageRepos: common.BoolToPtr(false),
},
},
},
distro.RHSMConfigWithSubscription: {
SubMan: &osbuild.RHSMStageOptionsSubMan{
Rhsmcertd: &osbuild.SubManConfigRHSMCERTDSection{
AutoRegistration: common.BoolToPtr(true),
},
// do not disable the redhat.repo management if the user
// explicitly request the system to be subscribed
},
},
},
}
var azureRhuiImgType = imageType{
name: "azure-rhui",
filename: "disk.vhd.xz",
mimeType: "application/xz",
packageSets: map[string]packageSetFunc{
// the ec2 buildroot is required due to the cloud-init stage and dependency on YAML
buildPkgsKey: ec2BuildPackageSet,
osPkgsKey: azureRhuiPackageSet,
},
packageSetChains: map[string][]string{
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
},
defaultImageConfig: defaultAzureRhuiImageConfig.InheritFrom(defaultAzureImageConfig),
kernelOptions: defaultAzureKernelOptions,
bootable: true,
defaultSize: 68719476736,
pipelines: vhdPipelines(true),

View file

@ -1666,7 +1666,6 @@ func newDistro(distroName string) distro.Distro {
openstackImgType,
qcow2ImgType,
tarImgType,
vhdImgType,
vmdkImgType,
)
@ -1701,6 +1700,7 @@ func newDistro(distroName string) distro.Distro {
// add azure to RHEL distro only
x86_64.addImageTypes(azureRhuiImgType)
x86_64.addImageTypes(azureByosImgType)
// add ec2 image types to RHEL distro only
x86_64.addImageTypes(ec2ImgTypeX86_64, ec2HaImgTypeX86_64)
@ -1719,7 +1719,7 @@ func newDistro(distroName string) distro.Distro {
// add s390x to RHEL distro only
rd.addArches(s390x)
} else {
x86_64.addImageTypes(edgeSimplifiedInstallerImgType, edgeRawImgType)
x86_64.addImageTypes(edgeSimplifiedInstallerImgType, edgeRawImgType, azureImgType)
aarch64.addImageTypes(edgeSimplifiedInstallerImgType, edgeRawImgType)
}
rd.addArches(x86_64, aarch64, ppc64le)

File diff suppressed because it is too large Load diff

View file

@ -13336,6 +13336,5 @@
"checksum": "sha256:10e429e047cea577ade1d52422a39af6349b4427b6aba8865dc4eba169c142ce"
}
]
},
"no-image-info": true
}
}

File diff suppressed because it is too large Load diff

View file

@ -13462,6 +13462,5 @@
"checksum": "sha256:10e429e047cea577ade1d52422a39af6349b4427b6aba8865dc4eba169c142ce"
}
]
},
"no-image-info": true
}
}

File diff suppressed because it is too large Load diff

View file

@ -13354,6 +13354,5 @@
"checksum": "sha256:10e429e047cea577ade1d52422a39af6349b4427b6aba8865dc4eba169c142ce"
}
]
},
"no-image-info": true
}
}

File diff suppressed because it is too large Load diff

View file

@ -13336,6 +13336,5 @@
"checksum": "sha256:10e429e047cea577ade1d52422a39af6349b4427b6aba8865dc4eba169c142ce"
}
]
},
"no-image-info": true
}
}

File diff suppressed because it is too large Load diff

View file

@ -13336,6 +13336,5 @@
"checksum": "sha256:10e429e047cea577ade1d52422a39af6349b4427b6aba8865dc4eba169c142ce"
}
]
},
"no-image-info": true
}
}

File diff suppressed because it is too large Load diff