netgroup-polito / CrownLabs

Kubernetes-based Remote Laboratories
https://crownlabs.polito.it
Apache License 2.0
107 stars 42 forks source link

NFS personal storage #826

Closed matteorosani closed 1 year ago

matteorosani commented 1 year ago

Description

Problem

In this project we aimed at replacing NextCloud as the storage solution for Crownlabs. Previously NextCloud was used for the user storage and with VMs and FileBrowser was used for containers, this is suboptimal, since the files stored in one are not available in the other. NextCloud has shown reliability and performance issues, while FileBrowser is currently attached to independent volumes destroyed when an instance is deleted.

Proposed solution

In this project we developed a solution to the problem using the CephNFS CRD added in Rook v1.10. With this approach a Ceph Filesystem is created for all users and individual volumes (that are like folders inside the whole Ceph Filesystem) are shared via NFS inside the cluster. The personal volume of the user is then mounted in containers and VMs to have a unified storage solution.

The creation of the personal volume is dynamically provided, a StorageClass is defined specifying the Ceph Filesystem name, NFS service name, NFS cluster name and Ceph ClusterID. With this information when a storage request is issued (creation of a PVC for this StorageClass) the Rook operator creates a volume inside the Ceph Filesystem and creates for this volume a NFS share that can be accessed via the NFS service in the cluster. The created volume is then linked to a PV bounded to the PVC whom requested the storage in the first place.

Implementation details

The personal storage is owned by the user (Tenant) and is managed by the TenantOperator (creation and deletion) that creates also a Secret for the user to store the data necessary to access the NFS share. The Secret created for the user is used by the InstanceOperator since it has to mount the NFS share in the instances via NFS Volume Mount for containers and via CloudInit for VMs.

kingmakerbot commented 1 year ago

Hi @matteorosani. Thanks for your PR.

I am @kingmakerbot. You can interact with me issuing a slash command in the first line of a comment. Currently, I understand the following commands:

Make sure this PR appears in the CrownLabs changelog, adding one of the following labels:

Diegomangasco commented 1 year ago

Ok now we will squash commits

giorio94 commented 1 year ago

/deploy-staging

kingmakerbot commented 1 year ago

Your staging environment has been correctly deployed/updated! Available here: Frontend, Qlkube Operators: add the crownlabs.polito.it/operator-selector=staging-826 label to your tenant.

giorio94 commented 1 year ago

/deploy-staging

kingmakerbot commented 1 year ago

Your staging environment has been correctly deployed/updated! Available here: Frontend, Qlkube Operators: add the crownlabs.polito.it/operator-selector=staging-826 label to your tenant.

QcFe commented 1 year ago

/merge

kingmakerbot commented 1 year ago

Your staging environment has been correctly teared-down!