Skip to content

distro: make "rhel-10" a generic distro (HMS-8743) - #1577

Merged
mvo5 merged 12 commits into
osbuild:mainfrom
mvo5:yaml-imageconfig-16
Jul 8, 2025
Merged

mvo5 merged 12 commits into
osbuild:mainfrom
mvo5:yaml-imageconfig-16

Conversation

@mvo5

@mvo5 mvo5 commented Jun 2, 2025 •

Copy link
Copy Markdown
Contributor

This PR makes "rhel-10" a generic distro that is fully defined in YAML.


// checkOptions checks the validity and compatibility of options and customizations for the image type.
// Returns ([]string, error) where []string, if non-nil, will hold any generated warnings (e.g. deprecation notices).
func checkOptions(t *rhel.ImageType, bp *blueprint.Blueprint, options distro.ImageOptions) ([]string, error) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This needs double checking that really all options are ported over to "generic"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We currently do not port the checks UnsupportedPartitioningModes - this is only needed in rhel-9,8, when we port the images to the generic distro this will happen there.

@mvo5
mvo5 force-pushed the yaml-imageconfig-16 branch from 8988b5a to 787bd9e Compare June 5, 2025 07:42

- &rhel10
name: "rhel-{{.MajorVersion}}.{{.MinorVersion}}"
match: "rhel-10.[0-9]{,[0-9]}"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fwiw, once we move rhel-9 into a generic distro we will need to be able to parse rhel-910 and rhel-98 style versions too for backward compat. For rhel-10 this parsing was dropped.

@ondrejbudai ondrejbudai changed the title distro: make "rhel-10" a generic distro distro: make "rhel-10" a generic distro (HMS-8743) Jun 25, 2025
@mvo5
mvo5 force-pushed the yaml-imageconfig-16 branch 2 times, most recently from 8e0468d to e83e4ae Compare June 30, 2025 16:32
@mvo5
mvo5 marked this pull request as ready for review June 30, 2025 16:32
@mvo5
mvo5 requested a review from a team as a code owner June 30, 2025 16:32
@mvo5
mvo5 requested review from achilleas-k, supakeen and thozza June 30, 2025 16:32
achilleas-k
achilleas-k previously approved these changes Jul 1, 2025

@achilleas-k achilleas-k left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🎉

Comment thread pkg/distro/defs/fedora/distro.yaml Resolved
Comment thread pkg/distro/generic/images.go Outdated
Comment on lines +597 to +602
// Put the kickstart file in the root of the iso, some image
// types (like rhel10/image-installer) put them there, some
// others (like fedora/image-installer) do not and because
// its not uniform we need to make it configurable.
// XXX: unify with rhel-11 ? or rhel-10.x?
img.ISORootKickstart = t.ISORootKickstart

@achilleas-k achilleas-k Jul 1, 2025 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Even in Fedora we put it in the root when we want the installation to be non-interactive. IIRC, the reason we do this is because the correct way to set default values for Anaconda is in /usr/share/anaconda/interactive-defaults.ks, but you can't configure a fully automated installation with that file.

So we can:

  • Use the same logic in both Fedora and RHEL, though this might be considered a breaking change for RHEL users who modify the kickstart file after building one of our ISOs.
  • Always put the kickstart file in the root. This is what we used to do, but were asked to use interactive-defaults in Fedora (my memory is not 100% clear on this).
  • Use profiles for setting defaults, which we wanted to do at some point but never got around to it.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If people expect to be able to alter the kickstart it should be in the root of the iso, this makes it easy to use mkksiso to change them. Putting them into the installer root filesystem makes it much more difficult to make changes once the iso is built. Were these kickstarts incomplete? Anaconda used to support that, allowing the user to fill in missing details like the disk they wanted to install to.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the extra context! I'm not sure if there is anything actionable for me here though, should I file an issue or do a followup ? It seems necessary to keep things as they are if changing is considered a breaking change in rhel, so the first opportunity for this would be rhel-11 I guess(?).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Were these kickstarts incomplete? Anaconda used to support that, allowing the user to fill in missing details like the disk they wanted to install to.

Sometimes they are, yes. Right now users can write their own kickstart in the blueprint, so we make no assumptions for its completeness or what they want to do with it after the build.

Thanks for the extra context! I'm not sure if there is anything actionable for me here though, should I file an issue or do a followup ?

Don't change anything for now. But we should revisit this.

Comment thread pkg/distro/defs/loader_test.go Resolved
Comment thread pkg/distro/defs/loader.go Outdated
if err != nil {
return nil, err
}
var buf bytes.Buffer

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think this should also check for an empty vendor string, if that were to happen the UEFI files would end up in the wrong place in the EFI directory.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I added support for this (in its own commit). Its slightly roundabout, see the commit message but I think its a reasonable approach, i.e. it will only error if {{.DistroVendor}} is used in a template but unset (but as always feedback welcome, maybe I was overthinking this).

