Commit graph

597 commits

Author SHA1 Message Date
Tomas Hozza
6ffe63442e RHEL-85: add gce image type
Add the `gce` image type intended for Google Compute Engine. The image
is BYOS - bring your own subscription and requires registering in order
to access Red Hat content.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
0219ad1f43 RHEL-86: 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>
2022-04-14 19:07:31 +01:00
Tomas Hozza
db75c39c4d RHEL-86: add gce image type
Add the `gce` image type intended for Google Compute Engine. The image
is BYOS - bring your own subscription and requires registering in order
to access Red Hat content.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
5d27b7c784 RHEL-90: add gce image type
Add the `gce` image type intended for Google Compute Engine. The image
is BYOS - bring your own subscription and requires registering in order
to access Red Hat content.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
800d57fda8 Extend ImageConfig and RHEL-86/90 osPipeline
Extend `ImageConfig` and RHEL-86/90 `osPipeline` with the following
configuration options:
 - DNF Automatic configuration
 - YUM / DNF repositories
 - Firewall configuration

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
01b94a5787 RHEL-85: introduce tarArchivePipeline()
Introduce `tarArchivePipeline()` function returning a pipeline,
which creates a Tar archive from another pipeline tree referenced by the
pipeline name.

Replace `tarStage()` with `osbuild.NewTarStage()`

Use the `tarArchivePipeline()` function in respective image type
pipelines.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
4ca2e64613 RHEL-86: introduce tarArchivePipeline()
Introduce `tarArchivePipeline()` function returning a pipeline, which
creates a Tar archive from another pipeline tree referenced by the
pipeline name.

Replace `tarStage()` with `osbuild.NewTarStage()`

Use the `tarArchivePipeline()` function in respective image type
pipelines.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
b29d64c496 RHEL-90: introduce tarArchivePipeline()
Introduce `tarArchivePipeline()` function returning a pipeline, which
creates a Tar archive from another pipeline tree referenced by the
pipeline name.

Replace `tarStage()` with `osbuild.NewTarStage()`

Use the `tarArchivePipeline()` function in respective image type
pipelines.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Christian Kellner
e673b12957 rhel85: specify a minimum root file system size
Specify a size for the root filesystem in the partition table,
which basically equates to a minimum size. In reality all image
types specify a larger image size and thus we enlarge the root
file system to more than the specified size for plain layouts.
Does not change any existing manifests.
This also prepares the enablement of auto-LVM conversion, since
in that case we need to have a size for the root file system
specified.
2022-04-11 15:27:15 +02:00
Tomas Hozza
01880a76a2 RHEL(85+): move qemuStageOptions() from distros to osbuild2
De-duplicate the `qemuStageOptions()` implementation from many distro
implementations and move it to the `osbuild2` package as
`NewQEMUStageOptions()`.

Adjust all affected pipeline implementations.

The `NewQEMUStageOptions()` function takes an optional format-specific
options argument, instead of a dedicated format-specific options (the
previously used qcow2 compat version). This is a preparation to produce
VMDK images with a different than default subformat.

Add unit test for `NewQEMUStageOptions()`.
2022-04-07 13:48:54 +02:00
Tomas Hozza
8697713ce8 osbuild2: rename Qcow2Options -> QCOW2Options
Make the format type options structure naming consistent.
2022-04-07 13:48:54 +02:00
Tomas Hozza
0e512e97d2 osbuild2: use aliased type for QEMU format, instead of string
Define a new aliased type `QEMUFormat` for the format type used by the
osbuild2 QEMU stage and define constants for all allowed values.

Use QEMU format type constants in all relevant places, instead of string
literals. Not using string literals minimizes the room for making a
typo.
2022-04-07 13:48:54 +02:00
Christian Kellner
aaee939f9b distro/rhel86: enable auto-registration for azure
We want to ensure that cloud images connect to Red Hat[1] independently
of how the content was acquired (PAYG, BYOS, or marketplace).
This auto-registration feature is already enabled for AWS and this
patch enables it for Azure with the same recommended settings:

Services:
  rhsmcertd: Enabled (already done, so not changed in the patch)

/etc/rhsm/rhsm.conf:
  auto_registration: enabled
  auto_registration_interval: 60 (the default, so not explicitly set)
  manage_repos: false

