Skip to content

WIP: move imageConfig into YAML (fedora, rhel-10) - #1462

Closed
mvo5 wants to merge 18 commits into
osbuild:mainfrom
mvo5:yaml-imageconfig-3
Closed

mvo5 wants to merge 18 commits into
osbuild:mainfrom
mvo5:yaml-imageconfig-3

Conversation

@mvo5

@mvo5 mvo5 commented Apr 24, 2025 •

Copy link
Copy Markdown
Contributor

This is a preview for moving ImageConfig into YAML - this code moves fedora and rhel10 to get a feel for what issue there are.

Some of the challenges we need to resolve:

  1. a bunch of missing custom unmarshallers custom types in YAML (smop)
  2. inconsistency in our osbuild options, most common is "snake_case", but we use many different other styles, including: ResourceDisk.Format, x11-keyboard and singular/plural is often a problem.
  3. in one case we put a variable "osVersion" into the imageConfig (sap.go). this is not directly mappable in yaml so we need a indirection here

But overall it is pretty straightforward.

JIRA: HMS-5284

mvo5 added 12 commits April 24, 2025 09:38
This is needed for the YAML-ification of image-config.
This commit adds a new `defs.ImageConfig()` to load per image
type specific image config loading. This allows to write:
```yaml
image_types:
  test_type:
    image_config:
      locale: "C.UTF-8"
      timezone: "DefaultTZ"
      condition:
        version_less_than:
          "2":
            timezone: "OverrideTZ"
```
This commit moves the `ImageConfig` of each package into the
distro.yaml.
We will need this in the osbuild package as well so move
it into a common place.
Move the rhel10 ImageConfig into YAML.
},
// E4S/EUS
//
// XXX: this must become a declrative option like

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 can/will be fixed once #1464 is merged

@schutzbot

Copy link
Copy Markdown
Collaborator

This PR changes the images API or behaviour causing integration failures with osbuild-composer. The next update of the images dependency in osbuild-composer will need work to adapt to these changes.

This is simply a notice. It will not block this PR from being merged.

mvo5 added a commit to mvo5/images that referenced this pull request Apr 28, 2025
This commit moves the `imageType.kernelOptions` option into
`distro.ImageConfig`. The rational is that when we move to
YAML we will need to be able to override the kernel options
based on various conditions.

Here is an example from mkMinimalRawImgType():
```go
if common.VersionGreaterThanOrEqual(d.osVersion, "43") {
	it.kernelOptions = []string{"rw"}
	}
```
The conditions will be implemented on the imageConfig but
having conditions when defining image types would be a
bit stange. The easiest fix is to move kernelOptions into
ImageConfig. Fwiw, I think conceptually it also makes
sense there so this is probably a worthwhile chage on
its own but it will make the YAML work in
osbuild#1462
easier.
mvo5 added a commit to mvo5/images that referenced this pull request Apr 28, 2025
This commit moves the `imageType.kernelOptions` option into
`distro.ImageConfig`. The rational is that when we move to
YAML we will need to be able to override the kernel options
based on various conditions.

Here is an example from mkMinimalRawImgType():
```go
if common.VersionGreaterThanOrEqual(d.osVersion, "43") {
	it.kernelOptions = []string{"rw"}
	}
```
The conditions will be implemented on the imageConfig but
having conditions when defining image types would be a
bit stange. The easiest fix is to move kernelOptions into
ImageConfig. Fwiw, I think conceptually it also makes
sense there so this is probably a worthwhile chage on
its own but it will make the YAML work in
osbuild#1462
easier.
mvo5 added a commit to mvo5/images that referenced this pull request Apr 28, 2025
This commit moves the `imageType.kernelOptions` option into
`distro.ImageConfig`. The rational is that when we move to
YAML we will need to be able to override the kernel options
based on various conditions.

