@@ -21,32 +21,39 @@ 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
53
+
47
54
// NodeUUID indicates the UUID of the node where the volume needs to be attached to.
48
55
// Here NodeUUID is the instance UUID of the node.
49
- NodeUUID string `json:"nodeuuid "`
56
+ NodeUUID string `json:"nodeUUID "`
50
57
51
58
// +listType=map
52
59
// +listMapKey=name
@@ -62,21 +69,31 @@ type VolumeSpec struct {
62
69
}
63
70
64
71
type PersistentVolumeClaimSpec struct {
72
+ // +required
73
+
65
74
// ClaimName is the PVC name.
66
75
ClaimName string `json:"claimName"`
76
+ // +optional
77
+
67
78
// DiskMode is the desired mode to use when attaching the volume
68
79
DiskMode DiskMode `json:"diskMode,omitempty"`
69
- // SharingMode indicates the shraring mode if the virtual disk while attaching.
80
+ // +optional
81
+
82
+ // SharingMode indicates the sharing mode if the virtual disk while attaching.
70
83
SharingMode SharingMode `json:"sharingMode,omitempty"`
84
+ // +optional
85
+
71
86
// ControllerKey is the object key for the controller object for this device.
72
87
ControllerKey string `json:"controllerKey,omitempty"`
88
+ // +optional
89
+
73
90
// UnitNumber of this device on its controller.
74
- UnitNumber string `json:"unitNumber,omitempty"`
91
+ UnitNumber * int32 `json:"unitNumber,omitempty"`
75
92
}
76
93
77
- // CnsNodeVmBatchAttachmentStatus defines the observed state of CnsNodeVmBatchAttachment
94
+ // CnsNodeVMBatchAttachmentStatus defines the observed state of CnsNodeVMBatchAttachment
78
95
// +k8s:openapi-gen=true
79
- type CnsNodeVmBatchAttachmentStatus struct {
96
+ type CnsNodeVMBatchAttachmentStatus struct {
80
97
// Error is the overall error status for the instance.
81
98
Error string `json:"error,omitempty"`
82
99
// +listType=map
@@ -95,6 +112,7 @@ type VolumeStatus struct {
95
112
type PersistentVolumeClaimStatus struct {
96
113
// ClaimName is the PVC name.
97
114
ClaimName string `json:"claimName"`
115
+ // Attached indicates the attach status of a PVC.
98
116
// If volume is not attached, Attached will be set to false.
99
117
// If volume is attached, Attached will be set to true.
100
118
// If volume is detached successfully, its entry will be removed from VolumeStatus.
@@ -103,30 +121,33 @@ type PersistentVolumeClaimStatus struct {
103
121
Error string `json:"error,omitempty"`
104
122
// CnsVolumeID is the volume ID for the PVC.
105
123
CnsVolumeID string `json:"cnsVolumeId,omitempty"`
106
- // Diskuuid is the ID obtained when volume is attached to a VM.
107
- Diskuuid string `json:"diskuuid ,omitempty"`
124
+ // DiskUUID is the ID obtained when volume is attached to a VM.
125
+ DiskUUID string `json:"DiskUUID ,omitempty"`
108
126
}
109
127
110
128
// +genclient
111
129
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
112
130
113
131
// +k8s:openapi-gen=true
114
132
// +kubebuilder:subresource:status
133
+ // +kubebuilder:object:root=true
134
+ // +kubebuilder:resource:shortName=batchattach
135
+ // +kubebuilder:printcolumn:name="NodeUUID",type="string",JSONPath=".spec.nodeUUID"
115
136
116
- // CnsNodeVmBatchAttachment is the Schema for the cnsnodevmbatchattachments API
117
- type CnsNodeVmBatchAttachment struct {
137
+ // CnsNodeVMBatchAttachment is the Schema for the cnsnodevmbatchattachments API
138
+ type CnsNodeVMBatchAttachment struct {
118
139
metav1.TypeMeta `json:",inline"`
119
140
metav1.ObjectMeta `json:"metadata,omitempty"`
120
141
121
- Spec CnsNodeVmBatchAttachmentSpec `json:"spec,omitempty"`
122
- Status CnsNodeVmBatchAttachmentStatus `json:"status,omitempty"`
142
+ Spec CnsNodeVMBatchAttachmentSpec `json:"spec,omitempty"`
143
+ Status CnsNodeVMBatchAttachmentStatus `json:"status,omitempty"`
123
144
}
124
145
125
146
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
126
147
127
- // CnsNodeVmBatchAttachmentList contains a list of CnsNodeVmBatchAttachment
128
- type CnsNodeVmBatchAttachmentList struct {
148
+ // CnsNodeVMBatchAttachmentList contains a list of CnsNodeVMBatchAttachment
149
+ type CnsNodeVMBatchAttachmentList struct {
129
150
metav1.TypeMeta `json:",inline"`
130
151
metav1.ListMeta `json:"metadata,omitempty"`
131
- Items []CnsNodeVmBatchAttachment `json:"items"`
152
+ Items []CnsNodeVMBatchAttachment `json:"items"`
132
153
}
0 commit comments