-
Notifications
You must be signed in to change notification settings - Fork 74
/
localdisknode_types.go
92 lines (71 loc) · 3.01 KB
/
localdisknode_types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// LocalDiskNodeSpec defines the desired state of LocalDiskNode
type LocalDiskNodeSpec struct {
// NodeName represent where disk is attached
NodeName string `json:"nodeName"`
}
type Disk struct {
// DevPath
DevPath string `json:"devPath"`
// Capacity
Capacity int64 `json:"capacity,omitempty"`
// DiskType SSD/HDD/NVME...
DiskType string `json:"diskType"`
// Status
Status string `json:"status"`
}
// LocalDiskNodeStatus defines the observed state of LocalDiskNode
type LocalDiskNodeStatus struct {
// There may have multiple storage pools in a node.
// e.g. HDD_POOL, SSD_POOL, NVMe_POOL
// Pools: poolName -> LocalPool
Pools map[string]LocalPool `json:"pools,omitempty"`
// State of the Local Storage Node/Member: New, Active, Inactive, Failed
State State `json:"state,omitempty"`
// Represents the latest available observations of a localstoragenode's current state.
// +optional
Conditions []StorageNodeCondition `json:"conditions,omitempty"`
// PoolExtendRecords record why disks are joined in the pool
// +optional
PoolExtendRecords map[string]LocalDiskClaimSpecArray `json:"poolExtendRecords,omitempty"`
// TotalDisk
TotalDisk int64 `json:"totalDisk,omitempty"`
// FreeDisk
FreeDisk int64 `json:"freeDisk,omitempty"`
// TotalCapacity indicates the capacity of all the disks
TotalCapacity int64 `json:"totalCapacity,omitempty"`
// FreeCapacity indicates the free capacity of all the disks
FreeCapacity int64 `json:"freeCapacity,omitempty"`
}
// +genclient
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// LocalDiskNode is the Schema for the localdisknodes API
// +kubebuilder:subresource:status
// +kubebuilder:resource:path=localdisknodes,scope=Cluster,shortName=ldn
// +kubebuilder:printcolumn:JSONPath=".status.freeCapacity",name=FreeCapacity,type=integer
// +kubebuilder:printcolumn:JSONPath=".status.totalCapacity",name=TotalCapacity,type=integer
// +kubebuilder:printcolumn:JSONPath=".status.totalDisk",name=TotalDisk,type=integer
// +kubebuilder:printcolumn:name="status",type=string,JSONPath=`.status.state`,description="State of the LocalDisk Node"
// +kubebuilder:printcolumn:name="age",type=date,JSONPath=`.metadata.creationTimestamp`
type LocalDiskNode struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec LocalDiskNodeSpec `json:"spec,omitempty"`
Status LocalDiskNodeStatus `json:"status,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// LocalDiskNodeList contains a list of LocalDiskNode
type LocalDiskNodeList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []LocalDiskNode `json:"items"`
}
func init() {
SchemeBuilder.Register(&LocalDiskNode{}, &LocalDiskNodeList{})
}