The latter value `manage_repos` is left enabled (the default) in case
the user explicitly requested to have the system subscribed, i.e. the
`RHSMConfigWithSubscription` code path.

Regenerate the relevant test manifests and image information.

[1] https://cloud.redhat.com
[2] https://docs.google.com/document/d/1VeZFJxNUlyZMQJh6s3NA3RLvadqATsGxVet6uuP87_4
2022-04-06 22:40:01 +02:00
Achilleas Koutsou
23d4281349 rhel84: panic if kernel not defined in installer 2022-04-06 12:09:09 +02:00
Achilleas Koutsou
a76f7a64dc distro: rename tarInstaller vars to imageInstaller
The image type is only ever known (externally) as image-installer.
Renaming the internal variables and functions to reflect the name makes
the code easier to navigate.
2022-04-06 12:09:09 +02:00
Achilleas Koutsou
8316cf7ef0 rhel85: enable anaconda users module in installers
The users anaconda module enables users to create user accounts at
install time if one is not already created in the payload.  This is
required for the cloud API (Image Builder service) for the image
installer where user customizations are not supported.  Without it, user
creation isn't possible on the installed system.

The module also enables user creation at install time through the
kickstart file for both the image-installer and the edge-installer
(Anaconda only).
Therefore, for the image-installer, the users and groups are no longer
created as part of the payload.

This commit adapts the changes from the following commits (originally
made in the RHEL 8.6 and RHEL 9.0 distros) to the rest of the RHEL
distro definitions:
ebc3330cbd
5825294dad
2022-04-06 12:09:09 +02:00
Achilleas Koutsou
b0f7ff7c31 distro/rhel85,rhel90beta: change osPipeline() args
Pass in the image type and remove the three args (enabledServices,
disabledServices, and defaultTarget) that can be obtained from it.
2022-04-06 12:09:09 +02:00
Achilleas Koutsou
7236212d63 distro: deduplicate anacondaStageOptions() in RHEL pipelines
Use single NewAnacondaStageOptions() from osbuild2 instead of
implementing in each distro.

Followup from 974b0a434b, copied to the
rest of the RHEL distro definitions.
2022-04-06 12:09:09 +02:00
Achilleas Koutsou
3d53ca5d8d distro: deduplicate *kickstartStageOptions()
Use single NewKickstartStageOptions() and replace image-type-specific
implementation from each distro.
- Followup from cb186df208, copied to the
  rest of the RHEL distro definitions.

NB: The change was not made in the Fedora distro definitions as they are
    currently being rewritten.
2022-04-06 12:09:09 +02:00
Achilleas Koutsou
42364f2cc6 distro: deduplicate groupStageOptions() in RHEL pipelines
Use single NewGroupsStageOptions() from osbuild1 and osbuild2 instead of
implementing in each distro.
- Followup from 2eef6e6e2d, copied to the
  rest of the RHEL distro definitions.
- Added NewGroupsStageOptions() to osbuild1 for rhel8 and rhel84.

NB: The change was not made in the Fedora distro definitions as they are
    currently being rewritten.
2022-04-06 12:09:09 +02:00
Achilleas Koutsou
333bec57ef distro: deduplicate userStageOptions() in RHEL pipelines
Use single NewUsersStageOptions() from osbuild1 and osbuild2 instead of
implementing in each distro.
- Followup from ca8b371142, copied to the
  rest of the RHEL distro definitions.
- Added NewUsersStageOptions() to osbuild1 for rhel8 and rhel84.

NB: The change was not made in the Fedora distro definitions as they are
    currently being rewritten.
2022-04-06 12:09:09 +02:00
Achilleas Koutsou
15243f1dc5 distro: allow user and group customizations for edge-installer
Followup from, f34380d5b5 and
3a1765a5a8, copied to the rest of the RHEL
distro definitions.

For now, these customizations have no effect on the manifest.

The new `with-users` variants of the edge-installer test cases include
the user customizations in the blueprint, but the manifests are
(currently) the same as the corresponding base cases.
2022-04-06 12:09:09 +02:00
Tomas Hozza
c9a08da29f Move rpmStageOptions() from stage_options.go to osbuild2
Deduplicate the `rpmStageOptions()` function implemented in every distro
`stage_options.go` to `osbuild2` package.

