Skip to content

Commit

Permalink
added lvm_storage_class_watcher.go
Browse files Browse the repository at this point in the history
Signed-off-by: Viktor Kramarenko <viktor.kramarenko@flant.com>
  • Loading branch information
ViktorKram committed Feb 15, 2024
1 parent c6ef82a commit e15a86c
Show file tree
Hide file tree
Showing 3 changed files with 268 additions and 37 deletions.
17 changes: 6 additions & 11 deletions crds/lvmstorageclass.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: drbdstorageclasses.storage.deckhouse.io
name: lvmstorageclasses.storage.deckhouse.io
labels:
heritage: deckhouse
module: sds-lvm
Expand Down Expand Up @@ -34,14 +34,15 @@ spec:
required:
- type
- reclaimPolicy
- volumeBindingMode
- lvmVolumeGroups
properties:
isDefault:
type: boolean
default: false
description: |
Should this Storage class be used as default.
> Note that the default value is false.
type:
type: string
x-kubernetes-validations:
Expand Down Expand Up @@ -73,24 +74,19 @@ spec:
The Storage class's binding mode. Might be:
- Immediate (creates a PV as a PVC requested)
- WaitForFirstConsumer (creates a PV after a Pod consumes PVC)
> Note that default volumeBindingMode is 'WaitForFirstConsumer'.
enum:
- Immediate
- WaitForFirstConsumer
default: 'WaitForFirstConsumer'
allowVolumeExpansion:
type: boolean
x-kubernetes-validations:
- rule: self == oldSelf
message: Value is immutable.
description: |
Configure if Persistent Volume is going to be expandable.
default: true
lvmVolumeGroups:
type: array
x-kubernetes-validations:
- rule: self >= oldSelf
message: You can only add LVMVolumeGroups.
x-kubernetes-list-type: atomic
description: |
LVMVolumeGroup resources where Persistent Volume will be create on.
items:
Expand All @@ -107,11 +103,10 @@ spec:
properties:
poolName:
type: string
x-kubernetes-validations:
- rule: (has(self.type == "LVMThin") && self.lvmVolumeGroups.thin.poolName != "")
message: You should select ThinPool for LVMThin device type.
description: |
The name of the thin pool.
minLength: 1
pattern: ^.*$
status:
type: object
description: |
Expand Down
4 changes: 2 additions & 2 deletions images/sds-lvm-controller/api/v1alpha1/lvm_storage_class.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ type LvmStorageClassStatus struct {
}

type LvmStorageClassLVG struct {
Name string `json:"name"`
Thin LvmStorageClassThinPool `json:"thin"`
Name string `json:"name"`
Thin *LvmStorageClassThinPool `json:"thin,omitempty"`
}

type LvmStorageClassThinPool struct {
Expand Down
Loading

0 comments on commit e15a86c

Please sign in to comment.