@@ -21,32 +21,38 @@ import (
21
21
)
22
22
23
23
// DiskMode describes the desired mode to use when attaching the volume.
24
+ // +kubebuilder:validation:Enum=independent_persistent;persistent;independent_nonpersistent
24
25
type DiskMode string
25
26
26
27
const (
27
- // By setting DiskMode to independent_persistent , a virtual machine's disk is not captured in snapshots and
28
+ // IndependentPersistent is the diskMode in which , a virtual machine's disk is not captured in snapshots and
28
29
// changes are permanently written to the disk, regardless of snapshot operations.
29
30
IndependentPersistent DiskMode = "independent_persistent"
30
- // Changes are immediately and permanently written to the virtual disk.
31
+ // Persistent diskMode changes are immediately and permanently written to the virtual disk.
31
32
Persistent DiskMode = "persistent"
33
+ // Changes to virtual disk are made to a redo log and discarded at power off.
34
+ // It is not affected by snapshots.
35
+ IndependentNonPersistent = "independent_nonpersistent"
32
36
)
33
37
34
- // The sharing mode of the virtual disk.
38
+ // SharingMode is the sharing mode of the virtual disk.
39
+ // +kubebuilder:validation:Enum=sharingMultiWriter;sharingNone
35
40
type SharingMode string
36
41
37
42
const (
38
- // The virtual disk is shared between multiple virtual machines.
43
+ // SharingMultiWriter: The virtual disk is shared between multiple virtual machines.
39
44
SharingMultiWriter SharingMode = "sharingMultiWriter"
40
- // The virtual disk is not shared.
45
+ // SharingNone: The virtual disk is not shared.
41
46
SharingNone SharingMode = "sharingNone"
42
47
)
43
48
44
- // CnsNodeVmBatchAttachmentSpec defines the desired state of CnsNodeVmBatchAttachment
49
+ // CnsNodeVMBatchAttachmentSpec defines the desired state of CnsNodeVMBatchAttachment
45
50
// +k8s:openapi-gen=true
46
- type CnsNodeVmBatchAttachmentSpec struct {
51
+ type CnsNodeVMBatchAttachmentSpec struct {
52
+ // +required
47
53
// NodeUUID indicates the UUID of the node where the volume needs to be attached to.
48
54
// Here NodeUUID is the instance UUID of the node.
49
- NodeUUID string `json:"nodeuuid "`
55
+ NodeUUID string `json:"nodeUUID "`
50
56
51
57
// +listType=map
52
58
// +listMapKey=name
@@ -63,20 +69,25 @@ type VolumeSpec struct {
63
69
64
70
type PersistentVolumeClaimSpec struct {
65
71
// ClaimName is the PVC name.
72
+ // +required
66
73
ClaimName string `json:"claimName"`
67
74
// DiskMode is the desired mode to use when attaching the volume
75
+ // +optional
68
76
DiskMode DiskMode `json:"diskMode,omitempty"`
69
- // SharingMode indicates the shraring mode if the virtual disk while attaching.
77
+ // SharingMode indicates the sharing mode if the virtual disk while attaching.
78
+ // +optional
70
79
SharingMode SharingMode `json:"sharingMode,omitempty"`
71
80
// ControllerKey is the object key for the controller object for this device.
81
+ // +optional
72
82
ControllerKey string `json:"controllerKey,omitempty"`
73
83
// UnitNumber of this device on its controller.
84
+ // +optional
74
85
UnitNumber string `json:"unitNumber,omitempty"`
75
86
}
76
87
77
- // CnsNodeVmBatchAttachmentStatus defines the observed state of CnsNodeVmBatchAttachment
88
+ // CnsNodeVMBatchAttachmentStatus defines the observed state of CnsNodeVMBatchAttachment
78
89
// +k8s:openapi-gen=true
79
- type CnsNodeVmBatchAttachmentStatus struct {
90
+ type CnsNodeVMBatchAttachmentStatus struct {
80
91
// Error is the overall error status for the instance.
81
92
Error string `json:"error,omitempty"`
82
93
// +listType=map
@@ -95,6 +106,7 @@ type VolumeStatus struct {
95
106
type PersistentVolumeClaimStatus struct {
96
107
// ClaimName is the PVC name.
97
108
ClaimName string `json:"claimName"`
109
+ // Attached indicates the attach status of a PVC.
98
110
// If volume is not attached, Attached will be set to false.
99
111
// If volume is attached, Attached will be set to true.
100
112
// If volume is detached successfully, its entry will be removed from VolumeStatus.
@@ -103,30 +115,33 @@ type PersistentVolumeClaimStatus struct {
103
115
Error string `json:"error,omitempty"`
104
116
// CnsVolumeID is the volume ID for the PVC.
105
117
CnsVolumeID string `json:"cnsVolumeId,omitempty"`
106
- // Diskuuid is the ID obtained when volume is attached to a VM.
107
- Diskuuid string `json:"diskuuid ,omitempty"`
118
+ // DiskUUID is the ID obtained when volume is attached to a VM.
119
+ DiskUUID string `json:"DiskUUID ,omitempty"`
108
120
}
109
121
110
122
// +genclient
111
123
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
112
124
113
125
// +k8s:openapi-gen=true
114
126
// +kubebuilder:subresource:status
127
+ // +kubebuilder:object:root=true
128
+ // +kubebuilder:resource:shortName=batchattach
129
+ // +kubebuilder:printcolumn:name="NodeUUID",type="string",JSONPath=".spec.nodeUUID"
115
130
116
- // CnsNodeVmBatchAttachment is the Schema for the cnsnodevmbatchattachments API
117
- type CnsNodeVmBatchAttachment struct {
131
+ // CnsNodeVMBatchAttachment is the Schema for the cnsnodevmbatchattachments API
132
+ type CnsNodeVMBatchAttachment struct {
118
133
metav1.TypeMeta `json:",inline"`
119
134
metav1.ObjectMeta `json:"metadata,omitempty"`
120
135
121
- Spec CnsNodeVmBatchAttachmentSpec `json:"spec,omitempty"`
122
- Status CnsNodeVmBatchAttachmentStatus `json:"status,omitempty"`
136
+ Spec CnsNodeVMBatchAttachmentSpec `json:"spec,omitempty"`
137
+ Status CnsNodeVMBatchAttachmentStatus `json:"status,omitempty"`
123
138
}
124
139
125
140
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
126
141
127
- // CnsNodeVmBatchAttachmentList contains a list of CnsNodeVmBatchAttachment
128
- type CnsNodeVmBatchAttachmentList struct {
142
+ // CnsNodeVMBatchAttachmentList contains a list of CnsNodeVMBatchAttachment
143
+ type CnsNodeVMBatchAttachmentList struct {
129
144
metav1.TypeMeta `json:",inline"`
130
145
metav1.ListMeta `json:"metadata,omitempty"`
131
- Items []CnsNodeVmBatchAttachment `json:"items"`
146
+ Items []CnsNodeVMBatchAttachment `json:"items"`
132
147
}
0 commit comments