Skip to content

Commit d5d13cb

Browse files
authored
feat(scheduling): add volume group capacity tracking (#21) (#33)
Signed-off-by: Yashpal Choudhary <[email protected]>
1 parent 7c9d1e3 commit d5d13cb

File tree

26 files changed

+2373
-7
lines changed

26 files changed

+2373
-7
lines changed

buildscripts/generate-manifests.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,21 @@ echo '
6161
cat deploy/yamls/local.openebs.io_lvmsnapshots.yaml >> deploy/yamls/lvmsnapshot-crd.yaml
6262
rm deploy/yamls/local.openebs.io_lvmsnapshots.yaml
6363

64+
echo '
65+
66+
##############################################
67+
########### ############
68+
########### LVMNode CRD ############
69+
########### ############
70+
##############################################
71+
72+
# LVMNode CRD is autogenerated via `make manifests` command.
73+
# Do the modification in the code and run the `make manifests` command
74+
# to generate the CRD definition' > deploy/yamls/lvmnode-crd.yaml
75+
76+
cat deploy/yamls/local.openebs.io_lvmnodes.yaml >> deploy/yamls/lvmnode-crd.yaml
77+
rm deploy/yamls/local.openebs.io_lvmnodes.yaml
78+
6479
## create the operator file using all the yamls
6580

6681
echo '# This manifest is autogenerated via `make manifests` command
@@ -80,6 +95,9 @@ cat deploy/yamls/lvmvolume-crd.yaml >> deploy/lvm-operator.yaml
8095
# Add LVMSnapshot v1alpha1 CRDs to the Operator yaml
8196
cat deploy/yamls/lvmsnapshot-crd.yaml >> deploy/lvm-operator.yaml
8297

98+
# Add LVMNode v1alpha1 CRDs to the Operator yaml
99+
cat deploy/yamls/lvmnode-crd.yaml >> deploy/lvm-operator.yaml
100+
83101
# Add the driver deployment to the Operator yaml
84102
cat deploy/yamls/lvm-driver.yaml >> deploy/lvm-operator.yaml
85103

deploy/lvm-operator.yaml

Lines changed: 117 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,118 @@ status:
260260
conditions: []
261261
storedVersions: []
262262

263+
264+
##############################################
265+
########### ############
266+
########### LVMNode CRD ############
267+
########### ############
268+
##############################################
269+
270+
# LVMNode CRD is autogenerated via `make manifests` command.
271+
# Do the modification in the code and run the `make manifests` command
272+
# to generate the CRD definition
273+
274+
---
275+
apiVersion: apiextensions.k8s.io/v1beta1
276+
kind: CustomResourceDefinition
277+
metadata:
278+
annotations:
279+
controller-gen.kubebuilder.io/version: v0.2.8
280+
creationTimestamp: null
281+
name: lvmnodes.local.openebs.io
282+
spec:
283+
group: local.openebs.io
284+
names:
285+
kind: LVMNode
286+
listKind: LVMNodeList
287+
plural: lvmnodes
288+
shortNames:
289+
- lvmnode
290+
singular: lvmnode
291+
preserveUnknownFields: false
292+
scope: Namespaced
293+
validation:
294+
openAPIV3Schema:
295+
description: LVMNode records information about all lvm volume groups available
296+
in a node. In general, the openebs node-agent creates the LVMNode object &
297+
periodically synchronizing the volume groups available in the node. LVMNode
298+
has an owner reference pointing to the corresponding node object.
299+
properties:
300+
apiVersion:
301+
description: 'APIVersion defines the versioned schema of this representation
302+
of an object. Servers should convert recognized schemas to the latest
303+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
304+
type: string
305+
kind:
306+
description: 'Kind is a string value representing the REST resource this
307+
object represents. Servers may infer this from the endpoint the client
308+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
309+
type: string
310+
metadata:
311+
type: object
312+
volumeGroups:
313+
items:
314+
description: VolumeGroup specifies attributes of a given vg exists on
315+
node.
316+
properties:
317+
free:
318+
anyOf:
319+
- type: integer
320+
- type: string
321+
description: Free specifies the available capacity of volume group.
322+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
323+
x-kubernetes-int-or-string: true
324+
lvCount:
325+
description: LVCount denotes total number of logical volumes in volume
326+
group.
327+
format: int32
328+
minimum: 0
329+
type: integer
330+
name:
331+
description: Name of the lvm volume group.
332+
minLength: 1
333+
type: string
334+
pvCount:
335+
description: PVCount denotes total number of physical volumes constituting
336+
the volume group.
337+
format: int32
338+
minimum: 0
339+
type: integer
340+
size:
341+
anyOf:
342+
- type: integer
343+
- type: string
344+
description: Size specifies the total size of volume group.
345+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
346+
x-kubernetes-int-or-string: true
347+
uuid:
348+
description: UUID denotes a unique identity of a lvm volume group.
349+
minLength: 1
350+
type: string
351+
required:
352+
- free
353+
- lvCount
354+
- name
355+
- pvCount
356+
- size
357+
- uuid
358+
type: object
359+
type: array
360+
required:
361+
- volumeGroups
362+
type: object
363+
version: v1alpha1
364+
versions:
365+
- name: v1alpha1
366+
served: true
367+
storage: true
368+
status:
369+
acceptedNames:
370+
kind: ""
371+
plural: ""
372+
conditions: []
373+
storedVersions: []
374+
263375
---
264376

265377
# Create the CSI Driver object
@@ -939,6 +1051,9 @@ rules:
9391051
- apiGroups: ["storage.k8s.io"]
9401052
resources: ["storageclasses", "csinodes"]
9411053
verbs: ["get", "list", "watch"]
1054+
- apiGroups: [ "storage.k8s.io" ]
1055+
resources: [ "csistoragecapacities"]
1056+
verbs: ["*"]
9421057
- apiGroups: [""]
9431058
resources: ["events"]
9441059
verbs: ["list", "watch", "create", "update", "patch"]
@@ -952,7 +1067,7 @@ rules:
9521067
resources: ["pods"]
9531068
verbs: ["get", "list", "watch", "update", "patch"]
9541069
- apiGroups: ["local.openebs.io"]
955-
resources: ["lvmvolumes", "lvmsnapshots"]
1070+
resources: ["lvmvolumes", "lvmsnapshots", "lvmnodes"]
9561071
verbs: ["*"]
9571072
---
9581073

@@ -1159,7 +1274,7 @@ rules:
11591274
resources: ["persistentvolumes", "nodes", "services"]
11601275
verbs: ["get", "list"]
11611276
- apiGroups: ["local.openebs.io"]
1162-
resources: ["lvmvolumes", "lvmsnapshots"]
1277+
resources: ["lvmvolumes", "lvmsnapshots", "lvmnodes"]
11631278
verbs: ["get", "list", "watch", "create", "update", "patch"]
11641279

11651280
---

deploy/yamls/lvm-driver.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,9 @@ rules:
678678
- apiGroups: ["storage.k8s.io"]
679679
resources: ["storageclasses", "csinodes"]
680680
verbs: ["get", "list", "watch"]
681+
- apiGroups: [ "storage.k8s.io" ]
682+
resources: [ "csistoragecapacities"]
683+
verbs: ["*"]
681684
- apiGroups: [""]
682685
resources: ["events"]
683686
verbs: ["list", "watch", "create", "update", "patch"]
@@ -691,7 +694,7 @@ rules:
691694
resources: ["pods"]
692695
verbs: ["get", "list", "watch", "update", "patch"]
693696
- apiGroups: ["local.openebs.io"]
694-
resources: ["lvmvolumes", "lvmsnapshots"]
697+
resources: ["lvmvolumes", "lvmsnapshots", "lvmnodes"]
695698
verbs: ["*"]
696699
---
697700

@@ -898,7 +901,7 @@ rules:
898901
resources: ["persistentvolumes", "nodes", "services"]
899902
verbs: ["get", "list"]
900903
- apiGroups: ["local.openebs.io"]
901-
resources: ["lvmvolumes", "lvmsnapshots"]
904+
resources: ["lvmvolumes", "lvmsnapshots", "lvmnodes"]
902905
verbs: ["get", "list", "watch", "create", "update", "patch"]
903906

904907
---

deploy/yamls/lvmnode-crd.yaml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
2+
3+
##############################################
4+
########### ############
5+
########### LVMNode CRD ############
6+
########### ############
7+
##############################################
8+
9+
# LVMNode CRD is autogenerated via `make manifests` command.
10+
# Do the modification in the code and run the `make manifests` command
11+
# to generate the CRD definition
12+
13+
---
14+
apiVersion: apiextensions.k8s.io/v1beta1
15+
kind: CustomResourceDefinition
16+
metadata:
17+
annotations:
18+
controller-gen.kubebuilder.io/version: v0.2.8
19+
creationTimestamp: null
20+
name: lvmnodes.local.openebs.io
21+
spec:
22+
group: local.openebs.io
23+
names:
24+
kind: LVMNode
25+
listKind: LVMNodeList
26+
plural: lvmnodes
27+
shortNames:
28+
- lvmnode
29+
singular: lvmnode
30+
preserveUnknownFields: false
31+
scope: Namespaced
32+
validation:
33+
openAPIV3Schema:
34+
description: LVMNode records information about all lvm volume groups available
35+
in a node. In general, the openebs node-agent creates the LVMNode object &
36+
periodically synchronizing the volume groups available in the node. LVMNode
37+
has an owner reference pointing to the corresponding node object.
38+
properties:
39+
apiVersion:
40+
description: 'APIVersion defines the versioned schema of this representation
41+
of an object. Servers should convert recognized schemas to the latest
42+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
43+
type: string
44+
kind:
45+
description: 'Kind is a string value representing the REST resource this
46+
object represents. Servers may infer this from the endpoint the client
47+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
48+
type: string
49+
metadata:
50+
type: object
51+
volumeGroups:
52+
items:
53+
description: VolumeGroup specifies attributes of a given vg exists on
54+
node.
55+
properties:
56+
free:
57+
anyOf:
58+
- type: integer
59+
- type: string
60+
description: Free specifies the available capacity of volume group.
61+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
62+
x-kubernetes-int-or-string: true
63+
lvCount:
64+
description: LVCount denotes total number of logical volumes in volume
65+
group.
66+
format: int32
67+
minimum: 0
68+
type: integer
69+
name:
70+
description: Name of the lvm volume group.
71+
minLength: 1
72+
type: string
73+
pvCount:
74+
description: PVCount denotes total number of physical volumes constituting
75+
the volume group.
76+
format: int32
77+
minimum: 0
78+
type: integer
79+
size:
80+
anyOf:
81+
- type: integer
82+
- type: string
83+
description: Size specifies the total size of volume group.
84+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
85+
x-kubernetes-int-or-string: true
86+
uuid:
87+
description: UUID denotes a unique identity of a lvm volume group.
88+
minLength: 1
89+
type: string
90+
required:
91+
- free
92+
- lvCount
93+
- name
94+
- pvCount
95+
- size
96+
- uuid
97+
type: object
98+
type: array
99+
required:
100+
- volumeGroups
101+
type: object
102+
version: v1alpha1
103+
versions:
104+
- name: v1alpha1
105+
served: true
106+
storage: true
107+
status:
108+
acceptedNames:
109+
kind: ""
110+
plural: ""
111+
conditions: []
112+
storedVersions: []

0 commit comments

Comments
 (0)