Skip to content

Commit

Permalink
subvolumegroup: add new crd
Browse files Browse the repository at this point in the history
This introduces a new CRD to add the ability to create subvolumegroup
for a given ceph filesystem volume. Typically the name of the volume is
the name of the filesystem created by rook.

Closes: #7036
Signed-off-by: Sébastien Han <seb@redhat.com>
  • Loading branch information
leseb committed Dec 10, 2021
1 parent 9299e32 commit 93e3b7b
Show file tree
Hide file tree
Showing 25 changed files with 1,305 additions and 1 deletion.
1 change: 1 addition & 0 deletions .commitlintrc.json
Expand Up @@ -29,6 +29,7 @@
"rbd-mirror",
"rgw",
"security",
"subvolumegroup",
"test"
]
],
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/canary-integration-test.yml
Expand Up @@ -66,6 +66,11 @@ jobs:
# copy the test file
# execute the test file
- name: wait for the subvolumegroup to be created
run: |
toolbox=$(kubectl get pod -l app=rook-ceph-tools -n rook-ceph -o jsonpath='{.items[*].metadata.name}')
timeout 15 sh -c "until kubectl -n rook-ceph exec $toolbox -- ceph fs subvolumegroup ls myfs|jq .[0].name|grep -q "my-subvolumegroup"; do sleep 1 && echo 'waiting for the subvolumegroup to be created'; done"
- name: check-ownerreferences
run: tests/scripts/github-action-helper.sh check_ownerreferences

Expand Down
44 changes: 44 additions & 0 deletions Documentation/ceph-fs-subvolumegroup.md
@@ -0,0 +1,44 @@
---
title: CephFilesystemSubVolumeGroup CRD
weight: 3610
indent: true
---

{% include_relative branch.liquid %}

This guide assumes you have created a Rook cluster as explained in the main [Quickstart guide](quickstart.md)

# CephFilesystemSubVolumeGroup CRD

Rook allows creation of Ceph Filesystem [SubVolumeGroups](https://docs.ceph.com/en/latest/cephfs/fs-volumes/#fs-subvolume-groups) through the custom resource definitions (CRDs).
Filesystem subvolume groups are an abstraction for a directory level higher than Filesystem subvolumes to effect policies (e.g., File layouts) across a set of subvolumes.
For more information about CephFS volume, subvolumegroup and subvolume refer to the [Ceph docs](https://docs.ceph.com/en/latest/cephfs/fs-volumes/#fs-volumes-and-subvolumes).

## Creating daemon

To get you started, here is a simple example of a CRD to create a subvolumegroup on the CephFilesystem "myfs".

```yaml
apiVersion: ceph.rook.io/v1
kind: CephFilesystemSubVolumeGroup
metadata:
name: my-subvolumegroup
namespace: rook-ceph # namespace:cluster
spec:
# volumeName is the name of the CephFilesystem CR
volumeName: myfs
```

## Settings

If any setting is unspecified, a suitable default will be used automatically.

### CephFilesystemSubVolumeGroup metadata

- `name`: The name that will be used for the Ceph Filesystem subvolume group.
- `namespace`: The Kubernetes namespace that will be created for the Rook cluster. The services, pods, and other resources created by the operator will be added to this namespace.


### CephFilesystemSubVolumeGroup spec

- `volumeName`: The name of the Ceph Filesystem volume.
4 changes: 4 additions & 0 deletions PendingReleaseNotes.md
Expand Up @@ -4,3 +4,7 @@


## Features

### Ceph

- Add the ability to create Ceph Filesystem SubVolumeGroup via a new CRD, refer to the [configuration](Documentation/ceph-fs-subvolumegroup.md) for more details
9 changes: 9 additions & 0 deletions deploy/examples/subvolumegroup.yaml
@@ -0,0 +1,9 @@
---
apiVersion: ceph.rook.io/v1
kind: CephFilesystemSubVolumeGroup
metadata:
name: my-subvolumegroup
namespace: rook-ceph # namespace:cluster
spec:
# volumeName is the name of the CephFilesystem CR
volumeName: myfs
5 changes: 5 additions & 0 deletions deploy/olm/assemble/metadata-common.yaml
Expand Up @@ -163,6 +163,11 @@ spec:
version: v1
displayName: Ceph Bucket Topic
description: Represents a Ceph Bucket Topic.
- kind: CephFilesystemSubVolumeGroup
name: cephfilesystemsubvolumegroups.ceph.rook.io
version: v1
displayName: Ceph Filesystem SubVolumeGroup
description: Represents a Ceph Filesystem SubVolumeGroup.
displayName: Rook-Ceph
description: |
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/ceph.rook.io/v1/register.go
Expand Up @@ -83,6 +83,7 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&CephRBDMirrorList{},
&CephFilesystemMirror{},
&CephFilesystemMirrorList{},
&CephFilesystemSubVolumeGroup{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
scheme.AddKnownTypes(bktv1alpha1.SchemeGroupVersion,
Expand Down
42 changes: 42 additions & 0 deletions pkg/apis/ceph.rook.io/v1/types.go
Expand Up @@ -2282,3 +2282,45 @@ type StorageClassDeviceSet struct {
// +optional
Encrypted bool `json:"encrypted,omitempty"`
}

// +genclient
// +genclient:noStatus
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// CephFilesystemSubVolumeGroup represents a Ceph Filesystem SubVolumeGroup
// +kubebuilder:subresource:status
type CephFilesystemSubVolumeGroup struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`
// Spec represents the specification of a Ceph Filesystem SubVolumeGroup
Spec CephFilesystemSubVolumeGroupSpec `json:"spec"`
// Status represents the status of a Ceph Client
// +kubebuilder:pruning:PreserveUnknownFields
// +optional
Status *CephFilesystemSubVolumeGroupStatus `json:"status,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// CephFilesystemSubVolumeGroup represents a list of Ceph Clients
type CephFilesystemSubVolumeGroupList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []CephFilesystemSubVolumeGroup `json:"items"`
}

// CephFilesystemSubVolumeGroupSpec represents the specification of a Ceph Filesystem SubVolumeGroup
type CephFilesystemSubVolumeGroupSpec struct {
// VolName is the name of Ceph Filesystem SubVolumeGroup volume name, typically it's the name of
// the CephFilesystem CR.
VolumeName string `json:"volumeName"`
}

// CephFilesystemSubVolumeGroupStatus represents the Status of Ceph Filesystem SubVolumeGroup
type CephFilesystemSubVolumeGroupStatus struct {
// +optional
Phase ConditionType `json:"phase,omitempty"`
// +optional
// +nullable
Info map[string]string `json:"info,omitempty"`
}
104 changes: 104 additions & 0 deletions pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 93e3b7b

Please sign in to comment.