Commit Graph

50 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 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 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 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
Fredrik Lönnegren 1f447e5e17 Make linter happy
Revive linter added a new default rule for unused-parameters, update the
code to match.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2024-02-12 09:52:35 +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
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
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
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
David Cassany 71ac99f7b6 Enble cache for MachineInventorySelector resources
Signed-off-by: David Cassany <dcassany@suse.com>
2023-03-28 13:04:03 +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 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
David Cassany dace08292c Prevent MachineInventorySelector from being cached
Signed-off-by: David Cassany <dcassany@suse.com>
2023-03-10 14:54:28 +01:00
Fredrik Lönnegren fe8f53f2d2 Unify logging
Use klog for all logging and remove logrus.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2023-02-22 18:43:48 +01:00
Francesco Giudici 53f66f9d59
build-image API: add build job with single pod lifecycle (#362)
* operator: build-image API POD lifecycle management
Only one POD at a time allowed (for now).

* elemental-operator: improve build-image logging

* operator: add build-image Service

* operator: build-image API: delete Pod and Service on failure

* operator: add functions to manage registration cache

* operator: finalize build-image API Pod lifecycle

* operator: fix build-image API tests

* operator: ensure clean-up of build-image pods

* operator: add Services creation/deletion to Elemental ClusterRole

* operator: build-image: set download URL when job is completed

* operator: build-image: retry build job Pod creation if needed

* operator: build-image: in case of job Failure leave the Pod there

* operator: build-image: increase the time for job completion

* operator: make Code scanning happy

* operator: build-image: use NodePort Service

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2023-02-20 11:08:07 +01:00
Fredrik Lönnegren b9d1c82976
Copyright date-range 2022 - 2023 (#327)
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2023-01-13 10:30:48 +01:00
Francesco Giudici 3965dd346f
operator: add back debug logs for logrus (registration) (#299)
With kubebuilder we moved to sigs.k8s.io/controller-runtime logs.
Still, the registration part of the operator uses logrus for logging.

The operator debug config just enables verbose logging on the newer
controller-runtime logs: allow to enable verbose logging on registration
too.

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2022-12-15 17:07:07 +01:00
Alexander Demicev c4b8e2d596 Merge all main logic in one file (#270) 2022-12-12 12:15:22 +01:00
David Cassany Viladomat 173ebae8e1 Drop requeuer, not needed anymore (#255)
* Drop requeuer, not needed anymore
* Improve logging

Signed-off-by: David Cassany <dcassany@suse.com>
2022-12-12 12:15:22 +01:00
David Cassany Viladomat eeb07166c6 New syncer logic (#245)
* Implement syncer logic as part of the ManagedOSVersionChannel controller

  This commit adds the logic to synchronize managedosversionchannels
  within the already existing controller.

* make generate
* make build-manifests
* Update chart
* update e2e tests

Signed-off-by: David Cassany <dcassany@suse.com>
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 5473f97262 Kubebuilder: Add machine inventory selector controller (#224)
* Add machine inventory selector controller

* Remove old machine inventory selector code
2022-12-12 12:15:22 +01:00
Alexander Demicev e1dc2202b6 Kubebuilder: Add machine registration controller (#206)
* Add new package to Dockerfile

* Update dependencies

* Add unit test helpers

* Add new machine registration controller

* Remove old machine registration controller

* Add rbac tag for secrets

* Fix container argument in chart

* Add labels to all created resources
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
Itxaka c309363362
Add version commands/flags for all binaries (#262)
Fixes https://github.com/rancher/elemental-operator/issues/261
2022-11-22 11:09:49 +01:00
Itxaka 4fab515a30
Rework client to accept a ClientInterface (#166) 2022-09-07 10:39:26 +02:00
Itxaka 01fd853832
Remove default value for flag and expand description (#126)
Make sure we have a decent description for the --operator-image flag as
that is used down the line by the syncer to run the display command and
gather the results from the version syncer.

Also remove the default value for the flag. It makes no sense to have a
default value if we mark a flag as required, as that value will always
be overwritten by the flag.

Signed-off-by: Itxaka <igarcia@suse.com>
2022-08-10 14:31:54 +02:00
Itxaka ea7884e8df
Produce 2 binaries instead of one (#99)
* Produce 2 binaries instead of one

This generates a different binary for the register command as to not
bundle it with the full operator.

On the makefile separated builds have been done for operator and
registry.

On the docker image a different container is created for the register
and pushed to a different repo as well.

For releases gorelease generates 2 different binaries.

Signed-off-by: Itxaka <igarcia@suse.com>
2022-08-01 15:08:23 +00:00
Francesco Giudici 53d463dbaf elemental-operator register: add some more logging
mainly more logs about reading config

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2022-07-22 18:07:18 +02:00
Itxaka f2ab68c3ca
[register] Check for path error before doing anything (#80) 2022-07-22 13:25:41 +00:00
David Cassany Viladomat cf20bc60bb
Make /oem/registration the default configuration dir (#81)
This commit uses /oem/registration as the default directory
to load configuration from in elemental-opertator register command

Signed-off-by: David Cassany <dcassany@suse.com>
2022-07-22 15:11:47 +02:00
David Cassany Viladomat 52c3cbbec2
Store registration yaml in installed system (#71)
Signed-off-by: David Cassany <dcassany@suse.com>
2022-07-21 11:42:13 +02:00
David Cassany Viladomat 79d957e1df
Adds support for cloud-config data in machine registration (#61)
Signed-off-by: David Cassany <dcassany@suse.com>
2022-07-20 10:42:08 +02:00
David Cassany Viladomat 6e2f20f3be
Pass debug flag to elemental client if requested (#58)
Signed-off-by: David Cassany <dcassany@suse.com>
2022-07-18 16:42:43 +02:00
David Cassany Viladomat 2381ebc55a
Do not attempt to install in already installed systems (#55)
Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>

Co-authored-by: David Cassany <d.cassany@suse.com>
2022-07-15 14:57:51 +00:00
Itxaka 618d3c4da3
Log the version, commit and commit date on start (#43) 2022-07-15 09:50:18 +00:00
David Cassany Viladomat bd811be876
Remove obsolete logic from former ros-installer (#45)
* Remove obsolete logic from former ros-installer

Signed-off-by: David Cassany <dcassany@suse.com>
2022-07-15 10:48:41 +02:00
Francesco Giudici a05a2dbae6 elemental-operator register: enable local plans
Enable local plans execution in the rancher-system-agent

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2022-07-14 17:28:56 +02:00
Francesco Giudici 602178c01d
elemental-operator register: allow cacert passed as file or data (#44)
We now process the cacert as a file path: the yaml file from kubernetes
anyway passes it as the acutal cert data. Manage both cases.

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2022-07-14 14:28:47 +02:00
Itxaka adfff7c91a
Some register fixes (#40)
* Some register fixes

 - Add debug flag for debug loggin
 - Add docs to command
 - Add docs to flags
 - Pass the cacert via a file, NOT via string
 - Rename var config so it doesnt clash with imported package name

Signed-off-by: Itxaka <igarcia@suse.com>
2022-07-13 17:05:19 +00:00
Francesco Giudici 62bac1d84e
elemental-operator register: add elemental cli call (#38)
The elemental-operator register command, after retrieving the config
registration will directly call the elemental cli to start the actual
installation process.

Co-authored-by: David Cassany <dcassany@suse.com>
Co-authored-by: Francesco Giudici <francesco.giudici@suse.com>

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

Co-authored-by: Itxaka <igarcia@suse.com>
2022-07-13 17:30:12 +02:00
Itxaka e87eb80c9c
Use cacert from rancher and use serverl-url from rancher (#36)
* Generate v3.Setting code

Signed-off-by: Itxaka <igarcia@suse.com>

* Use the rancher cacerts for the registration

Also drops the cacert passing via chart, adds proper permissions to the
settings resource, adds the cache index and checks that indeed we are
returning a cacert on the registration url

Signed-off-by: Itxaka <igarcia@suse.com>

* fix lint

Signed-off-by: Itxaka <igarcia@suse.com>

* Drop manual rancherl-url and get the rancher url automatically

Drop any manual setup of rancher-url and use the settings to get the set
rancher-url

Signed-off-by: Itxaka <igarcia@suse.com>

* Small fix for getRancherCACert

Signed-off-by: Itxaka <igarcia@suse.com>

* Fix test setting the wrong url

Signed-off-by: Itxaka <igarcia@suse.com>
2022-07-13 16:11:21 +02:00
David Cassany Viladomat 14d4d957cf
Share installation configuration structures (#24)
This commit makes sure elemental-operator and elemental-installer are
using the same structures to describe and define the elemental-cli
installation.

Signed-off-by: David Cassany <dcassany@suse.com>
2022-07-12 12:36:53 +02:00
Itxaka 7f6baefb2a Restore sync-namespaces
There seems to have some confusion between the namespace of the operator
to run on and the namespaces we want the operator to watch

This restores the sync_namespaces so the operator can watch all
namespaces and sets teh namespace option to be where the operator is
runnig, needed for things like the registration url to be properly
served

Signed-off-by: Itxaka <igarcia@suse.com>
2022-07-11 15:13:22 +02:00
Itxaka e6ceda4928 Fix operator display output
For some reson copying the file to stdout produces an empty line which
breaks reading from it, restore it to how it was

Signed-off-by: Itxaka <igarcia@suse.com>
2022-07-11 15:12:19 +02:00
Itxaka 99679d1815 Set logrus to debug if debug is enabled
Signed-off-by: Itxaka <igarcia@suse.com>
2022-07-11 15:12:19 +02:00
Itxaka 5c5f1150cb Fix all the test, remove leftovers from transition
Remove all the mentions to rancheros-operator in tests, imports and
dependencies.

Restore e2e scripts and test targets on makefile

Fix all lint issues

Signed-off-by: Itxaka <igarcia@suse.com>
2022-07-11 15:12:19 +02:00
David Cassany Viladomat 1d97f14de7
Merge elemental installer (#20)
* Move main into a cmd/operator package
* Add elemental-installer
* Adding installer unit tests
* Update Makefile
* Update .github/workflows/unit-tests.yaml
* Adapat Dockerfile and golreleaser to keep releasing and building elemental-operator as they used to

Signed-off-by: David Cassany <dcassany@suse.com>
Co-authored-by: Itxaka <igarcia@suse.com>
2022-07-07 14:47:32 +02:00
Jacob Payne c5a5dbd77f renamed to elemental-operator and switched to system agent 2022-06-30 16:01:13 +00:00