RHEL-8.4 and code using osbuild v1 manifests are not touched.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-04 13:27:42 +02:00
Tomas Hozza
c6507c21b9 distro: add cloud-init to VMDK image on RHEL-85/86/90
Install `cloud-init` by default on the VMDK image on RHEL-85/86/90 and
as a result also CentOS Stream 8/9.

Regenerate image test cases.

Signed-off-by: Tomas Hozza <thozza@redhat.com>

test cases fixup
2022-04-02 08:47:02 +01:00
Christian Kellner
61c1ccff21 distro/rhel90: ensure grub2.Config.Default is preserved
The `grub2.Config.Default` key is owned by `NewGrub2StageOptionsUnified`
and thus needs to be preserved in case there is a `Grub2Config` setting
present in the image configuration (`ImageConfig`).
2022-03-29 11:43:54 +02:00
Christian Kellner
55b7b82714 distro/rhel86: ensure grub2.Config.Default is preserved
The `grub2.Config.Default` key is owned by `NewGrub2StageOptions`
and thus needs to be preserved in case there is a `Grub2Config`
setting present in the image configuration (`ImageConfig`).
2022-03-29 11:43:54 +02:00
Christian Kellner
96411158e6 distro/rhel90beta: ensure grub default is not set
A future change to `NewGrub2StageOptions` will result in a change of
`Config.Default` to `saved` if a kernel is set. Preserve the current
behavior by manually resetting it to the empty string.
2022-03-29 11:43:54 +02:00
Christian Kellner
111cd8871f distro/rhel85: ensure grub default is not set
A future change to `NewGrub2StageOptions` will result in a change of
`Config.Default` to `saved` if a kernel is set. Preserve the current
behavior by manually resetting it to the empty string.
2022-03-29 11:43:54 +02:00
Achilleas Koutsou
5825294dad distro/rhel86+90: enable the anaconda user modeule for image-installer
Enable the user module unconditionally for the image-installer:
- If users are specified for the kickstart file, the module is required
  to set up the users.
- If no users are specified, the module can be used at install time to
  create users.

Updated relevant test cases (manifests).
2022-03-28 14:08:57 +02:00
Achilleas Koutsou
ebc3330cbd distro/rhel86+90: don't create users in the payload for image-installer
Users are created at install time now.
2022-03-28 14:08:57 +02:00
Achilleas Koutsou
974b0a434b osbuild2: deduplicate anacondaStageOptions()
Use single NewAnacondaStageOptions() from osbuild2 instead of
implementing in each distro.

The new function conditionally adds the user module when there are users
that need to be created at install time (image- and edge-installers).
2022-03-28 14:08:57 +02:00
Achilleas Koutsou
cb186df208 obsuild2: deduplicate *kickstartStageOptions()
Use single NewKickstartStageOptions() and replace image-type-specific
implementations from each distro.
2022-03-28 14:08:57 +02:00
Achilleas Koutsou
2eef6e6e2d osbuild2: deduplicate groupStageOptions()
Use single NewGroupsStageOptions() from osbuild2 instead of implementing
in each distro.

The new function does not set the Group.Name field anymore.  The field
does not exist in the osbuild schema and was silently ignored.
The field in the stage has been marked 'omitempty' and the relevant
manifests have been updated.
2022-03-28 14:08:57 +02:00
Achilleas Koutsou
ca8b371142 osbuild2: deduplicate userStageOptions()
Use single NewUsersStageOptions() from osbuild2 instead of implementing
in each distro.
2022-03-28 14:08:57 +02:00
Achilleas Koutsou
db2910fed9 distro/rhel86+90: common error message for unsupported customizations
Use the same error message for both edge-installer and
edge-simplified-installer when an unsupported customization is added.
2022-03-28 14:08:57 +02:00
Achilleas Koutsou
3a1765a5a8 distro/rhel90: allow user and group customizations for edge-installer 2022-03-28 14:08:57 +02:00
Achilleas Koutsou
f34380d5b5 distro/rhel86: allow user and group customizations for edge-installer 2022-03-28 14:08:57 +02:00
Antonio Murdaca
66bc1e8b85 rhel8/9: fix path to fdo diun root certificates
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2022-03-24 18:23:39 +01:00
Tomas Hozza
2ec55b4c53 RHEL-90: use XBOOTLDR partition GUID for /boot
Use the Extended Bootloader Partition GUID for `/boot`, instead of the
Linux filesystem data GUID. This is useful for autodetection of a
partition purpose based on its GUID without reading the `/etc/fstab`
first.

