Skip to content

Commit

Permalink
feat: adds status information to LVMCluster CRD
Browse files Browse the repository at this point in the history
The LVMCluster.Status will now contain a list of VGs,
the nodes on which they have been created and the status on
that node.

Signed-off-by: N Balachandran <[email protected]>
  • Loading branch information
nbalacha committed Jan 18, 2022
1 parent 56de5eb commit 199ae64
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 7 deletions.
24 changes: 21 additions & 3 deletions api/v1alpha1/lvmcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ type DeviceClass struct {
// +kubebuilder:validation:Pattern="^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
Name string `json:"name,omitempty"`

// DeviceSelector is a set of rules that should match for a device to be included in this TopoLVMCluster
// DeviceSelector is a set of rules that should match for a device to be included in the LVMCluster
// +optional
DeviceSelector *DeviceSelector `json:"deviceSelector,omitempty"`

// NodeSelector chooses nodes
// NodeSelector chooses nodes on which to create the deviceclass
// +optional
NodeSelector *corev1.NodeSelector `json:"nodeSelector,omitempty"`

Expand Down Expand Up @@ -79,9 +79,27 @@ type LVMClusterStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file

// ready describes if the LvmCluster is ready.
// Ready describes if the LVMCluster is ready.
// +optional
Ready bool `json:"ready,omitempty"`
// DeviceClassStatuses describes the status of all deviceClasses
DeviceClassStatuses []DeviceClassStatus `json:"deviceClassStatuses,omitempty"`
}

// DeviceClassStatus defines the observed status of the deviceclass across all nodes
type DeviceClassStatus struct {
// Name is the name of the deviceclass
Name string `json:"name,omitempty"`
// NodeStatus tells if the deviceclass was created on the node
NodeStatus []NodeStatus `json:"nodeStatus,omitempty"`
}

// NodeStatus defines the observed state of the deviceclass on the node
type NodeStatus struct {
// Node is the name of the node
Node string `json:"node,omitempty"`
// Status is the status of the VG on the node
Status VGStatusType `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
Expand Down
44 changes: 43 additions & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 30 additions & 3 deletions config/crd/bases/lvm.topolvm.io_lvmclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ spec:
properties:
deviceSelector:
description: DeviceSelector is a set of rules that should match
for a device to be included in this TopoLVMCluster
for a device to be included in the LVMCluster
type: object
name:
description: 'Name of the class, the VG and possibly the storageclass.
Expand All @@ -54,7 +54,8 @@ spec:
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
type: string
nodeSelector:
description: NodeSelector chooses nodes
description: NodeSelector chooses nodes on which to create the
deviceclass
properties:
nodeSelectorTerms:
description: Required. A list of node selector terms. The
Expand Down Expand Up @@ -184,8 +185,34 @@ spec:
status:
description: LVMClusterStatus defines the observed state of LVMCluster
properties:
deviceClassStatuses:
description: DeviceClassStatuses describes the status of all deviceClasses
items:
description: DeviceClassStatus defines the observed status of the
deviceclass across all nodes
properties:
name:
description: Name is the name of the deviceclass
type: string
nodeStatus:
description: NodeStatus tells if the deviceclass was created
on the node
items:
description: NodeStatus defines the observed state of the
deviceclass on the node
properties:
node:
description: Node is the name of the node
type: string
status:
description: Status is the status of the VG on the node
type: string
type: object
type: array
type: object
type: array
ready:
description: ready describes if the LvmCluster is ready.
description: Ready describes if the LVMCluster is ready.
type: boolean
type: object
type: object
Expand Down
26 changes: 26 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,32 @@ rules:
- get
- patch
- update
- apiGroups:
- lvm.topolvm.io
resources:
- lvmvolumegroupnodestatuses
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- lvm.topolvm.io
resources:
- lvmvolumegroupnodestatuses/finalizers
verbs:
- update
- apiGroups:
- lvm.topolvm.io
resources:
- lvmvolumegroupnodestatuses/status
verbs:
- get
- patch
- update
- apiGroups:
- lvm.topolvm.io
resources:
Expand Down

0 comments on commit 199ae64

Please sign in to comment.