Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement picking dynamic installation device #561

Merged
merged 2 commits into from
Nov 21, 2023

Conversation

frelon
Copy link
Contributor

@frelon frelon commented Nov 2, 2023

This PR adds the implementation for picking the installation device during registration based on a deviceSelector in the MachineRegistration.

Pasting some example registrations for different use-cases:

# Install to /dev/sda, /dev/vda or /dev/nvme0, whichever is found first
apiVersion: elemental.cattle.io/v1beta1
kind: MachineRegistration
metadata:
  name: fire-nodes
  namespace: fleet-default
spec:
  config:
    elemental:
      install:
        device-selector:
          - key: Name
            operator: In
            values:
            - /dev/sda
            - /dev/vda
            - /dev/nvme0
# Install to any device with a size between 80Gi and 200Gi
apiVersion: elemental.cattle.io/v1beta1
kind: MachineRegistration
metadata:
  name: fire-nodes
  namespace: fleet-default
spec:
  config:
    elemental:
      install:
        device-selector:
          - key: Size
            operator: Lt
            values:
            - 200Gi
          - key: Size
            operator: Gt
            values:
            - 80Gi

Fixes #543

@github-actions github-actions bot added area/operator operator related changes area/register register related changes area/tests test related changes labels Nov 2, 2023
Copy link

codecov bot commented Nov 2, 2023

Codecov Report

Attention: 73 lines in your changes are missing coverage. Please review.

Comparison is base (c546933) 54.45% compared to head (896195e) 54.27%.

Files Patch % Lines
api/v1beta1/zz_generated.deepcopy.go 0.00% 33 Missing and 1 partial ⚠️
pkg/install/install.go 55.84% 27 Missing and 7 partials ⚠️
cmd/register/main.go 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #561      +/-   ##
==========================================
- Coverage   54.45%   54.27%   -0.19%     
==========================================
  Files          39       39              
  Lines        5891     6005     +114     
==========================================
+ Hits         3208     3259      +51     
- Misses       2409     2466      +57     
- Partials      274      280       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@frelon frelon force-pushed the device-selector branch 3 times, most recently from ef6f5b5 to 84cb7fa Compare November 2, 2023 09:44
@frelon frelon marked this pull request as ready for review November 2, 2023 10:36
@frelon frelon requested a review from a team as a code owner November 2, 2023 10:36
Copy link
Contributor

@davidcassany davidcassany left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, looks great to me 👍

Signed-off-by: Fredrik Lönnegren <[email protected]>
This commit adds the implementation for picking the installation device
during registration based on a deviceSelector in the
MachineRegistration.

Signed-off-by: Fredrik Lönnegren <[email protected]>
@frelon frelon merged commit 8cf8b03 into rancher:main Nov 21, 2023
16 checks passed
@frelon frelon deleted the device-selector branch November 21, 2023 07:44
davidcassany pushed a commit that referenced this pull request Nov 23, 2023
* Add DeviceSelector types

Signed-off-by: Fredrik Lönnegren <[email protected]>

* Implement device-selector

This commit adds the implementation for picking the installation device
during registration based on a deviceSelector in the
MachineRegistration.

Signed-off-by: Fredrik Lönnegren <[email protected]>

---------

Signed-off-by: Fredrik Lönnegren <[email protected]>
(cherry picked from commit 8cf8b03)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/operator operator related changes area/register register related changes area/tests test related changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automatic installation device
2 participants