Skip to content

Commit

Permalink
feat(scheduling): add volume group capacity tracking
Browse files Browse the repository at this point in the history
Signed-off-by: Yashpal Choudhary <yashpal.c1995@gmail.com>
  • Loading branch information
iyashu committed Feb 11, 2021
1 parent 311e12b commit 48285d7
Show file tree
Hide file tree
Showing 28 changed files with 2,381 additions and 80 deletions.
18 changes: 18 additions & 0 deletions buildscripts/generate-manifests.sh
Expand Up @@ -62,6 +62,21 @@ echo '
cat deploy/yamls/local.openebs.io_lvmsnapshots.yaml >> deploy/yamls/lvmsnapshot-crd.yaml
rm deploy/yamls/local.openebs.io_lvmsnapshots.yaml

echo '
##############################################
########### ############
########### LVMNode CRD ############
########### ############
##############################################
# LVMNode CRD is autogenerated via `make manifests` command.
# Do the modification in the code and run the `make manifests` command
# to generate the CRD definition' > deploy/yamls/lvmnode-crd.yaml

cat deploy/yamls/local.openebs.io_lvmnodes.yaml >> deploy/yamls/lvmnode-crd.yaml
rm deploy/yamls/local.openebs.io_lvmnodes.yaml

## create the operator file using all the yamls

echo '# This manifest is autogenerated via `make manifests` command
Expand All @@ -81,6 +96,9 @@ cat deploy/yamls/lvmvolume-crd.yaml >> deploy/lvm-operator.yaml
# Add LVMSnapshot v1alpha1 CRDs to the Operator yaml
cat deploy/yamls/lvmsnapshot-crd.yaml >> deploy/lvm-operator.yaml

# Add LVMNode v1alpha1 CRDs to the Operator yaml
cat deploy/yamls/lvmnode-crd.yaml >> deploy/lvm-operator.yaml

# Add the driver deployment to the Operator yaml
cat deploy/yamls/lvm-driver.yaml >> deploy/lvm-operator.yaml

Expand Down
158 changes: 120 additions & 38 deletions deploy/lvm-operator.yaml
Expand Up @@ -77,14 +77,10 @@ spec:
description: LVMVolume represents a LVM based volume
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/api-conventions.md#resources'
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/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/api-conventions.md#types-kinds'
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/api-conventions.md#types-kinds'
type: string
metadata:
type: object
Expand All @@ -96,22 +92,17 @@ spec:
minLength: 1
type: string
ownerNodeID:
description: OwnerNodeID is the Node ID where the volume group is present
which is where the volume has been provisioned. OwnerNodeID can not
be edited after the volume has been provisioned.
description: OwnerNodeID is the Node ID where the volume group is present which is where the volume has been provisioned. OwnerNodeID can not be edited after the volume has been provisioned.
minLength: 1
type: string
shared:
description: Shared specifies whether the volume can be shared among
multiple pods. If it is not set to "yes", then the LVM LocalPV Driver
will not allow the volumes to be mounted by more than one pods.
description: Shared specifies whether the volume can be shared among multiple pods. If it is not set to "yes", then the LVM LocalPV Driver will not allow the volumes to be mounted by more than one pods.
enum:
- "yes"
- "no"
type: string
volGroup:
description: VolGroup specifies the name of the volume group where the
volume has been created.
description: VolGroup specifies the name of the volume group where the volume has been created.
minLength: 1
type: string
required:
Expand All @@ -120,14 +111,10 @@ spec:
- volGroup
type: object
status:
description: VolStatus string that specifies the current state of the volume
provisioning request.
description: VolStatus string that specifies the current state of the volume provisioning request.
properties:
state:
description: State specifies the current state of the volume provisioning
request. The state "Pending" means that the volume creation request
has not processed yet. The state "Ready" means that the volume has
been created and it is ready for the use.
description: State specifies the current state of the volume provisioning request. The state "Pending" means that the volume creation request has not processed yet. The state "Ready" means that the volume has been created and it is ready for the use.
enum:
- Pending
- Ready
Expand Down Expand Up @@ -181,14 +168,10 @@ spec:
description: LVMSnapshot represents an LVM Snapshot of the lvm volume
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/api-conventions.md#resources'
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/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/api-conventions.md#types-kinds'
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/api-conventions.md#types-kinds'
type: string
metadata:
type: object
Expand All @@ -200,22 +183,17 @@ spec:
minLength: 1
type: string
ownerNodeID:
description: OwnerNodeID is the Node ID where the volume group is present
which is where the volume has been provisioned. OwnerNodeID can not
be edited after the volume has been provisioned.
description: OwnerNodeID is the Node ID where the volume group is present which is where the volume has been provisioned. OwnerNodeID can not be edited after the volume has been provisioned.
minLength: 1
type: string
shared:
description: Shared specifies whether the volume can be shared among
multiple pods. If it is not set to "yes", then the LVM LocalPV Driver
will not allow the volumes to be mounted by more than one pods.
description: Shared specifies whether the volume can be shared among multiple pods. If it is not set to "yes", then the LVM LocalPV Driver will not allow the volumes to be mounted by more than one pods.
enum:
- "yes"
- "no"
type: string
volGroup:
description: VolGroup specifies the name of the volume group where the
volume has been created.
description: VolGroup specifies the name of the volume group where the volume has been created.
minLength: 1
type: string
required:
Expand All @@ -224,8 +202,7 @@ spec:
- volGroup
type: object
status:
description: SnapStatus string that reflects if the snapshot was created
successfully
description: SnapStatus string that reflects if the snapshot was created successfully
properties:
state:
type: string
Expand All @@ -246,6 +223,108 @@ status:
conditions: []
storedVersions: []