Here is an example from mkMinimalRawImgType():
```go
if common.VersionGreaterThanOrEqual(d.osVersion, "43") {
	it.kernelOptions = []string{"rw"}
	}
```
The conditions will be implemented on the imageConfig but
having conditions when defining image types would be a
bit stange. The easiest fix is to move kernelOptions into
ImageConfig. Fwiw, I think conceptually it also makes
sense there so this is probably a worthwhile chage on
its own but it will make the YAML work in
osbuild#1462
easier.
mvo5 added a commit to mvo5/images that referenced this pull request Apr 29, 2025
When we move ImageConfig into YAML we will need support for
`SshdConfigConfig` as it is used in ImageConfig. This
commit adds this via the `UnmarshalYAMLviaJSON()` helper.

Split out from osbuild#1462
mvo5 added a commit to mvo5/images that referenced this pull request Apr 29, 2025
When we move ImageConfig into YAML we will need support for
`ModprobeStageOptions` as it is used in ImageConfig. This
commit adds this via the `UnmarshalYAMLviaJSON()` helper.

Split out from osbuild#1462
mvo5 added a commit to mvo5/images that referenced this pull request Apr 29, 2025
This commit moves the `imageType.kernelOptions` option into
`distro.ImageConfig`. The rational is that when we move to
YAML we will need to be able to override the kernel options
based on various conditions.

Here is an example from mkMinimalRawImgType():
```go
if common.VersionGreaterThanOrEqual(d.osVersion, "43") {
	it.kernelOptions = []string{"rw"}
	}
```
The conditions will be implemented on the imageConfig but
having conditions when defining image types would be a
bit stange. The easiest fix is to move kernelOptions into
ImageConfig. Fwiw, I think conceptually it also makes
sense there so this is probably a worthwhile chage on
its own but it will make the YAML work in
osbuild#1462
easier.
github-merge-queue Bot pushed a commit that referenced this pull request Apr 29, 2025
This commit moves the `imageType.kernelOptions` option into
`distro.ImageConfig`. The rational is that when we move to
YAML we will need to be able to override the kernel options
based on various conditions.

Here is an example from mkMinimalRawImgType():
```go
if common.VersionGreaterThanOrEqual(d.osVersion, "43") {
	it.kernelOptions = []string{"rw"}
	}
```
The conditions will be implemented on the imageConfig but
having conditions when defining image types would be a
bit stange. The easiest fix is to move kernelOptions into
ImageConfig. Fwiw, I think conceptually it also makes
sense there so this is probably a worthwhile chage on
its own but it will make the YAML work in
#1462
easier.
mvo5 added a commit to mvo5/images that referenced this pull request Apr 29, 2025
When we move ImageConfig into YAML we will need support for
`SshdConfigConfig` as it is used in ImageConfig. This
commit adds this via the `UnmarshalYAMLviaJSON()` helper.

Split out from osbuild#1462
mvo5 added a commit to mvo5/images that referenced this pull request Apr 29, 2025
When we move ImageConfig into YAML we will need support for
`ModprobeStageOptions` as it is used in ImageConfig. This
commit adds this via the `UnmarshalYAMLviaJSON()` helper.

Split out from osbuild#1462
github-merge-queue Bot pushed a commit that referenced this pull request Apr 30, 2025
When we move ImageConfig into YAML we will need support for
`SshdConfigConfig` as it is used in ImageConfig. This
commit adds this via the `UnmarshalYAMLviaJSON()` helper.

Split out from #1462
github-merge-queue Bot pushed a commit that referenced this pull request Apr 30, 2025
When we move ImageConfig into YAML we will need support for
`ModprobeStageOptions` as it is used in ImageConfig. This
commit adds this via the `UnmarshalYAMLviaJSON()` helper.

Split out from #1462
Comment thread pkg/distro/defs/loader.go
Exports []string
RequiredPartitionSizes map[string]uint64 `yaml:"required_partition_sizes"`

Platforms map[string]ImagePlatform

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.

Fww, this is wrong, platforms must be a list instead of a map[arch]ImagePlatform as it is defined here. We could have mutliple aarch64 images for example with different platform config/boot files etc

@mvo5

mvo5 commented May 9, 2025

Copy link
Copy Markdown
Contributor Author

Closing in favor of #1508

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.

2 participants