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