Skip to content

Commit c00b965

Browse files
committed
Add Volume Group KEP
1 parent 7070e2c commit c00b965

File tree

1 file changed

+366
-0
lines changed

1 file changed

+366
-0
lines changed
Lines changed: 366 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,366 @@
1+
---
2+
title: Volume Group
3+
authors:
4+
- "@xing-yang"
5+
- "@jingxu97"
6+
owning-sig: sig-storage
7+
participating-sigs:
8+
- sig-storage
9+
reviewers:
10+
- "@msau42"
11+
- "@saad-ali"
12+
- "@thockin"
13+
approvers:
14+
- "@msau42"
15+
- "@saad-ali"
16+
- "@thockin"
17+
editor: TBD
18+
creation-date: 2020-02-12
19+
last-updated: 2020-02-12
20+
status: provisional
21+
see-also:
22+
- n/a
23+
replaces:
24+
- n/a
25+
superseded-by:
26+
- n/a
27+
---
28+
29+
# Title
30+
31+
Volume Group
32+
33+
## Table of Contents
34+
35+
<!-- toc -->
36+
- [Summary](#summary)
37+
- [Motivation](#motivation)
38+
- [Goals](#goals)
39+
- [Non-Goals](#non-goals)
40+
- [Proposal](#proposal)
41+
- [API Definitions](#api-definitions)
42+
- [Example Yaml Files](#example-yaml-files)
43+
- [Volume Group Snapshot](#volume-group-snapshot)
44+
- [Volume Placement](#volume-placement)
45+
<!-- /toc -->
46+
47+
## Summary
48+
49+
This proposal is to introduce a VolumeGroup API to manage multiple volumes together and a GroupSnapshot API to take a snapshot of a VolumeGroup.
50+
51+
## Motivation
52+
53+
While there is already a KEP (https://github.com/kubernetes/enhancements/pull/1051) that introduces APIs to do application snapshot, backup, and restore, there are other use cases not covered by that KEP.
54+
55+
Use case 1:
56+
A VolumeGroup allows users to manage multiple volumes belonging to the same application together and therefore it is very useful in general. For example, it can be used to group all volumes in the same StatefulSet together.
57+
58+
Use case 2:
59+
For some storage systems, volumes are always managed in a group. For these storage systems, they will have to create a group for a single volume if they need to implement a create volume function in Kubernetes. Providing a VolumeGroup API will be very convenient for them.
60+
61+
Use case 3:
62+
Instead of taking individual snapshots one after another, VolumeGroup can be used as a source for taking a snapshot of all the volumes in the same volume group. This may be a storage level consistent group snapshot if the storage system supports it. In any case, when used together with ExecutionHook, this group snapshot can be application consistent. For this use case, we will introduce another CRD GroupSnapshot.
63+
64+
Use case 4:
65+
VolumeGroup can be used to manage group replication or consistency group replication if the storage system supports it. Note replication is out of scope for this proposal. It is mentioned here as a potential future use case.
66+
67+
Use case 5:
68+
VolumeGroup can be used to manage volume placement to either spread the volumes across storage pools or stack the volumes on the same storage pool. Related KEPs proposing the concept of storage pool for volume placement is as follows:
69+
https://github.com/kubernetes/enhancements/pull/1353
70+
https://github.com/kubernetes/enhancements/pull/1347
71+
We may not really need a VolumeGroup for this use case. A StoragePool is probably enough. This is to be determined.
72+
73+
Use case 6:
74+
VolumeGroup can also be used together with application snapshot. It can be a resource managed by the ApplicationSnapshot CRD.
75+
76+
Use case 7:
77+
Some applications may not want to use ApplicationSnapshot CRD because they don’t use Kubernetes workload APIs such as StatefulSet, Deployment, etc. Instead, they have developed their own operators. In this case it is more convenient to use VolumeGroup to manage persistent volumes used in those applications.
78+
79+
### Goals
80+
81+
* Provide an API to manage multiple volumes together in a group.
82+
* Provide an API to take a snapshot of a group of volumes.
83+
* Provide a design to facilitate volume placement using the group API (To be determined).
84+
* The group API should be generic and extensible so that it may be used to support other features in the future.
85+
86+
### Non-Goals
87+
88+
* A VolumeGroup may potentially be used to support replication group in the future, but providing design on replication group is not in the scope of this KEP. This can be discussed in the future.
89+
90+
## Proposal
91+
92+
This proposal introduces new CRDs VolumeGroup, VolumeGroupClass, and GroupSnapshot.
93+
94+
Create new group:
95+
There are two ways to create a new VolumeGroup.
96+
* Create a group with existing volumes, either with a list of PVCs or using a selector.
97+
* Create an empty group first, then create each individual volume with group_id which will add a volume to the already created group.
98+
99+
Snapshot:
100+
A GroupSnapshot can be created with a VolumeGroup as the source.
101+
102+
Restore:
103+
* In the restore case, a VolumeGroup can be created from a GroupSnapshot source.
104+
* We could also achieve this by creating a volume from a snapshot for all the snapshots in the GroupSnapshot, and then create a group with those restored volumes.
105+
106+
For the volume placement support, it assumes that storage pools exist on storage systems already. In VolumeGroupClass, there is an AllowedTopologies field that can be used to specify the accessibility of the group of volumes to storage pools and nodes. However it won’t have a field to track the capacities of the storage pools.
107+
108+
### API Definitions
109+
110+
API definitions are as follows:
111+
112+
```
113+
type VolumeGroupClass struct {
114+
metav1.TypeMeta
115+
// +optional
116+
metav1.ObjectMeta
117+
118+
// Driver is the driver expected to handle this VolumeGroupClass.
119+
// This value may not be empty.
120+
Driver string
121+
122+
// Parameters holds parameters for driver.
123+
// These values are opaque to the system and are passed directly
124+
// to the driver.
125+
// +optional
126+
Parameters map[string]string
127+
128+
// This field specifies whether group snapshot is supported.
129+
// The default is false.
130+
// +optional
131+
GroupSnapshot *bool
132+
133+
// Restrict the topologies where a group of volumes can be located.
134+
// Each driver defines its own supported topology specifications.
135+
// An empty TopologySelectorTerm list means there is no topology restriction.
136+
// This field is passed on to the drivers to handle placement of a group of
137+
// volumes on storage pools.
138+
// +optional
139+
AllowedTopologies []api.TopologySelectorTerm
140+
}
141+
142+
// VolumeGroup is a user's request for a group of volumes
143+
type VolumeGroup struct {
144+
metav1.TypeMeta
145+
// +optional
146+
metav1.ObjectMeta
147+
148+
// Spec defines the volume group requested by a user
149+
Spec VolumeGroupSpec
150+
151+
// Status represents the current information about a volume group
152+
// +optional
153+
Status *VolumeGroupStatus
154+
}
155+
156+
// VolumeGroupSpec describes the common attributes of group storage devices
157+
// and allows a Source for provider-specific attributes
158+
Type VolumeGroupSpec struct {
159+
// +optional
160+
VolumeGroupClassName *string
161+
162+
// If Source is nil, an empty volume group will be created.
163+
// Otherwise, a volume group will be created with PVCs (if PVCList or Select is set) or
164+
// with a GroupSnapshot as data source
165+
// +optional
166+
Source *VolumeGroupSource
167+
}
168+
169+
// VolumeGroupSource contains 3 options. If VolumeGroupSource is not nil,
170+
// one of the 3 options must be defined.
171+
Type VolumeGroupSource struct {
172+
// A list of existing persistent volume claims
173+
// +optional
174+
PVCList []PersistentVolumeClaim
175+
176+
// A label query over existing persistent volume claims to be added to the volume group.
177+
// +optional
178+
Selector *metav1.LabelSelector
179+
180+
// This field specifies the source of a volume group. (this is for restore)
181+
// Supported Kind is GroupSnapshot
182+
// +optional
183+
GroupDataSource *TypedLocalObjectReference
184+
}
185+
186+
type VolumeGroupStatus struct {
187+
GroupCreationTime *metav1.Time
188+
189+
// A list of persistent volume claims
190+
// +optional
191+
PVCList []PersistentVolumeClaim
192+
193+
Ready *bool
194+
195+
// Last error encountered during group creation
196+
Error *VolumeGroupError
197+
}
198+
199+
// Describes an error encountered on the group
200+
type VolumeGroupError struct {
201+
// time is the timestamp when the error was encountered.
202+
// +optional
203+
Time *metav1.Time
204+
205+
// message details the encountered error
206+
// +optional
207+
Message *string
208+
}
209+
210+
// GroupSnapshot is a user's request for taking a group snapshot.
211+
type GroupSnapshot struct {
212+
metav1.TypeMeta `json:",inline"`
213+
// Standard object's metadata.
214+
// +optional
215+
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
216+
217+
// Spec defines the desired characteristics of a group snapshot requested by a user.
218+
Spec GroupSnapshotSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
219+
220+
// Status represents the latest observed state of the group snapshot
221+
// +optional
222+
Status *GroupSnapshotStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
223+
}
224+
225+
// GroupSnapshotSpec describes the common attributes of a group snapshot
226+
type GroupSnapshotSpec struct {
227+
// Source has the information about where the group snapshot is created from.
228+
// Supported Kind is VolumeGroup
229+
// +optional
230+
Source *TypedLocalObjectReference `json:"source" protobuf:"bytes,1,opt,name=source"`
231+
}
232+
233+
Type GroupSnapshotStatus struct {
234+
235+
// ReadyToUse becomes true when ReadyToUse on all individual snapshots become true
236+
// +optional
237+
ReadyToUse *bool
238+
239+
// List of volume snapshots
240+
SnapshotList []VolumeSnapshot
241+
}
242+
243+
type PersistentVolumeClaimSpec struct {
244+
......
245+
VolumeGroupNames []string
246+
......
247+
}
248+
249+
250+
type VolumeSnapshotSpec struct{
251+
......
252+
GroupSnapshotName *string
253+
......
254+
}
255+
```
256+
257+
### Example Yaml Files
258+
259+
#### Volume Group Snapshot
260+
261+
Example yaml files to define a VolumeGroupClass and VolumeGroup are in the following.
262+
263+
A VolumeGroupClass that supports groupSnapshot:
264+
```
265+
apiVersion: volumegroup.storage.k8s.io/v1alpha1
266+
kind: VolumeGroupClass
267+
metadata:
268+
name: volumeGroupClass1
269+
spec:
270+
parameters:
271+
…...
272+
groupSnapshot: true
273+
```
274+
275+
A VolumeGroup belongs to this VolumeGroupClass:
276+
```
277+
apiVersion: volumegroup.storage.k8s.io/v1alpha1
278+
kind: VolumeGroup
279+
metadata:
280+
Name: volumeGroup1
281+
spec:
282+
volumeGroupClassName: volumeGroupClass1
283+
selector:
284+
matchLabels:
285+
app: my-app
286+
```
287+
288+
A GroupSnapshot taken from the VolumeGroup:
289+
```
290+
apiVersion: volumegroup.storage.k8s.io/v1alpha1
291+
kind: GroupSnapshot
292+
metadata:
293+
name: my-group-snapshot
294+
spec:
295+
source:
296+
name: volumeGroup1
297+
kind: VolumeGroup
298+
apiGroup: volumegroup.storage.k8s.io
299+
```
300+
301+
A PVC that belongs to the volume group which supports groupSnapshot:
302+
```
303+
apiVersion: v1
304+
kind: PersistentVolumeClaim
305+
metadata:
306+
name: pvc1
307+
annotations:
308+
spec:
309+
accessModes:
310+
- ReadWriteOnce
311+
dataSource: null
312+
resources:
313+
requests:
314+
storage: 1Gi
315+
storageClassName: storageClass1
316+
volumeMode: Filesystem
317+
volumeGroupNames: [volumeGroup1]
318+
```
319+
320+
#### Volume Placement
321+
322+
A VolumeGroupClass that supports placement:
323+
```
324+
apiVersion: volumegroup.storage.k8s.io/v1alpha1
325+
kind: VolumeGroupClass
326+
metadata:
327+
name: placementGroupClass1
328+
spec:
329+
parameters:
330+
…...
331+
allowedTopologies: [failure-domain.example.com/placement: storagePool1]
332+
```
333+
```
334+
apiVersion: volumegroup.storage.k8s.io/v1alpha1
335+
kind: VolumeGroup
336+
metadata:
337+
Name: placemenGroup1
338+
spec:
339+
volumeGroupClassName: placementGroupClass1
340+
```
341+
342+
A PVC that belongs to both the volume group with groupSnapshot support and placement.
343+
```
344+
apiVersion: v1
345+
kind: PersistentVolumeClaim
346+
metadata:
347+
name: pvc1
348+
annotations:
349+
spec:
350+
accessModes:
351+
- ReadWriteOnce
352+
dataSource: null
353+
resources:
354+
requests:
355+
storage: 1Gi
356+
storageClassName: storageClass1
357+
volumeMode: Filesystem
358+
volumeGroupNames: [volumeGroup1, placementGroup1]
359+
```
360+
361+
Note: More details on VolumeGroup and VolumeGroupClass related changes in CSI Spec will be added after we make decisions on how to proceed with the design, i.e., should we drop the placement part.
362+
363+
A new external controller will handle VolumeGroupClass and VolumeGroup resources.
364+
External provisioner will be modified to read information from volume groups (through volumeGroupNames) and pass them down to the CSI driver.
365+
366+
If both placement group and volume group with groupSnapshot support are defined, it is possible for the same volume to join both groups. For example, a volume group with groupSnapshot support may include volume members from two placement groups as they belong to the same application.

0 commit comments

Comments
 (0)