Commit Graph

93 Commits

Author SHA1 Message Date
Alexander Demicev 087bdbd14f
Backport minor fixes (#271) 2022-12-01 18:42:52 +01:00
Alexander Demicev 8283d03496
Kubebuilder: Remove unused code (#267)
* Remove unused code

* Run make vendor
2022-11-29 12:29:55 +01:00
Michal Jura 7b2bebb68e
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-11-23 13:51:10 +01:00
David Cassany Viladomat 5757f2d82f
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-11-22 15:40:15 +01:00
Michal Jura 26f70f371a
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-11-21 16:05:11 +01:00
David Cassany Viladomat c18f66d8b8
Drop requeuer, not needed anymore (#255)
* Drop requeuer, not needed anymore
* Improve logging

Signed-off-by: David Cassany <dcassany@suse.com>
2022-11-21 12:37:14 +01:00
David Cassany Viladomat 5b68534515
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-11-18 14:33:12 +01:00
David Cassany Viladomat ed268ce451
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-11-16 18:38:23 +01:00
Alexander Demicev db7d0dd68e
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-11-10 11:26:34 +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
Itxaka 350e80ec08 [test] Remove focus
Signed-off-by: Itxaka <igarcia@suse.com>
2022-07-11 15:21:18 +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 680ec0a192 Set different namespace for managedosimage
we cannot use fleet-local with targets on a managedosimage

Signed-off-by: Itxaka <igarcia@suse.com>
2022-07-11 15:12:19 +02:00
Itxaka 0dbbbdee8d Move all the testing to fleet-local namespace
And have the operator watch that namespace

Signed-off-by: Itxaka <igarcia@suse.com>
2022-07-11 15:12:19 +02:00
Itxaka 26464f0e69 Rework tests workflow
Signed-off-by: Itxaka <igarcia@suse.com>
2022-07-11 15:12:19 +02:00
Itxaka 9557155aba Fix+debug
Signed-off-by: Itxaka <igarcia@suse.com>
2022-07-11 15:12:19 +02:00
Itxaka fafca883df Set cattle-url on chart install
Signed-off-by: Itxaka <igarcia@suse.com>
2022-07-11 15:12:19 +02:00
Itxaka 242d726b72 Add yaml annotations to Register Spec
So if we use it from the tests and marshall it it respects the
upper/lowercase

Signed-off-by: Itxaka <igarcia@suse.com>
2022-07-11 15:12:19 +02:00
Itxaka cc7be89bed Fix rest of the tests, skip one
Signed-off-by: Itxaka <igarcia@suse.com>
2022-07-11 15:12:19 +02:00
Itxaka b445c47e84 Several fixes to tests
- Use the default namespace instead fo fleet-local. The chart now
   defaults to use the same namespace to watch as the one being
installed onto, so we need to run our resources in the same one for
testing
 - Skip some non-working tests. Those require a new discovery plugin
   image published with a fixed entrypoint

Signed-off-by: Itxaka <igarcia@suse.com>
2022-07-11 15:12:19 +02:00
Itxaka 74301fa37b Several fixes
Fix Dockerfile entrypoint
Fix some tests referring to old structs

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
Ettore Di Giacinto 2acf273ba5
tests: Use helpers from testlib
Signed-off-by: Ettore Di Giacinto <edigiacinto@suse.com>
2022-04-20 09:43:36 +02:00
Ettore Di Giacinto ff7c6d500a
tests: Add upgrades e2e test
The test is trying to run an upgrade on the cluster, checking the logs
of the pod created by system-upgrade-controller which should contain
traces of elemental-cli being called.

Signed-off-by: Ettore Di Giacinto <edigiacinto@suse.com>
2022-04-19 15:21:16 +02:00
Ettore Di Giacinto 8d4aeba7e9
ci: detect when deployments are already there
Signed-off-by: Ettore Di Giacinto <edigiacinto@suse.com>
2022-04-19 15:08:08 +02:00
Loic Devulder 843f23ef8f
e2e-ci: add some missing check on errors
Signed-off-by: Loic Devulder <ldevulder@suse.com>
2022-04-08 17:01:42 +02:00
Loic Devulder 6135985493
e2e-ci: move some functions to ele-testhelpers
Signed-off-by: Loic Devulder <ldevulder@suse.com>
2022-04-08 16:59:20 +02:00
Ettore Di Giacinto fec98601d4
Test env metadata injection
Also refactor to quiet the linter

Signed-off-by: Ettore Di Giacinto <edigiacinto@suse.com>
2022-04-08 11:58:56 +02:00
Ettore Di Giacinto ed51210e52
Adapt tests, add test cases
Signed-off-by: Ettore Di Giacinto <edigiacinto@suse.com>
2022-04-08 10:47:07 +02:00
Ettore Di Giacinto 758d21eafd
Collect errors when syncing
Signed-off-by: Ettore Di Giacinto <edigiacinto@suse.com>
2022-04-07 16:22:33 +02:00
Ettore Di Giacinto f17af166c6
Add test for event broadcasting
Signed-off-by: Ettore Di Giacinto <edigiacinto@suse.com>
2022-04-07 16:00:24 +02:00
Ettore Di Giacinto 7c47762706
Add reconciler
Signed-off-by: Ettore Di Giacinto <edigiacinto@suse.com>
2022-04-07 16:00:23 +02:00
Ettore Di Giacinto 6e115fc95c
Allow to specify a mountpath
Signed-off-by: Ettore Di Giacinto <edigiacinto@suse.com>
2022-04-06 12:33:34 +02:00