##############################################
########### ############
########### LVMNode CRD ############
########### ############
##############################################

# LVMNode CRD is autogenerated via `make manifests` command.
# Do the modification in the code and run the `make manifests` command
# to generate the CRD definition

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.8
creationTimestamp: null
name: lvmnodes.local.openebs.io
spec:
group: local.openebs.io
names:
kind: LVMNode
listKind: LVMNodeList
plural: lvmnodes
shortNames:
- lvmnode
singular: lvmnode
preserveUnknownFields: false
scope: Namespaced
validation:
openAPIV3Schema:
description: LVMNode records information about all lvm volume groups available in a node. In general, the openebs node-agent creates the LVMNode object & periodically synchronizing the volume groups available in the node. LVMNode has an owner reference pointing to the corresponding node object.
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/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/api-conventions.md#types-kinds'
type: string
metadata:
type: object
volumeGroups:
items:
description: VolumeGroup specifies attributes of a given vg exists on node.
properties:
free:
anyOf:
- type: integer
- type: string
description: Free specifies the available capacity of volume group.
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
lvCount:
description: LVCount denotes total number of logical volumes in volume group.
format: int32
minimum: 0
type: integer
name:
description: Name of the lvm volume group.
minLength: 1
type: string
pvCount:
description: PVCount denotes total number of physical volumes constituting the volume group.
format: int32
minimum: 0
type: integer
size:
anyOf:
- type: integer
- type: string
description: Size specifies the total size of volume group.
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
uuid:
description: UUID denotes a unique identity of a lvm volume group.
minLength: 1
type: string
required:
- free
- lvCount
- name
- pvCount
- size
- uuid
type: object
type: array
required:
- volumeGroups
type: object
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

---

# Create the CSI Driver object
Expand Down Expand Up @@ -925,6 +1004,9 @@ rules:
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses", "csinodes"]
verbs: ["get", "list", "watch"]
- apiGroups: [ "storage.k8s.io" ]
resources: [ "csistoragecapacities"]
verbs: ["*"]
- apiGroups: [""]
resources: ["events"]
verbs: ["list", "watch", "create", "update", "patch"]
Expand All @@ -938,7 +1020,7 @@ rules:
resources: ["pods"]
verbs: ["get", "list", "watch", "update", "patch"]
- apiGroups: ["local.openebs.io"]
resources: ["lvmvolumes", "lvmsnapshots"]
resources: ["lvmvolumes", "lvmsnapshots", "lvmnodes"]
verbs: ["*"]
---

Expand Down Expand Up @@ -1145,7 +1227,7 @@ rules:
resources: ["persistentvolumes", "nodes", "services"]
verbs: ["get", "list"]
- apiGroups: ["local.openebs.io"]
resources: ["lvmvolumes", "lvmsnapshots"]
resources: ["lvmvolumes", "lvmsnapshots", "lvmnodes"]
verbs: ["get", "list", "watch", "create", "update", "patch"]

---
Expand Down
7 changes: 5 additions & 2 deletions deploy/yamls/lvm-driver.yaml
Expand Up @@ -678,6 +678,9 @@ rules:
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses", "csinodes"]
verbs: ["get", "list", "watch"]
- apiGroups: [ "storage.k8s.io" ]
resources: [ "csistoragecapacities"]
verbs: ["*"]
- apiGroups: [""]
resources: ["events"]
verbs: ["list", "watch", "create", "update", "patch"]
Expand All @@ -691,7 +694,7 @@ rules:
resources: ["pods"]
verbs: ["get", "list", "watch", "update", "patch"]
- apiGroups: ["local.openebs.io"]
resources: ["lvmvolumes", "lvmsnapshots"]
resources: ["lvmvolumes", "lvmsnapshots", "lvmnodes"]
verbs: ["*"]
---

Expand Down Expand Up @@ -898,7 +901,7 @@ rules:
resources: ["persistentvolumes", "nodes", "services"]
verbs: ["get", "list"]
- apiGroups: ["local.openebs.io"]
resources: ["lvmvolumes", "lvmsnapshots"]
resources: ["lvmvolumes", "lvmsnapshots", "lvmnodes"]
verbs: ["get", "list", "watch", "create", "update", "patch"]

---
Expand Down

0 comments on commit 48285d7

Please sign in to comment.