Commit Graph

116 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
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 69d4bc1329
Use privateCA for Rancher on dev environment (#857)
Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-10-02 10:23:10 +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
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
David Cassany Viladomat d7a712d3ca
Update channels (#781)
* Update channels
* Adding a downgrade/upgrade charts e2e test
* Only fetch logs for running containers
* Do not fail fast in e2e matrix

Signed-off-by: David Cassany <dcassany@suse.com>
2024-07-02 17:53:15 +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 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
Andrea Mazzotti 4cc4d334cf
Update system-upgrade-controller test version (#630)
Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-02-19 09:24:21 +01: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 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
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 3d44319bba Make sure to not overlap with the already existing channel and use RT for tests
Signed-off-by: David Cassany <dcassany@suse.com>
2023-10-25 12:17:13 +02: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
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
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
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 Viladomat 886a9985b1
Bump rancher and k8s for e2e tests (#449)
* Bump rancher and k8s for e2e tests

Signed-off-by: David Cassany <dcassany@suse.com>
2023-05-22 12:40:40 +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
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
David Cassany Viladomat af83eea27f
Drop legacy catalog for tests (#291)
Signed-off-by: David Cassany <dcassany@suse.com>
2022-12-14 16:35:15 +00:00
Alexander Demicev b4649dd363 Kubebuilder: Remove unused code (#267)
* Remove unused code

* Run make vendor
2022-12-12 12:15:22 +01:00
Michal Jura f20198f58c Refactor ManagedOsImage e2e tests (#263)
Fix: https://github.com/rancher/elemental-operator/issues/240

Signed-off-by: Michal Jura <mjura@suse.com>

Signed-off-by: Michal Jura <mjura@suse.com>
2022-12-12 12:15:22 +01:00
David Cassany Viladomat d3cefe36eb Add a rate limiter to managedosversionchannel reconciler (#260)
This commit adds a rate limiter to the ManagedOSVersionChannel controller to prevent
stacking reconcile loops over the same resource in fast rates (doesn't make sense for a
ManagedOSVersionChannel). By default the controller runtime already includes an
equivalent rate limiter, but starts in the range of milliseconds, starting the exponential
rate limiter in the range of seconds is more than enough in this context.

In addition it drops the failures counter in the resource. This counter was supposed to
be used to limit the number attempts to sync in case of failure. This was a bad design,
status should not keep a counter like this as any change in status triggers a new
immediate reconcile loop, hence the counter was reaching the maximum as fast as the
controller runtime was executing reconcile loops without any rate limiter (rate limiter
applies only when there are no changes including status).

For now I think we can just live without the setting any maxium for failures. If we ever
need it I believe it should be coded and tracked within the controller itself, not in each
resource as this prevents the reconcile loop of being idempotent. Alternatively we could
prevent triggering the reconcile loop on status changes, however this prevents
reconciling if any third party (or user from the kubectl client) changes a resource status.

Fixes #257
Part of #240

Signed-off-by: David Cassany <dcassany@suse.com>
2022-12-12 12:15:22 +01:00
Michal Jura 0d3c6ef8fd Refactor MachineRegistration e2e tests (#253)
Fixes rancher#240

Signed-off-by: Michal Jura <mjura@suse.com>

Signed-off-by: Michal Jura <mjura@suse.com>
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 f3aba7f2ae Improve syncer (#252)
This commit adds few changes on the syncer logic:

* Makes use of ManagedOSVersionChannel status reason to track if there
  is an on going synchronization rather than polling for the existence of a synchronization pod or not.

* Adds a logic to stop trying to synchronize after 4 consecutive attempts.
  If it exceeds the maximum it just programs the next re-sync after the given sync
  interval instead of immediately retrying.

* Adds some logging and comments here and there.

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
Itxaka 69a8c52282
Use custom names in upgrade objects (#254) 2022-11-21 14:35:21 +01:00
Itxaka 4dc57ca988
tests: Add k8s 1.24 and default to rancher 2.6.9 (#220) 2022-10-19 17:22:32 +02:00
Itxaka 2e2b5a2034
tests: use latest url for rancher charts (#218) 2022-10-19 15:57:51 +02:00
Alexander Demicev 9c1d506fa9
Collect operator logs after running tests (#204) 2022-10-11 17:26:10 +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
Francesco Giudici f022acb6a3 unit-tests: add support to Secrets in registraion's OnChange()
Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2022-09-23 15:29:07 +02:00
Itxaka 832ee7fad4
tests(registration): More unit tests (#167) 2022-09-07 17:53:24 +02:00
Itxaka 4fab515a30
Rework client to accept a ClientInterface (#166) 2022-09-07 10:39:26 +02:00
Itxaka 3257003185
tests(inventory): Add unit tests for inventory methods (#164) 2022-09-06 11:21:14 +02:00
Itxaka 41e9c17915
Enable deploying operator replicas (#150)
Enables deploying multiple operators replicas.

Changes tests to account and test this

Chart changes:
 - Make any fixed names default to the release name. As release name has
   to be unique per namespace, this is a good practice instead of
   hardcoding whatever name we want. This shouldnt affect anything as
   the full chart uses that by default now.

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

Signed-off-by: Itxaka <igarcia@suse.com>
2022-08-31 16:36:56 +02:00
Itxaka 352a31d5a9
Fix e2e discovery tests (#138) 2022-08-12 13:42:28 +02:00
Itxaka bdd1e959d7
[tests] fix nginx deploy url (#129) 2022-08-10 12:07:40 +02:00
Itxaka 5b64a774ea
Set the proper namespace (#117) 2022-08-05 14:45:59 +00:00
Itxaka 3241cfd663
Bump rancher version (#89) 2022-07-27 10:28:14 +02:00
Itxaka 09ab84500d
Add a target to setup a clean cluster (#79)
This target (ab)uses the ginkgo BeforeSuite to have a ready-to-test
cluster with all prerequisites installed for easy testing.

It will build the docker image for the operator, build the chart
pointing to that image, setup a kind cluster, load the docker image
locally built into the cluster and run an empty test which is done so
the BeforeSuite is run, which installs all the needed charts and the
operator into the system.

Signed-off-by: Itxaka <igarcia@suse.com>
2022-07-22 14:46:19 +00: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
Itxaka 278b9b2c39
Return a Config.Config in MachineInventory (#35) 2022-07-13 16:28:48 +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