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

Add lvm provisioner #128

Merged
merged 2 commits into from
Sep 12, 2024
Merged

Conversation

Vicente-Cheng
Copy link
Collaborator

Problem:
Add LVM provisioner

Solution:
Add LVM provisioner

Related Issue:
harvester/harvester#6014
harvester/harvester#5724

Test plan:
TBD

@Vicente-Cheng Vicente-Cheng force-pushed the add-lvm-provisioner branch 2 times, most recently from abe41ff to f83ecd5 Compare September 5, 2024 15:47
@Vicente-Cheng
Copy link
Collaborator Author

codeFactor complains about the generated code. Please ignore that.

Copy link
Member

@bk201 bk201 left a comment

Choose a reason for hiding this comment

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

Thanks, overall works well, just some suggestions.

pkg/controller/volumegroup/controller.go Outdated Show resolved Hide resolved
pkg/controller/volumegroup/controller.go Outdated Show resolved Hide resolved
pkg/provisioner/lvm.go Outdated Show resolved Hide resolved
pkg/provisioner/lvm.go Outdated Show resolved Hide resolved
pkg/lvm/lvm.go Outdated Show resolved Hide resolved
pkg/lvm/lvm.go Outdated Show resolved Hide resolved
pkg/lvm/lvm.go Outdated Show resolved Hide resolved
Copy link
Contributor

@tserong tserong left a comment

Choose a reason for hiding this comment

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

Looks good in general, I just noticed a couple of things

pkg/provisioner/lvm.go Outdated Show resolved Hide resolved
pkg/controller/volumegroup/controller.go Outdated Show resolved Hide resolved
pkg/controller/volumegroup/controller.go Outdated Show resolved Hide resolved
  - Also move types.go to blockdevice.go
  - Add new field `spec.provisioned`

Signed-off-by: Vicente Cheng <vicente.cheng@suse.com>
@Vicente-Cheng Vicente-Cheng force-pushed the add-lvm-provisioner branch 2 times, most recently from 4f4cb86 to bbd213e Compare September 11, 2024 02:46
Copy link
Contributor

@tserong tserong left a comment

Choose a reason for hiding this comment

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

I did a build of this and gave it a quick test on a single node cluster with two extra disks, and it works nicely (I provisioned and unprovisioned both disks to the same VG and it looks like it's behaving correctly).

Regarding the NotFoundError, it might be preferable to import "k8s.io/apimachinery/pkg/api/errors" then call errors.NewNotFound(...) to create the error, and errors.IsNotFound() to check it, rather than having our own error variable. If that makes sense, you can ignore my comments below regarding error variable naming and import paths :-)

pkg/provisioner/lvm.go Outdated Show resolved Hide resolved
pkg/provisioner/lvm.go Outdated Show resolved Hide resolved
pkg/provisioner/lvm.go Outdated Show resolved Hide resolved
    - Now we could use the following fields to provision the volume group

    ```
    Spec:
      provisioner:
        lvm:
          vgName: vg001
    ```

    - Introduce the new field to trigger provision

    ```
    Spec:
      provision: true
    ```

    - The new CRD lvmvgs is introduced, this will contain the node info
      and the volume group information.

Signed-off-by: Vicente Cheng <vicente.cheng@suse.com>
Copy link
Member

@bk201 bk201 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@tserong tserong left a comment

Choose a reason for hiding this comment

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

LGTM!

@tserong tserong merged commit a6b3584 into harvester:master Sep 12, 2024
5 of 6 checks passed
@tserong
Copy link
Contributor

tserong commented Sep 12, 2024

@Mergifyio backport v0.7.x

Copy link

mergify bot commented Sep 12, 2024

backport v0.7.x

✅ Backports have been created

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants