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