Commit Graph

898 Commits

Author SHA1 Message Date
David Cassany Viladomat 717c575d51
Add new Micro 6.0 channels (#817)
* Add new Micro 6.0 channels

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

* Use the proper dynamic URI for channel images

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

---------

Signed-off-by: David Cassany <dcassany@suse.com>
2024-08-08 16:12:57 +00:00
David Cassany Viladomat 750a09166a
Remove unused workflows (#815)
Signed-off-by: David Cassany <dcassany@suse.com>
2024-08-08 15:00:32 +00:00
Francesco Giudici 36468aba42
register: always register when called (#813)
Remove the static check to re-register only after 24 hours.
The re-registration will then happen every time the elemental-register
client is called.
This static timer was introduced to limit as much as possible the
communication form the host to Rancher and save communication bandwidth
for remote clients.
Anyway, this makes not much sense as long as the elemental-system-agent
is running, which will in any case keep connecting to Rancher.
The call to the elemental-register binary is performed on official
Elemental SLE Micro images every 30 minutes and at each boot.

Fixes https://github.com/rancher/elemental-operator/issues/811

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2024-08-08 10:10:25 +02:00
Francesco Giudici 6681ea5f6d
operator: rework label templating (#808)
Reworked the code to provide templating to MachineInventory labels and name.
The template source data is the "System Information" (BIOS) and "System Data" (which we usually called 'HW Labels') data sent by the machines via the register client.

This rework fixes some bugs and duplicated code and slightly changes the behavior in few cases.
The behavioral changes address the following corner cases:
* `.` is added to the allowed characters in label values (previously was substituted with `-`).
* when the first character of a label value is an accepted one but not alphanumeric (i.e., `-` , `_` or `.`) we drop it (previously we prepended `m` to the label).
* if the last character of a label value is not alphanumeric (i.e., `-` , `_` or `.`) we drop it (previously was not checked).
note that for the MachineInventory name (which will also be the machine hostname after k8s provisioning) the allowed set of characters has not changed: it's the same of the label case but without the `_` (i.e., `-` or `.`).

 Regarding the MachineRegistration.spec.machineName:
* if it is empty, a default `m-${UUID}` value is assigned to the MachineInventory.name (as previously)
* if it contains a template value which doesn't exists (wrong template value or `nosmbios` option) the MachineInventory.name is assigned a default `m-${UUID}` name (new behavior).
* if it is not empty, but after resolving the template values and sanitizing the string it gets empty, the name assignment process will error out failing the registration process.

Commits:

* operator: move label templating functions to separate file
no code changes, just label templating functions moved to labeltmpl.go.

* operator: add pkg/templater

* operator: add few comments

* operator: rework label templating
Fixes #807

* tests: update api_registration_test.go

* operator: move regexp to label templating file

* operator: change template behavior in corner cases
1. '.' is added to the allowed characted in label values (previously was
   sobsituted with '-').
2. when the first character of a label value is not alphanumeric ("-" or
   "_" or ".") we drop it (previously we prepended 'm').
3. if the last characted of a label value is not alphanumeric ("-" or
   "_" or ".") we drop it (previously was not checked).

* tests: improve coverage of label templating

* make linter happy

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2024-08-05 16:05:39 +02:00
David Cassany 05b6a19d97 Enable PR workflow for v1.6 maintenance branch
Signed-off-by: David Cassany <dcassany@suse.com>
2024-08-05 10:09:35 +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
Loic Devulder b866419440 [Airgap] fix unstable channel extraction
Signed-off-by: Loic Devulder <ldevulder@suse.com>
2024-07-02 18:13:52 +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
dependabot[bot] 7ce9f18ba1 Bump docker/build-push-action from 6.1.0 to 6.2.0
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 6.1.0 to 6.2.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v6.1.0...v6.2.0)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-01 10:52:53 +02:00
David Cassany 0f59b146ba Check crds chart is aligned with the main operator chart version
Signed-off-by: David Cassany <dcassany@suse.com>
2024-06-28 11:45:19 +02:00
David Cassany Viladomat bd9594215c
Workaround []byte equality check (#788)
In GHA we sporadically see equaity check to fail because the underlaying
slice arrays of a []byte pair are having a different capacity despite
having the same lenght and content.

Signed-off-by: David Cassany <dcassany@suse.com>
2024-06-27 14:26:02 +02:00
David Cassany d940c48a48 Update k8s and Rancher versions for the e2e tests
Signed-off-by: David Cassany <dcassany@suse.com>
2024-06-27 12:13:25 +02:00
David Cassany d80c1ab078 Add the new default channel
Signed-off-by: David Cassany <dcassany@suse.com>
2024-06-26 18:18:39 +02:00
David Cassany Viladomat f92a2de2bd
Block reinstall if crds are still pending to be deleted (#784)
* Block reinstall if crds are still pending to be deleted

Signed-off-by: David Cassany <dcassany@suse.com>
2024-06-26 15:52:17 +00:00
David Cassany 6ee9211a97 Add development channel for OBS builds
This commit adds a development channel reference to builds
done in OBS (under or branched from isv:Rancher:Elemental)

Signed-off-by: David Cassany <dcassany@suse.com>
2024-06-26 06:22:44 +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 27a785ea78
Remove flaky checksum test (#774)
Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-06-25 11:34:38 +02:00
dependabot[bot] 6d5eecec42
Bump sigstore/cosign-installer from 2.8.0 to 3.5.0 (#700)
Bumps [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) from 2.8.0 to 3.5.0.
- [Release notes](https://github.com/sigstore/cosign-installer/releases)
- [Commits](https://github.com/sigstore/cosign-installer/compare/v2.8.0...v3.5.0)

---
updated-dependencies:
- dependency-name: sigstore/cosign-installer
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-24 14:39:00 +02:00
dependabot[bot] d8a160d5fe
Bump docker/login-action from 3.1.0 to 3.2.0 (#746)
Bumps [docker/login-action](https://github.com/docker/login-action) from 3.1.0 to 3.2.0.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v3.1.0...v3.2.0)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-24 14:38:40 +02:00
dependabot[bot] 38b4b537d9
Bump docker/build-push-action from 5.3.0 to 6.1.0 (#778)
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 5.3.0 to 6.1.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v5.3.0...v6.1.0)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-24 14:38:19 +02:00
Andrea Mazzotti 561859382c
Use dynamic system agent applied dir (#763)
* Use dynamic system agent applied dir

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

* Use dynamic RKE2 data-dir

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

---------

Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-06-24 09:29:26 +02:00
David Cassany 61e76e2964 Ensure re-sync is triggered
Signed-off-by: David Cassany <dcassany@suse.com>
2024-06-21 16:32:32 +02:00
Francesco Giudici 7227947d50
operator: always update managedosversionchannel last sync time (#772)
...also if we have an error on Pod creation.

Fixes commit 5ccde141e6

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2024-06-20 17:52:06 +02:00
Francesco Giudici 5ccde141e6
operator: fix ManagedOSVersionChannel sync (#769)
* operator: fix ManagedOSVersionChannel sync
After the very fist initial sync, all subsequently channel syncs fail.
Fixed.
fixes: https://github.com/rancher/elemental-operator/issues/766

* operator: don't assume ManagedOSVersion resources have annotations
Older resources may not have annotations yet: initialize the field.
Fixes: https://github.com/rancher/elemental-operator/issues/767

---------

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2024-06-19 16:20:40 +00:00
Andrea Mazzotti c90990371c
Use YAML content for Elemental Agent config (#765)
Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-06-19 15:49:19 +02:00
Francesco Giudici 2c3f177fd2
Revert "CI: fix CodeQL test (#655)" (#663)
This reverts commit b3b80b7864.
2024-06-18 18:05:46 +02:00
Geert van Horrik 0939fb068a
Update deployment.yaml (#757)
Signed-off-by: Geert van Horrik <GeertvanHorrik@users.noreply.github.com>
2024-06-18 09:34:57 +02:00
Andrea Mazzotti 9c8550fdfb
Allow yip configs (#751)
Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-06-17 10:25:17 +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 bc2f5cfc81
Let elemental-register digest system hardware data (#748)
* Let elemental-register digest system hardware data (SystemData V2)

Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-06-04 14:03:06 +02:00
Francesco Giudici 3379c85c40
register: don't send new Disks and Controllers data (#741)
The newer versions of jaypipes/ghw include a new type of Disk and
Controller in the Blocks section.

We use the library json serialization functionality: the deserialization
function of the older version of the library (0.9.0) would error out
when trying to decode serialized data of newer versions if they include
the new "virtual" drive or the new "loop" controller.
For now, just remove those devices.
Proper fix will be to better deal with this kind of errors avoiding
tearing down the registration process.

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2024-05-28 17:23:07 +02:00
Andrea Mazzotti 7f8f2e8ba2
Remove CodeCov action (#738)
Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-05-27 10:45:34 +02:00
Rhys Oxenham 7c71dc9de1
Added the ability to create a node reset marker for unmanaged hosts (#731)
* Added the ability to create a node reset marker for unmanaged hosts
2024-05-21 16:15:38 +02:00
Fredrik Lönnegren ccdd204430
Update golang.org/x/net to v0.23.0 (#734)
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2024-05-21 14:18:39 +02:00
Fredrik Lönnegren 2bd467f301
Allow cross build of seed-image ISOs (#728)
* Allow cross build of seed-image ISOs

This commit makes use of the targetPlatform field on the seedImage spec
to allow building ISOs for different architectures.

It does this by spawning the initContainer using the seedImageBuilder
image and using the `elemental pull-image --platform=` command to
download the correct ISO and copies it to the attached volume.

One drawback of this approach is we don't get the caching of images in
the container runtime that we get when building natively.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2024-05-16 16:02:39 +02:00
Andrea Mazzotti bf9db60bef
Deprecate install yq action (#730)
Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-05-16 15:23:50 +02:00
Andrea Mazzotti a60fdad773
Deprecate release-action (#729)
Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-05-16 14:39:47 +02:00
dependabot[bot] e475b750aa Bump golangci/golangci-lint-action from 4 to 6
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 4 to 6.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v4...v6)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-14 09:23:50 +02:00
Andrea Mazzotti 9a93cc9147 Prevent system-upgrade-controller from using dotted names
Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-05-07 18:20:24 +02:00
Loic Devulder 35366160a6 chart: fix upstream-version metadata
Signed-off-by: Loic Devulder <ldevulder@suse.com>
2024-05-07 17:47:00 +02:00
Francesco Giudici 5f2b96c299
seedimage: clean-up service on image download deadline (#719)
* seedimage: clean-up service on image download deadline

We used to just clean-up the Pod carrying the built image when hitting
the cleanupAfterMinutes deadline.
There is no need to leave the Service around, clean that up too.

Fixes #704

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

* Update controllers/seedimage_controller.go

Co-authored-by: Fredrik Lönnegren <fredrik.lonnegren@gmail.com>
Signed-off-by: Francesco Giudici <francesco.giudici@gmail.com>

---------

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
Signed-off-by: Francesco Giudici <francesco.giudici@gmail.com>
Co-authored-by: Fredrik Lönnegren <fredrik.lonnegren@gmail.com>
2024-05-07 07:38:37 +00:00
Francesco Giudici ca0ed22f8d chart: add chart name and version to the operator deployment (#694)
Fixes #691

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2024-05-06 14:17:06 +02:00
Francesco Giudici a147e8a286
chart: add customizable security-context (#716)
drop all privileges and enforce user/group/fsgroup

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2024-05-02 07:46:22 +00: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
David Cassany Viladomat 05abb2228e Update .obs/helper_scripts/README.md
Co-authored-by: Francesco Giudici <francesco.giudici@gmail.com>
Signed-off-by: David Cassany Viladomat <dcassany@suse.com>
2024-04-23 22:23:25 +02:00
David Cassany e2e9ac4e12 fine tune checkoimages.sh script
Signed-off-by: David Cassany <dcassany@suse.com>
2024-04-23 22:23:25 +02:00
David Cassany 1e2625618f Add scripts to list and check images from the registry
Signed-off-by: David Cassany <dcassany@suse.com>
2024-04-23 22:23:25 +02:00
Francesco Giudici a43c150c82
seedimage: use ClusterIP Services (#709)
When building an ISO, we create a Pod and a Service to expose the built
ISO when ready.
The link to the ISO is then exposed through the Elemental Operator
Deployment, that acts as an Ingress.
The Service we create to expose the Pod port is of type NodePort: this
is not needed,is just a leftover from the initial implementations, where
we usede to expose a "direct" link to the Pod.
No need to keep a NodePort service now, let's have a ClusterIP Service
type instead.

Fixes: https://github.com/rancher/elemental-operator/issues/705

Signed-off-by: Francesco Giudici <francesco.giudici@suse.com>
2024-04-22 09:35:45 +02:00
Andrea Mazzotti 47516fde39
Add dmidecode as Recommends to elemental-register (#702)
* Add dmidecode Recommended dependency

Signed-off-by: Andrea Mazzotti <andrea.mazzotti@suse.com>
2024-04-16 14:42:57 +00:00