Commit Graph

94 Commits

Author SHA1 Message Date
Francesco Giudici 5e14e968ee
Label Templates: add IP addresses to the Network variables (#885)
* util: add network util functions

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

* Label Templates: add IPAddress to the Network vars

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

* util/net: rework to allow mocking system ip address retrieval

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

* util/net: return all the available network addresses

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

* Label Templates: add IPAddresses.{num} to the Network vars

track all available network addresses

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

* make generate-mocks

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

* tests: add util/net coverage

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

* error strings should not be capitalized

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

---------

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2024-11-26 09:17:00 +01:00
Francesco Giudici de3c37dfc6
RBAC: restrict SeedImage controller auth to fleet-default (#864)
* RBAC: restrict SeedImage controller auth to fleet-default

do not allow the seedimage-controller to operate on pods, services and
configmaps outside of the fleet-default namespace.

Fixes #457

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

* RBAC: move all rbac resources to rbac.yaml

Also have all of them collected and generated via kustomize

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

---------

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2024-10-07 09:23:50 +02:00
Andrea Mazzotti 08f6cda748
Build e2e chart locally (#852)
* Build e2e chart locally

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

* Add mockgen to build tools

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

* Add missing GINKGO tool

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

* Reduce e2e tests concurrency

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

* Make test more verbose

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

* Bump system-upgrade-controller version

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

* Raise timeout

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

* Print error

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

* Add plan crd

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

* Adjust timeout

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

* Do not deploy operator twice

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

* Restore vendored helper

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

* Do not attempt to delete pods multiple times

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

* Remove debug println

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

* Disable e2e workflow

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

* Update ele-testhelpers library

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

---------

Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-10-01 12:54:40 +00:00
David Cassany Viladomat e6bca47c23
Switch to git based repository in OBS (#845)
* Structure OBS package recipes in folders matching the OBS package name

Signed-off-by: David Cassany <dcassany@suse.com>

* Adapting specfile to new package format

Signed-off-by: David Cassany <dcassany@suse.com>

* Adding _service files to .obs sources

Signed-off-by: David Cassany <dcassany@suse.com>

* Fine tune specfile

Signed-off-by: David Cassany <dcassany@suse.com>

* Use %VERSION% as the version placeholder

Signed-off-by: David Cassany <dcassany@suse.com>

* Remove unneeded OBS workflow

Signed-off-by: David Cassany <dcassany@suse.com>

* Adapt Makefile to new charts paths

Signed-off-by: David Cassany <dcassany@suse.com>

---------

Signed-off-by: David Cassany <dcassany@suse.com>
2024-09-16 15:44:22 +02:00
Andrea Mazzotti 3f185597b0
Bandaid local build (#818)
Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-08-09 12:59:29 +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 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
Francesco Giudici 2c1a82c740 [Airgap] add script tests
Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2024-03-20 09:06:37 +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
Francesco Giudici bc0e47defc
charts: backport changes from Rancher Marketplace chart (#652)
Mainly, change the var "channel.repository" to "channel.image":
"repository" var values are collected by the Rancher Marketplace for air
gap support. Anyway, in the case of the Elemental Channel, the image
should be re-generated in case of air gap scenario following the
official Elemental docs.

Also note that now the channel.image should contain the full url, not
prepended with the registryUrl or the systemDefaultRegistry.

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2024-03-07 11:18:29 +01:00
David Cassany e5bbeed4c5 Fix channel synchronization
Signed-off-by: David Cassany <dcassany@suse.com>
2024-02-29 09:42:58 +01:00
Francesco Giudici ceaf4a0b43
Makefile/setup-full-cluster: build seedimage-builder image too (#639)
The seedimage-builder image is needed to install the built chart: let's
add it to the setup-full-cluster target.

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2024-02-21 08:39:29 +01:00
Francesco Giudici 38b51c526d
Makefile: fix commit date for local builds (#631)
Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2024-02-20 18:49:27 +00:00
Andrea Mazzotti 634cf69a78
Add dev baseimage build (#619)
* Add build-docker-register for local development

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

* Fix managed os image version when using custom registry ports

Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-02-16 10:00:32 +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 63c7f734a3 Use go.mod ginkgo version
In the Makefile we try to install a hardcoded ginkgo version.

This commit uses the ginkgo version in the go.mod file instead.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2024-02-15 11:30:06 +01:00
Fredrik Lönnegren d683823ad7
Use newer xorriso (#624)
Since leap does not include a compatible version of xorriso, switch back
to tumbleweed.

Got errors when trying to install util-linux package on tumbleweed, but
it does not seem to be needed.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2024-02-12 17:59:18 +01:00
Andrea Mazzotti b4f8eb6f66
Print system architecture (#603)
* Add architecture in operator initial log message

Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-01-30 12:14:53 +01:00
Francesco Giudici 6bf2a7a886
Charts/Makefile: fix default OS channel repo name (#594)
repo name changed from "elemental-teal-channel" to "elemental-channel":
fix it for local builds

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2024-01-19 15:27:09 +01:00
David Cassany ff565dd5a9 Fix default values in questions.yaml file
Signed-off-by: David Cassany <dcassany@suse.com>
2023-12-21 09:17:48 +01:00
David Cassany ba7ce1f19a Unify all chart files under .obs/charfile
Signed-off-by: David Cassany <dcassany@suse.com>
2023-11-28 12:22:33 +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
Loic Devulder 3748944999 ci: bump k8s and Rancher Manager versions
Execute E2E tests on latest versions.

Signed-off-by: Loic Devulder <ldevulder@suse.com>
2023-10-12 15:39:57 +02:00
Loic Devulder bf86684ca6 Use helm/kind-action to install kind
Signed-off-by: Loic Devulder <ldevulder@suse.com>
2023-10-12 15:39:57 +02:00
David Cassany ef35e05050 Apply a regex on tags to match the same criteria as in OBS
Signed-off-by: David Cassany <dcassany@suse.com>
2023-09-04 11:42:57 +02:00
Francesco Giudici 1409e0385f
Charts: always use camelCase for values (#507)
registry_url slipped in

Fixes commit #742b414ba326ae78a30dea4849aa71c478a70d4c

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2023-08-30 16:30:47 +02:00
David Cassany 7d89d3b15e Use OBS PR builds for the e2e tests
Signed-off-by: David Cassany <dcassany@suse.com>
2023-08-28 17:10:35 +02:00
David Cassany d3001593a8 Build and publish charts for OBS/IBS artifacts in gh-pages
Signed-off-by: David Cassany <dcassany@suse.com>
2023-08-28 17:10:35 +02:00
Francesco Giudici 75ab143ac0 Makefile: add the REGISTRY_URL var
this is needed to align with the registry/repo templating introduced for
airgapped scenario support.

While there, also drop the SEEDIMAGE_TAG: just use the common TAG for
the seedimage container image.

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2023-08-23 10:20:16 +02:00
Andrea Mazzotti ffb9c010c4
Implement remote machines reset (#489) 2023-08-04 09:34:26 +02:00
Andrea Mazzotti 25abcdc57b
Improve re-registration (#479)
- Added full registration config and statefile path parameters on elemental-register
- Remove support for multiple configuration files
- Added (hardcoded) timer to skip registration updates for 24 hours
- Store emulated TPM seed for future registration updates
- Exit with error code in case of failures (systemd will manage restarts)
- Use virtual filesystem where possible
2023-07-18 15:09:21 +02:00
Francesco Giudici f8c584dfaa Charts: add a new chart to host the pre-hook migration template
We want to drop the pre-hook job reworking the annotations on the
Elemental Operator CRDs as soon as possible. The expected user workflow
is to upgrade to 1.2.4 first if they want to upgrade from the legacy
elemental-operator chart to the newer splitted charts.
So, let's drop the pre-hook job from the main elemental-operator chart
but let's keep it around, in a separate chart, that could still be used
as a standalone chart for manual migration.

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2023-07-04 18:04:21 +02:00
David Cassany 45fca6e256 Adapt tests and Makefile
Signed-off-by: David Cassany <dcassany@suse.com>
2023-05-25 16:24:32 +02:00
David Cassany 5de6250aa7 Split chart into crds chart and operator chart
Signed-off-by: David Cassany <dcassany@suse.com>
2023-05-25 16:24:32 +02:00
Francesco Giudici eb3001441b httpfy: support automated building
Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2023-04-03 14:08:22 +02:00
Francesco Giudici e5634abf9a SeedImage: build image for the builder pod
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
Francesco Giudici c4bb975587
unit-tests: disable parallelization (#312)
The parallelized number of tests is based on the number of available
processors only. The memory usage for the controllers unit-test is big
and we end up using quite some RAM. If systems with mmany CPUs and not
that huge GBs of RAM (my system has 16 cores and 16GB of RAM) we likely
start to hit the swap space.
The end result I get is that if I have less than 8GB free my system starts
trashing and becomes unresponsive. Even if I have more than 8GB free I consume
some swap space and the tests run slower than when serializing tests!
----
$git clean -fdx; time make unit-tests

With parallelization:
real    0m17.477s
user    2m8.029s
sys     0m14.570s

Without parallelization (with this patch):
real    0m14.271s
user    0m27.395s
sys     0m4.659s

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2022-12-22 08:51:29 +00:00
Itxaka 95bb57dc4e
Improve unit tests (#308) 2022-12-20 09:22:00 +01:00
Alexander Demicev c4b8e2d596 Merge all main logic in one file (#270) 2022-12-12 12:15:22 +01:00
Alexander Demicev b4649dd363 Kubebuilder: Remove unused code (#267)
* Remove unused code

* Run make vendor
2022-12-12 12:15:22 +01:00
Alexander Demicev bfc7436040 Fix make verify (#248) 2022-12-12 12:15:22 +01:00
Alexander Demicev 388839e32d Kubebuilder: Add "verify" workflow (#244)
* Add new verify tasks

* Fix go mod
2022-12-12 12:15:22 +01:00
Alexander Demicev 0edac91853 Add remaining controllers (#232)
* Update vendor

* Run generation tasks

* Minor fixes in Makefile

* Remove old code

* Add remaning controllers

* Minor e2e tests improvements

* Switch osversionchannel syncer to controll runtime

* Minor fixes in controllers

* Fix unit tests
2022-12-12 12:15:22 +01:00
Alexander Demicev 591c683dd4 Kubebuilder: Run new code and generate RBAC (#203)
* Add new command for running kubebuilder based code

* Add make task for generating RBAC from code

* Add new directory to makefile
2022-12-12 12:15:22 +01:00
Alexander Demicev 077ab69a7f Kubebuilder: Add make tasks for different tools (#194)
* Add tools binaries to Makefile

* Run make generate

* Update github workflows

* Impove path to tools
2022-12-12 12:15:22 +01:00
Itxaka 2e2b5a2034
tests: use latest url for rancher charts (#218) 2022-10-19 15:57:51 +02:00
Alexander Demicev 61749bd8c6
Add config for e2e tests (#201)
* Add e2e test config

* Switch to using test config

* Update vendor

* Fix lint issues

* Change rancher namespace variable name

* Put do nothing test back
2022-10-11 13:03:01 +02:00
David Cassany Viladomat 1af1d0709e
Add vendor for obs integration (#198)
These changes are required to facilitate OBS code updates and builds by simply triggering OBS services. This allows updating code and rebuild in OBS based on github events such as on tag, on merge, on push...

Signed-off-by: David Cassany <dcassany@suse.com>
2022-10-07 14:23:11 +00:00
Loic Devulder 72ef079d09
register: build it with CGO (#169)
* register: build it with CGO
It's needed to be able to use TPM emulation.
* goreleaser: add entry for elemental-support

Signed-off-by: Loic Devulder <ldevulder@suse.com>
2022-09-08 15:26:40 +02:00