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 13, 2021
1 parent 200fb56 commit 6d64701
Show file tree
Hide file tree
Showing 27 changed files with 1,438 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
67 changes: 67 additions & 0 deletions deploy/charts/rook-ceph/templates/resources.yaml
Expand Up @@ -5970,6 +5970,73 @@ status:
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.5.1-0.20210420220833-f284e2e8098c
helm.sh/resource-policy: keep
creationTimestamp: null
name: cephfilesystemsubvolumegroups.ceph.rook.io
spec:
group: ceph.rook.io
names:
kind: CephFilesystemSubVolumeGroup
listKind: CephFilesystemSubVolumeGroupList
plural: cephfilesystemsubvolumegroups
singular: cephfilesystemsubvolumegroup
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: CephFilesystemSubVolumeGroup represents a Ceph Filesystem SubVolumeGroup
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: Spec represents the specification of a Ceph Filesystem SubVolumeGroup
properties:
volumeName:
description: VolName is the name of Ceph Filesystem SubVolumeGroup volume name, typically it's the name of the CephFilesystem CR.
type: string
required:
- volumeName
type: object
status:
description: Status represents the status of a Ceph Client
properties:
info:
additionalProperties:
type: string
nullable: true
type: object
phase:
description: ConditionType represent a resource's status
type: string
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- metadata
- spec
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.5.1-0.20210420220833-f284e2e8098c
Expand Down
66 changes: 66 additions & 0 deletions deploy/examples/crds.yaml
Expand Up @@ -5967,6 +5967,72 @@ status:
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.5.1-0.20210420220833-f284e2e8098c
creationTimestamp: null
name: cephfilesystemsubvolumegroups.ceph.rook.io
spec:
group: ceph.rook.io
names:
kind: CephFilesystemSubVolumeGroup
listKind: CephFilesystemSubVolumeGroupList
plural: cephfilesystemsubvolumegroups
singular: cephfilesystemsubvolumegroup
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: CephFilesystemSubVolumeGroup represents a Ceph Filesystem SubVolumeGroup
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: Spec represents the specification of a Ceph Filesystem SubVolumeGroup
properties:
volumeName:
description: VolName is the name of Ceph Filesystem SubVolumeGroup volume name, typically it's the name of the CephFilesystem CR.
type: string
required:
- volumeName
type: object
status:
description: Status represents the status of a Ceph Client
properties:
info:
additionalProperties:
type: string
nullable: true
type: object
phase:
description: ConditionType represent a resource's status
type: string
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- metadata
- spec
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.5.1-0.20210420220833-f284e2e8098c
Expand Down
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"`
}

0 comments on commit 6d64701

Please sign in to comment.