Ensure that when creating mountpoints, e.g. when converting the
partitions layout to LVM, the `/boot` partition get the proper GUID
assigned.

Regenerate RHEL-90 and centos-9 image test cases.

Related to https://bugzilla.redhat.com/show_bug.cgi?id=2057231
2022-03-24 15:40:10 +01:00
Antonio Murdaca
5f2ad326a6 internal/distro/rhel{86,90}: drop console kargs from raw image deployment
Using the simplified installer we were experiencing slow system boots.
Turns out we're incurring into https://bugzilla.redhat.com/show_bug.cgi?id=1839923
This patch just drops the console kargs - to be aligned with the
anaconda installer that doesn't experience this slow down.
The slow down doesn't happen on virtual machines as there's always a
ttyS0 there

Signed-off-by: Antonio Murdaca <runcom@linux.com>
2022-03-14 17:31:40 +01:00
Christian Kellner
923a627de4 distro/rhel86: set GPGKeyFiles for azure-rhui
Import the appropriate GPG keys for Red Hat contained in the package
`redhat-release` and Microsoft contained in `rhui-azure-rhel8`.
2022-03-05 21:04:24 +01:00
Christian Kellner
5b802f699a distro/rhel86: sync packages for azure-rhui
Sync the list of packages with the existing market place images.
2022-03-05 21:04:24 +01:00
Christian Kellner
320dcb0f9d distro/rhel86: update sysconfig options
Set `kernel-core` to be the defaul kernel instead of `kernel`.
2022-03-05 21:04:24 +01:00
Christian Kellner
e60517f0af distro/rhel86: remove authconfig call from azure-rhui
authconfig is actually a RHEL 7 thing and we should not call it for
RHEL 8.
2022-03-05 21:04:24 +01:00
Christian Kellner
dbd6f1f48c distro: add GPGKeyFiles option to ImageConfig
Add a new option `GPGKeyFiles` to ImageConfig that indicates which files
containing GPG keys should be imported into rpm. For now it will be used
by the osPipeline in rhel{86,90} to set the corresponding option in the
`org.osbuild.rpm` stage.
2022-03-05 21:04:24 +01:00
Antonio Murdaca
c1a896dd1d rhel{86,90}: define simplified installer build packages set
The edge installer and edge simplified installer build roots have
diverged, i.e. the latter need clevis/luks, so define a new pkg
set for the simplified installer extending the edge installer one.

Co-Authored-By: Christian Kellner <christian@kellner.me>
2022-02-28 23:05:45 +00:00
Tom Gundersen
973b5141b3 ditro/rhel86: set volid like in rhel9.0
This is only required in RHEL9.0, but best practice is to always pin these things
down. Also increases uniformity between distros.

Simplify a bit the volid generator by making it require `rand.Rand` rather than
`io.Reader`, and hence eliminating the need for error handling.
2022-02-28 23:05:45 +00:00
Antonio Murdaca
3be67ad965 Simplified installer: add support for encrypted raw images
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2022-02-28 23:05:45 +00:00
Christian Kellner
e921b7aadd rhel86: specify a minimum root file system size
Specify a size for the root filesystem in the partition table,
which basically equates to a minimum size. In reality all image
types specify a larger image size and thus we enlarge the root
file system to more than the specified size for plain layouts.
But if we auto-convert an partition layout to LVM we need a size
for the root partition.
Does not change any existing manifests.
This does not apply for ostree based systems like the simplified
installer.
2022-02-28 21:36:25 +01:00
Christian Kellner
63aa1556fc rhel86: automatically convert to LVM on fs customizations
Whenever we create a new mountpoint due to a user customization,
ensure the layout uses LVM, i.e. convert plain layouts to it, if
needed. It uses the existing lvm-ification code but enhances it
so that we also create a `/boot` partition in case it does not
yet exist.
Adjust the existing tests that assumed we can not create more
than 4 partitions on mbr layouts, since that is now not true
anymore.
2022-02-28 21:36:25 +01:00