Commit Graph

68 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
Francesco Giudici a72970523a
SeedImage: fix description (#889)
Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2024-12-04 08:59:17 +01:00
Andrea Mazzotti ad150a8760
Add created date to the ManagedOSVersion common metadata fields (#886)
Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-11-28 15:06:26 +01:00
Andrea Mazzotti 6372ec6706
Only reset network if a network configurator is used (#874)
* Only reset network if a network configurator is used

Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-10-22 14:56:33 +02: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
Andrea Mazzotti ab193eca6f
Add support for agent-tls-mode Rancher setting (#863)
Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-10-07 13:11:26 +02:00
Andrea Mazzotti 3df501da73
Allow configuration of max snapshots during install (#851)
Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-09-25 13:31:29 +02:00
Francesco Giudici 198628f8fc
operator: add Registry to ManagedOSVersionChannels Spec (#831)
The new Registry field allows to prepend a common registry to the
image URLs of the embedded ManagedOSVersion resources.

Fixes #549

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2024-09-03 16:05:03 +02:00
Andrea Mazzotti 0899ba2953
Add SeedImage.status.checksumURL (#827)
Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-08-22 12:23:20 +02:00
Andrea Mazzotti 3de0fc7a47
Use after-install && after-reset stages to initialize system (#822)
* Use after-install && after-reset stages to initialize system

Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>

* Use dynamic CLOUD_INIT_PATHS

Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>

* Use IPAM driven network config on Recovery

Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>

---------

Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-08-20 13:39:45 +02:00
Andrea Mazzotti d857bda0cc
Implement Network Configurators (nmc, nmstate, nmconnections) (#819)
* Implement Network Configurators (nmc, nmstate, nmconnections)

Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-08-13 17:35:54 +02:00
Andrea Mazzotti 342bba265c
IPAM to nmstate network config (#793)
* operator: introduce support to IPAM assigned IP address

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>

* Add nmstate support

Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>

---------

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
Co-authored-by: Francesco Giudici <francesco.giudici@suse.com>
2024-08-09 10:32:19 +02:00
Andrea Mazzotti d280e61748
Implement Enabled field on ManagedOSVersionChannels (#800)
* Implement channel Enabled flag

Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-07-30 09:31:02 +02:00
Andrea Mazzotti b18ff86465
Add managedosversion finalizer (#775)
* Implement ManagedOSVersion controller and finalizer

Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>

* Remove unused ManagedOSVersion Status

Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
---------

Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
Co-authored-by: Francesco Giudici <francesco.giudici@gmail.com>
2024-06-25 17:24:53 +02:00
Andrea Mazzotti d07b4f5fde
Add toggle to automatically delete no longer in sync versions (#780)
Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-06-25 12:25:55 +02:00
Andrea Mazzotti abbc0eae31
Flag no longer in sync ManagedOSVersions (#750)
* Flag no longer in sync ManagedOSVersions

Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-06-12 15:40:03 +02:00
Andrea Mazzotti 8038dc6817
Add Metadata CRD (#712)
* Add Metadata CRD

Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-04-30 11:29:10 +02:00
Andrea Mazzotti 0839780db8
Sanitize elemental-operator dependencies (#690)
* Update system-upgrade-controller API

Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>

* Update Fleet API

Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>

* Sanitize dependencies

Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>

---------

Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-03-20 15:46:51 +01:00
Andrea Mazzotti 2ec3d21aa7
Fix ManagedOSImage cloudConfig (#671)
Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-03-14 17:07:32 +01:00
Andrea Mazzotti 83c8263cba
Align DrainSpec to system-upgrade-controller defaults (#668)
Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-03-12 16:31:15 +01:00
Andrea Mazzotti 1fc13844fe
Drain nodes by default on upgrade (#660)
* Drain nodes by default on upgrade

Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>

* Make DrainSpec nullable

Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>

---------

Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-03-11 14:52:51 +01:00
David Cassany 938bc9f101 Review omitempty flag on API json converter
This commit removes some omitempty flags in CRDs defintions
to make them more verbose and less confusing from the
user perspective.

Signed-off-by: David Cassany <dcassany@suse.com>
2024-03-07 12:10:03 +01:00
David Cassany Viladomat 483877487a
Make snapshotter configurable (#651)
* Make snapshotter configurable

This commit adds the snapshotter type as a new parameter in
installation struct, defaults to btrfs. This is passed as
an environment variable to the elemental client call. Any
client previous to v2 will simply ignore this flag.

* Make loopdevice an explicit default

Signed-off-by: David Cassany <dcassany@suse.com>
2024-03-06 15:59:47 +00:00
David Cassany Viladomat a1c173f03c
Make channel sync more robust (#638)
* Add a sync failure counter

This commit adds a channel sync failure counter to count the
number of consecutive sync failures. This logic is meant to
prevent creating and deleting a pod in case of errors (e.g.
unreachable download URL) in an infinite loop. After several
attempts to synchronize it will give up until the next
scheduled synchronization.


* Add syncedGeneration in status

This commit adds in managedOSVersionChannel status
the generation of the last synchronization attempt. This
is useful to prevent spurious reconciles to trigger an
unexpected sync and also to force immediate resync in case
of a channel update.


Signed-off-by: David Cassany <dcassany@suse.com>
2024-02-21 17:44:04 +01:00
Andrea Mazzotti 6c648b6faa
Test against k8s v1.27, rancher v2.8.2, and upgrade all test dependendencies (#628)
* Test against k8s v1.27, rancher v2.8.2, and upgrade all test dependencies

Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-02-15 13:02:07 +01: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 e3545e8b2c Add kubebuilder example and validation
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2023-12-21 13:10:38 +01:00
Fredrik Lönnegren ba56f153aa Add TargetPlatform to SeedImageSpec
TargetPlatform is used when building raw disk-images for other
platforms. An example being building rpi images on a cluster running on
x86_64 hardware.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2023-12-21 13:10:38 +01:00
Fredrik Lönnegren 74649a5ae2 Add disable-boot-entry flag to reset command
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2023-12-15 15:14:00 +01:00
Fredrik Lönnegren 8cf8b03e29
Implement picking dynamic installation device (#561)
* Add DeviceSelector types

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

* Implement device-selector

This commit adds the implementation for picking the installation device
during registration based on a deviceSelector in the
MachineRegistration.

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

---------

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2023-11-21 08:44:42 +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
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 64b15a6127 Patch already existing versions on channel sync
Signed-off-by: David Cassany <dcassany@suse.com>
2023-10-06 16:33:39 +02:00
David Cassany 8393423c8a Run all syncers in a pod
This commit moves the synchronization logic to allways happen in a Pod,
regardless being a Custom or JSON syncer. This allows having a simpler Pod
lifecycle management as part of the channel controller logic.

In addition, syncer pod logs are read on succeeded state instate of
running state to simplify Pod lifecycle management.

As a result channel updates trigger a new channel synchronization
without having to wait for the next scheduled sync.

Signed-off-by: David Cassany <dcassany@suse.com>
2023-10-03 14:47:12 +02:00
Steven a393a1387c register: add os.unmanaged inventory annotation
When hosts are registered with the --no-toolkit option no OS management
is possible, so we set a new os.unmanaged annotation to reflect this
and skip any attempt to reset if this is found.
2023-09-20 10:35:22 +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
Andrea Mazzotti 73c3622afc Revert not-needed marker fix 2023-08-30 13:03:52 +02:00
Andrea Mazzotti 1e5d3e42bd Set default spec.config.elemental.reset block for MachineRegistration 2023-08-30 13:03:52 +02:00
Andrea Mazzotti ffb9c010c4
Implement remote machines reset (#489) 2023-08-04 09:34:26 +02:00
David Cassany 989851fa61 Do not make use of ServiceAccount.Secrets list
This commit stops using the ServiceAccount.Secrets list, as noted my
k8s this should not be used to find SA's associated secrets and this
is no longer being automatically managed by k8s since v1.24.

Signed-off-by: David Cassany <dcassany@suse.com>
2023-07-11 17:06:37 +02:00
Andrea Mazzotti a0cbda285d
Do not retry registration when on installed system and using randomized TPM seed 2023-06-30 14:43:57 +02:00
Francesco Giudici e9094174be SeedImage: add ResourcesNotCreatedYet Ready condition
Track when the SeedImage child resources are not created (yet).

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2023-05-26 15:54:10 +02:00
Francesco Giudici e436a41b36 operator: add plain auth
Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2023-05-22 17:40:19 +02:00
Francesco Giudici 1dbb8cd5a5 elemental api: add fields to support plain authentication
Add MachineRegistration Elemental Registration Auth to allow
selection of the authentication method.
Add MachineInventory MachineHash key for authentication types different than
TPM (which has its own TPMHash key).

make generate
make build-manifests
2023-05-22 17:40:19 +02:00
David Cassany 1c48574410 Include display name field on ManagedOSVersions
Signed-off-by: David Cassany <dcassany@suse.com>
2023-05-05 13:09:46 +02:00
David Cassany a5fecc08a5 Add ISO type in ManagedOSVersions
Signed-off-by: David Cassany <dcassany@suse.com>
2023-05-05 13:09:46 +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
Francesco Giudici a865050894 SeedImage: add image timeout and retrigger fields
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 08bc407577 SeedImage: set OwnerReferences
Set it owned by the MachineRegistration referenced in the Spec.

Fixes #420

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2023-04-14 09:45:40 +02:00