Skip to content

Commit

Permalink
Merge pull request #9384 from leseb/fix-7036
Browse files Browse the repository at this point in the history
subvolumegroup: add new crd
  • Loading branch information
BlaineEXE committed Dec 21, 2021
2 parents cb1b063 + 6e9eb33 commit bb0d0d3
Show file tree
Hide file tree
Showing 31 changed files with 1,692 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 @@ -71,6 +71,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 60 sh -c "until kubectl -n rook-ceph exec $toolbox -- ceph fs subvolumegroup ls myfs|jq .[0].name|grep -q "group-a"; 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
42 changes: 42 additions & 0 deletions Documentation/ceph-fs-subvolumegroup.md
@@ -0,0 +1,42 @@
---
title: SubVolumeGroup 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: group-a
namespace: rook-ceph # namespace:cluster
spec:
# filesystemName is the metadata name of the CephFilesystem CR where the subvolume group will be created
filesystemName: 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.

### CephFilesystemSubVolumeGroup spec

- `filesystemName`: The metadata name of the CephFilesystem CR where the subvolume group will be created.
89 changes: 89 additions & 0 deletions deploy/charts/rook-ceph/templates/resources.yaml
Expand Up @@ -5816,6 +5816,28 @@ spec:
status:
description: CephFilesystemStatus represents the status of a Ceph Filesystem
properties:
conditions:
items:
description: Condition represents a status condition on any Rook-Ceph Custom Resource.
properties:
lastHeartbeatTime:
format: date-time
type: string
lastTransitionTime:
format: date-time
type: string
message:
type: string
reason:
description: ConditionReason is a reason for a condition
type: string
status:
type: string
type:
description: ConditionType represent a resource's status
type: string
type: object
type: array
info:
additionalProperties:
type: string
Expand Down Expand Up @@ -5979,6 +6001,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:
filesystemName:
description: FilesystemName is the name of Ceph Filesystem SubVolumeGroup volume name. Typically it's the name of the CephFilesystem CR. If not coming from the CephFilesystem CR, it can be retrieved from the list of Ceph Filesystem volumes with `ceph fs volume ls`. To learn more about Ceph Filesystem abstractions see https://docs.ceph.com/en/latest/cephfs/fs-volumes/#fs-volumes-and-subvolumes
type: string
required:
- filesystemName
type: object
status:
description: Status represents the status of a CephFilesystem SubvolumeGroup
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
88 changes: 88 additions & 0 deletions deploy/examples/crds.yaml
Expand Up @@ -5813,6 +5813,28 @@ spec:
status:
description: CephFilesystemStatus represents the status of a Ceph Filesystem
properties:
conditions:
items:
description: Condition represents a status condition on any Rook-Ceph Custom Resource.
properties:
lastHeartbeatTime:
format: date-time
type: string
lastTransitionTime:
format: date-time
type: string
message:
type: string
reason:
description: ConditionReason is a reason for a condition
type: string
status:
type: string
type:
description: ConditionType represent a resource's status
type: string
type: object
type: array
info:
additionalProperties:
type: string
Expand Down Expand Up @@ -5976,6 +5998,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:
filesystemName:
description: FilesystemName is the name of Ceph Filesystem SubVolumeGroup volume name. Typically it's the name of the CephFilesystem CR. If not coming from the CephFilesystem CR, it can be retrieved from the list of Ceph Filesystem volumes with `ceph fs volume ls`. To learn more about Ceph Filesystem abstractions see https://docs.ceph.com/en/latest/cephfs/fs-volumes/#fs-volumes-and-subvolumes
type: string
required:
- filesystemName
type: object
status:
description: Status represents the status of a CephFilesystem SubvolumeGroup
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: group-a
namespace: rook-ceph # namespace:cluster
spec:
# filesystemName is the metadata name of the CephFilesystem CR where the subvolume group will be created
filesystemName: 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
21 changes: 21 additions & 0 deletions pkg/apis/ceph.rook.io/v1/filesystem.go
@@ -0,0 +1,21 @@
/*
Copyright 2021 The Rook Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1

func (c *CephFilesystem) GetStatusConditions() *[]Condition {
return &c.Status.Conditions
}
2 changes: 2 additions & 0 deletions pkg/apis/ceph.rook.io/v1/register.go
Expand Up @@ -83,6 +83,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&CephRBDMirrorList{},
&CephFilesystemMirror{},
&CephFilesystemMirrorList{},
&CephFilesystemSubVolumeGroup{},
&CephFilesystemSubVolumeGroupList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
scheme.AddKnownTypes(bktv1alpha1.SchemeGroupVersion,
Expand Down
45 changes: 45 additions & 0 deletions pkg/apis/ceph.rook.io/v1/types.go
Expand Up @@ -1096,6 +1096,7 @@ type CephFilesystemStatus struct {
// MirroringStatus is the filesystem mirroring status
// +optional
MirroringStatus *FilesystemMirroringInfoSpec `json:"mirroringStatus,omitempty"`
Conditions []Condition `json:"conditions,omitempty"`
}

// FilesystemMirroringInfo is the status of the pool mirroring
Expand Down Expand Up @@ -2302,3 +2303,47 @@ 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 CephFilesystem SubvolumeGroup
// +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 {
// FilesystemName is the name of Ceph Filesystem SubVolumeGroup volume name. Typically it's the name of
// the CephFilesystem CR. If not coming from the CephFilesystem CR, it can be retrieved from the
// list of Ceph Filesystem volumes with `ceph fs volume ls`. To learn more about Ceph Filesystem
// abstractions see https://docs.ceph.com/en/latest/cephfs/fs-volumes/#fs-volumes-and-subvolumes
FilesystemName string `json:"filesystemName"`
}

// 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 bb0d0d3

Please sign in to comment.