RHEL-84: add gce-rhui image type

Add the `gce-rhui` image type intended for Google Compute Engine. The image
uses Google's RHUI infrastructure to access Red Hat content.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
Tomas Hozza 2022-03-02 17:22:03 +01:00 committed by Tom Gundersen
parent 795294d98f
commit e7f6b95032
6 changed files with 22642 additions and 3 deletions

View file

@ -1576,6 +1576,23 @@ func newDistro(name, modulePlatformID, ostreeRef string, isCentos bool) distro.D
partitionTableGenerator: defaultPartitionTable,
}
gceRhuiImgType := imageTypeS2{
name: "gce-rhui",
filename: "image.tar.gz",
mimeType: "application/gzip",
packageSets: map[string]rpmmd.PackageSet{
"packages": getGceRhuiPackageSet(),
},
kernelOptions: "net.ifnames=0 biosdevname=0 scsi_mod.use_blk_mq=Y crashkernel=auto console=ttyS0,38400n8d",
bootable: true,
defaultSize: 20 * GigaByte,
pipelines: gceRhuiPipelines,
buildPipelines: []string{"build"},
payloadPipelines: []string{"os", "image", "archive"},
exports: []string{"archive"},
partitionTableGenerator: defaultPartitionTable,
}
x8664.addImageTypes(
amiImgType,
qcow2ImageType,
@ -1585,7 +1602,7 @@ func newDistro(name, modulePlatformID, ostreeRef string, isCentos bool) distro.D
vmdkImgType,
)
x8664.addS2ImageTypes(gceImgType)
x8664.addS2ImageTypes(gceImgType, gceRhuiImgType)
if !isCentos {
x8664.addImageTypes(edgeImgTypeX86_64)

View file

@ -82,6 +82,12 @@ func TestFilenameFromType(t *testing.T) {
want: "image.tar.gz",
want1: "application/gzip",
},
{
name: "gce-rhui",
args: args{"gce-rhui"},
want: "image.tar.gz",
want1: "application/gzip",
},
{
name: "invalid-output-type",
args: args{"foobar"},
@ -475,6 +481,7 @@ func TestArchitecture_ListImageTypes(t *testing.T) {
"vhd",
"vmdk",
"gce",
"gce-rhui",
},
rhelAdditionalImageTypes: []string{"rhel-edge-commit", "rhel-edge-container", "rhel-edge-installer"},
},

View file

@ -88,6 +88,15 @@ func getGcePackageSet() rpmmd.PackageSet {
return getGceCommonPackageSet()
}
// GCE RHUI image
func getGceRhuiPackageSet() rpmmd.PackageSet {
return rpmmd.PackageSet{
Include: []string{
"google-rhui-client-rhel8",
},
}.Append(getGceCommonPackageSet())
}
// gcePipelinesRhel86 is a slightly modified RHEL-86 version of gcePipelines() function
func gcePipelinesRhel86(t *imageTypeS2, imageConfig *distro.ImageConfig, customizations *blueprint.Customizations, options distro.ImageOptions, repos []rpmmd.RepoConfig, packageSetSpecs map[string][]rpmmd.PackageSpec, rng *rand.Rand) ([]osbuild.Pipeline, error) {
pipelines := make([]osbuild.Pipeline, 0)
@ -252,3 +261,36 @@ func getDefaultGceByosImageConfig() *distro.ImageConfig {
func gceByosPipelines(t *imageTypeS2, customizations *blueprint.Customizations, options distro.ImageOptions, repos []rpmmd.RepoConfig, packageSetSpecs map[string][]rpmmd.PackageSpec, rng *rand.Rand) ([]osbuild.Pipeline, error) {
return gcePipelinesRhel86(t, getDefaultGceByosImageConfig(), customizations, options, repos, packageSetSpecs, rng)
}
func getDefaultGceRhuiImageConfig() *distro.ImageConfig {
defaultGceRhuiImageConfig := &distro.ImageConfig{
RHSMConfig: map[distro.RHSMSubscriptionStatus]*osbuild.RHSMStageOptions{
distro.RHSMConfigNoSubscription: {
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
},
},
},
}
defaultGceRhuiImageConfig = defaultGceRhuiImageConfig.InheritFrom(getDefaultGceByosImageConfig())
return defaultGceRhuiImageConfig
}
// GCE RHUI image
func gceRhuiPipelines(t *imageTypeS2, customizations *blueprint.Customizations, options distro.ImageOptions, repos []rpmmd.RepoConfig, packageSetSpecs map[string][]rpmmd.PackageSpec, rng *rand.Rand) ([]osbuild.Pipeline, error) {
return gcePipelinesRhel86(t, getDefaultGceRhuiImageConfig(), customizations, options, repos, packageSetSpecs, rng)
}

File diff suppressed because one or more lines are too long

View file

@ -96,6 +96,7 @@
"x86_64": [
"ami",
"gce",
"gce-rhui",
"openstack",
"tar",
"qcow2",

File diff suppressed because one or more lines are too long