Commit Graph

24 Commits

Author SHA1 Message Date
Francesco Giudici 97db17d73b
make linter happy - update copyright dates (#899)
Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2025-01-31 15:33:47 +01:00
Andrea Mazzotti cf1a2d6400
Do not include Config to MachineRegistration as pointer (#870)
Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-10-17 08:09:41 +02:00
Fredrik Lönnegren 2bd467f301
Allow cross build of seed-image ISOs (#728)
* Allow cross build of seed-image ISOs

This commit makes use of the targetPlatform field on the seedImage spec
to allow building ISOs for different architectures.

It does this by spawning the initContainer using the seedImageBuilder
image and using the `elemental pull-image --platform=` command to
download the correct ISO and copies it to the attached volume.

One drawback of this approach is we don't get the caching of images in
the container runtime that we get when building natively.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2024-05-16 16:02:39 +02:00
Fredrik Lönnegren da0776b710 Update copyright year (2024)
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2024-01-05 13:14:27 +01:00
Fredrik Lönnegren c2992e8253 Add target platform validation test
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2023-12-21 13:10:38 +01:00
Fredrik Lönnegren c546933825
Build raw disk images in SeedImage (#557)
* feat: Add Type field to SeedImageSpec

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

* feat: Add raw disk build generation to SeedImage

If SeedImageSpec.Type is set to 'raw' we now try to run elemental
build-disk to generate the disk image.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

* Add elemental-toolkit to seedimage-builder

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

* feat: Update yip to v1.4.5

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

* feat: Reset yaml

Add yip cloud-config for raw disk-image that will extract the
elemental-register configuration to /oem/registration/config.yaml and
Start the elemental-register-install.service in the post-reset hook.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

* feat: Use new toolkit param deploy-command

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

---------

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2023-11-20 17:28:09 +01:00
Loic Devulder e1c8de2453 ci: fix SeedImage builder used image
Signed-off-by: Loic Devulder <ldevulder@suse.com>
2023-11-02 10:36:10 +01:00
Fredrik Lönnegren caa63f883c Keep old output-name
When a seedimage resource is reconciled the output-name should stay the
same since it's mounted into a pod and the pod will not pick up changes
automatically.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2023-10-26 12:30:11 +02:00
Fredrik Lönnegren b998a98ffb
Bring your own SeedImage builder (#542)
* Bring your own SeedImage builder

This commit adds functionality to define which build-image to use for a
SeedImage. If no build-image is provided the default one is used.

The BuildContainer only takes Name, Image, ImagePullPolicy, Args and
Command in order to limit what the user is able to do.

The user-defined build container will also mount a ConfigMap with
environment variables for device, base-image, registration-url and
ISO output-name.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

* feat: Add Size to SeedImageSpec

Size is used to calculate ephemeral resource requests when building the
seed-image.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2023-10-25 13:54:34 +00:00
David Cassany b32d690c8d Remove use of images from quay.io
Signed-off-by: David Cassany <dcassany@suse.com>
2023-10-25 12:17:13 +02:00
David Cassany 3eec04eaca Small refactor to centralize registration config checks
Signed-off-by: David Cassany <dcassany@suse.com>
2023-09-12 16:21:07 +02:00
Francesco Giudici d53eb7ccbb SeedImage: isolate all the config map logic in a separate function
Move the checks of the config map containing the registration data in
the createConfigMapObject() function (renamed to
reconcileConfigMapObject().
Moreover, while there, check the data included in the config map: if it
is no more up-to-date, rebuild the config map.

Fixes #456

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2023-05-26 15:54:10 +02:00
David Cassany 8267808c14 Add tests for containerized base ISO and utilities
Signed-off-by: David Cassany <dcassany@suse.com>
2023-04-21 11:28:02 +02:00
Francesco Giudici 98c5692306 SeedImage: add more seedimage_controller tests
Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2023-04-18 15:31:27 +02:00
David Cassany Viladomat f4f34ca948
Use config map in seedimage pod (#423)
* Add client registration config utility
* Use a config-map for the seed-image pod
* Allow ConfigMaps manipulation in SeedImage RBAC
* Drop configmap-uid annotation
* go mod tidy
* Adapt tests
* Add createConfigMapObject tests

Signed-off-by: David Cassany <dcassany@suse.com>
2023-04-14 18:51:21 +02:00
Francesco Giudici d7fd814a8b SeedImage: check OwnerReference in controller tests
Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2023-04-14 09:45:40 +02:00
Francesco Giudici 6b1522e4c9 SeedImage: retrieve MachineRegistration just once
Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2023-04-14 09:45:40 +02:00
Francesco Giudici 7ce551c2a5 SeedImage: set build image PullPolicy from the operator chart
Fixes #406

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2023-04-11 12:55:51 +02:00
Francesco Giudici b291e276bb SeedImage: pass the build image from the operator chart
Also, change the default image to the one build with Docker.seedimage.

The expected image should have the following binaries available:
- xorriso
- curl
- base64

The image should also have as the default entrypoint an http server
starting on port 80 serving files from the working dir.

Related to:
https://github.com/rancher/elemental-operator/issues/374

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2023-03-28 10:07:35 +02:00
Fredrik Lönnegren 04747a6b6a
Add cloud-config support to seedImage (#399)
* Add cloud-init support to seedImage

This commit adds a field to the SeedImage Spec for a cloud-config that
will be included in the built ISO.

If the cloud-config field is not set an empty file will be added to the
ISOs iso-config dir.

The reconciliation will take place in case the cloud-config is changed
and the base64 encoded value is used in an annotation in order to see if
the value has changed.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

* Linting

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

* Add seedImage unit-tests

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

---------

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2023-03-23 09:36:36 +01:00
Francesco Giudici 1e90590e34 SeedImage: drop finalizer tests
We recently dropped the finalizers as the child resources are properly
tracked through owner references and correcly cleaned up.
Drop tests checking the finalizers and their deletion routines.

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2023-03-15 09:40:29 +01:00
Francesco Giudici fd93dec76e SeedImage: add more tests
Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2023-03-15 09:40:29 +01:00
David Cassany e413e23f75 Adapt tests to drop finalizers
Signed-off-by: David Cassany <dcassany@suse.com>
2023-03-14 15:48:49 +01:00
Francesco Giudici 3f0e357b85
operator: add SeedImage CRD (#377)
* operator: add SeedImage CRD and controller

* SeedImage: add Ready condition to track resource status

* SeedImage: add Pod and Service creation in the reconcile loop

* SeedImage: manage Pod lifecycle and set the download URL

* SeedImage: allow the pod to fail if something goes wrong

* SeedImage: add SeedImageReady condition

* SeedImage: improve status condition updates

* SeedImage: add controller tests

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2023-03-10 18:11:10 +01:00