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

[RHEL-9] Drop RHSM and RHUI-specific config from Azure and EC2 images (COMPOSER-2308) #857

Merged
merged 12 commits into from
Sep 17, 2024
Merged
3 changes: 0 additions & 3 deletions pkg/distro/rhel/rhel9/distro.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,6 @@ func newDistro(name string, major, minor int) *rhel.Distribution {
},
mkEC2ImgTypeAarch64(rd.OsVersion(), rd.IsRHEL()),
)

// add GCE RHUI image to RHEL only
x86_64.AddImageTypes(gceX86Platform, mkGCERHUIImageType())
}

rd.AddArches(x86_64, aarch64, ppc64le, s390x)
Expand Down
1 change: 0 additions & 1 deletion pkg/distro/rhel/rhel9/distro_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,6 @@ func TestArchitecture_ListImageTypes(t *testing.T) {
"edge-ami",
"edge-vsphere",
"gce",
"gce-rhui",
"tar",
"image-installer",
"oci",
Expand Down
64 changes: 2 additions & 62 deletions pkg/distro/rhel/rhel9/gce.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package rhel9

import (
"github.com/osbuild/images/internal/common"
"github.com/osbuild/images/pkg/customizations/subscription"
"github.com/osbuild/images/pkg/distro"
"github.com/osbuild/images/pkg/distro/rhel"
"github.com/osbuild/images/pkg/osbuild"
Expand All @@ -25,6 +24,7 @@ func mkGCEImageType() *rhel.ImageType {
[]string{"archive"},
)

it.NameAliases = []string{"gce-rhui"}
kingsleyzissou marked this conversation as resolved.
Show resolved Hide resolved
// The configuration for non-RHUI images does not touch the RHSM configuration at all.
// https://issues.redhat.com/browse/COMPOSER-2157
it.DefaultImageConfig = baseGCEImageConfig()
Expand All @@ -37,30 +37,6 @@ func mkGCEImageType() *rhel.ImageType {
return it
}

func mkGCERHUIImageType() *rhel.ImageType {
it := rhel.NewImageType(
"gce-rhui",
"image.tar.gz",
"application/gzip",
map[string]rhel.PackageSetFunc{
rhel.OSPkgsKey: gceRhuiPackageSet,
},
rhel.DiskImage,
[]string{"build"},
[]string{"os", "image", "archive"},
[]string{"archive"},
)

it.DefaultImageConfig = defaultGceRhuiImageConfig()
it.KernelOptions = gceKernelOptions
it.DefaultSize = 20 * common.GibiByte
it.Bootable = true
// TODO: the base partition table still contains the BIOS boot partition, but the image is UEFI-only
it.BasePartitionTables = defaultBasePartitionTables

return it
}

func baseGCEImageConfig() *distro.ImageConfig {
ic := &distro.ImageConfig{
Timezone: common.ToPtr("UTC"),
Expand Down Expand Up @@ -156,33 +132,6 @@ func baseGCEImageConfig() *distro.ImageConfig {
return ic
}

func defaultGceRhuiImageConfig() *distro.ImageConfig {
ic := &distro.ImageConfig{
RHSMConfig: map[subscription.RHSMStatus]*subscription.RHSMConfig{
subscription.RHSMConfigNoSubscription: {
SubMan: subscription.SubManConfig{
Rhsmcertd: subscription.SubManRHSMCertdConfig{
AutoRegistration: common.ToPtr(true),
},
Rhsm: subscription.SubManRHSMConfig{
ManageRepos: common.ToPtr(false),
},
},
},
subscription.RHSMConfigWithSubscription: {
SubMan: subscription.SubManConfig{
Rhsmcertd: subscription.SubManRHSMCertdConfig{
AutoRegistration: common.ToPtr(true),
},
// do not disable the redhat.repo management if the user
// explicitly request the system to be subscribed
},
},
},
}
return ic.InheritFrom(baseGCEImageConfig())
}

func gceCommonPackageSet(t *rhel.ImageType) rpmmd.PackageSet {
ps := rpmmd.PackageSet{
Include: []string{
Expand Down Expand Up @@ -264,16 +213,7 @@ func gceCommonPackageSet(t *rhel.ImageType) rpmmd.PackageSet {
return ps
}

// GCE BYOS image
// GCE image
func gcePackageSet(t *rhel.ImageType) rpmmd.PackageSet {
return gceCommonPackageSet(t)
}

// GCE RHUI image
func gceRhuiPackageSet(t *rhel.ImageType) rpmmd.PackageSet {
return rpmmd.PackageSet{
Include: []string{
"google-rhui-client-rhel9",
},
}.Append(gceCommonPackageSet(t))
}