@bcl bcl left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks excellent, just one teeny typo and checking for empty uefi vendor strings.

@mvo5
mvo5 force-pushed the yaml-imageconfig-16 branch 2 times, most recently from 60d8ec6 to 9b6cd04 Compare July 2, 2025 07:54
@bcl
bcl self-requested a review July 2, 2025 15:42
bcl
bcl previously approved these changes Jul 2, 2025

@bcl bcl left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks good to me, but now it has a conflict :)

@thozza thozza left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks.

I've added a few comments in-line, but in general, this looks good.

Comment thread pkg/distro/defs/loader.go Resolved
Comment thread pkg/distro/generic/images.go Resolved
Comment thread pkg/distro/defs/loader.go Resolved
Comment thread pkg/distro/defs/loader.go Resolved
Comment thread pkg/distro/generic/imagetype.go Resolved
@mvo5
mvo5 force-pushed the yaml-imageconfig-16 branch 3 times, most recently from d604c79 to 5595ed3 Compare July 3, 2025 10:47
Comment thread pkg/distro/generic/imagetype.go Resolved
mvo5 added 9 commits July 7, 2025 16:13
This commit adds:
- default_kernel_name
- rhsm_facts
- subscriptions
- rhsm_config
- no_bls
For rhel based distros we need more flexibility when it
comes to format the ISO label, so this commit adds the
full `distro.ID` to the `getISOLabelFunc()` helper.
Some image types (like rhel10/image-installer) put the
kickstart files into the root of the ISO, some
others (like fedora/image-installer) do not and because
its not uniform we need to make it configurable.

It would be nice if we could unify this for rhel-11
or even rhel-10.x?
For centos we need a way to exclude certain image types. We
have various options here, one is to put it into the image
types and the other to make it a property of the distro.

This commit makes it a propery of the distro because this
way the image-types are easier to reuse, i.e. when something
like "alma" is added we do not need to worry about changing
all our image types and external consumers can also define
it on the outside.
The uefi vendor need to be adjust for each distro, allow to
define it in the distros.yaml and use a template in the
platforms to allow this.
This commit makes rhel-10 a generic distro.
This commit ensures that we error if the `{{.DistroVendor}}`
template is used in a platform definition but the coresponding
`vendor:` attribute is not set in the `distros.yaml` yaml
definition of the distro.

We need to do it in a slightly roundabout way because:
a) not all distros set vendor (e.g. fedora just hardcodes it)
b) not all platforms need uefi

So we use the feature `missingkey=error` of text/template and
set the DistroVendor in the struct only if its actually
set in DistroYAML. This ensures that the template execution
fails if the template is used by the user has not set it.

Thanks to Brian!
This commit tweaks the `distro.InstallConfig` base on feedback
from Tomáš (thanks!):
1. move KickstartUnattendedExtraKernelOpts into InstallerConfig
2. move ISORootKickstart into InstallerConfig
3. allow to have InstallerConfig defaults, this requires that
   we can inherit similar to ImageConfig.

As part of the work the `ImageConfig.InheritFrom()` is
extracted as a generic helper and used in both
`ImageConfig.InheritFrom()` and
`InstallerConfig.ImageConfig.InheritFrom()`

The other nice benefit from this work is that need (much)
less duplication in our `installer_config:` conditions
because we now only need to override the specific parts
we want to change instead of replacing the full config.
achilleas-k
achilleas-k previously approved these changes Jul 7, 2025
kingsleyzissou
kingsleyzissou previously approved these changes Jul 7, 2025
@mvo5
mvo5 requested a review from thozza July 8, 2025 06:22
thozza
thozza previously approved these changes Jul 8, 2025

@thozza thozza left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There's just one addition that I'm not sure about; the rest looks great. Thanks for all the changes, such as moving options to InstallerConfig and implementing shallow merge for it.

I'm not sure if we still support regular "override" operation for any other structures. If not, we may need to fix the docs that you've recently added.

Comment thread pkg/manifest/manifest.go Resolved
Unfortunately there is a bunch of knowledge in the `manifest`
package about distro versions. We should fix this but for
now we just accept the status-quo and provide a mechanism
for each "generic" distro to declare that it is similar to
"rhel-$ver" or "fedora" etc.
@mvo5
mvo5 dismissed stale reviews from thozza, kingsleyzissou, and achilleas-k via 25b8c91 July 8, 2025 08:18
@mvo5
mvo5 force-pushed the yaml-imageconfig-16 branch from 5618bef to 25b8c91 Compare July 8, 2025 08:18
@mvo5
mvo5 requested review from achilleas-k and thozza July 8, 2025 08:19

@thozza thozza left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

😍

@mvo5
mvo5 enabled auto-merge July 8, 2025 11:38
@mvo5
mvo5 added this pull request to the merge queue Jul 8, 2025
Merged via the queue into osbuild:main with commit cfd2c46 Jul 8, 2025
@mvo5
mvo5 deleted the yaml-imageconfig-16 branch July 8, 2025 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants