1 /* 2 Copyright 2021 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package v1 18 19 import ( 20 corev1 "k8s.io/api/core/v1" 21 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 22 ) 23 24 // AlibabaDiskPerformanceLevel enum attribute to describe a disk's performance level 25 type AlibabaDiskPerformanceLevel string 26 27 // AlibabaDiskCatagory enum attribute to deescribe a disk's category 28 type AlibabaDiskCategory string 29 30 // AlibabaDiskEncryptionMode enum attribute to describe whether to enable or disable disk encryption 31 type AlibabaDiskEncryptionMode string 32 33 // AlibabaDiskPreservationPolicy enum attribute to describe whether to preserve or delete a disk upon instance removal 34 type AlibabaDiskPreservationPolicy string 35 36 // AlibabaResourceReferenceType enum attribute to identify the type of resource reference 37 type AlibabaResourceReferenceType string 38 39 const ( 40 // DeleteWithInstance enum property to delete disk with instance deletion 41 DeleteWithInstance AlibabaDiskPreservationPolicy = "DeleteWithInstance" 42 // PreserveDisk enum property to determine disk preservation with instance deletion 43 PreserveDisk AlibabaDiskPreservationPolicy = "PreserveDisk" 44 45 // AlibabaDiskEncryptionEnabled enum property to enable disk encryption 46 AlibabaDiskEncryptionEnabled AlibabaDiskEncryptionMode = "encrypted" 47 // AlibabaDiskEncryptionDisabled enum property to disable disk encryption 48 AlibabaDiskEncryptionDisabled AlibabaDiskEncryptionMode = "disabled" 49 50 // AlibabaDiskPerformanceLevel0 enum property to set the level at PL0 51 PL0 AlibabaDiskPerformanceLevel = "PL0" 52 // AlibabaDiskPerformanceLevel1 enum property to set the level at PL1 53 PL1 AlibabaDiskPerformanceLevel = "PL1" 54 // AlibabaDiskPerformanceLevel2 enum property to set the level at PL2 55 PL2 AlibabaDiskPerformanceLevel = "PL2" 56 // AlibabaDiskPerformanceLevel3 enum property to set the level at PL3 57 PL3 AlibabaDiskPerformanceLevel = "PL3" 58 59 // AlibabaDiskCategoryUltraDisk enum proprty to set the category of disk to ultra disk 60 AlibabaDiskCatagoryUltraDisk AlibabaDiskCategory = "cloud_efficiency" 61 // AlibabaDiskCategorySSD enum proprty to set the category of disk to standard SSD 62 AlibabaDiskCatagorySSD AlibabaDiskCategory = "cloud_ssd" 63 // AlibabaDiskCategoryESSD enum proprty to set the category of disk to ESSD 64 AlibabaDiskCatagoryESSD AlibabaDiskCategory = "cloud_essd" 65 // AlibabaDiskCategoryBasic enum proprty to set the category of disk to basic 66 AlibabaDiskCatagoryBasic AlibabaDiskCategory = "cloud" 67 68 // AlibabaResourceReferenceTypeID enum property to identify an ID type resource reference 69 AlibabaResourceReferenceTypeID AlibabaResourceReferenceType = "ID" 70 // AlibabaResourceReferenceTypeName enum property to identify an Name type resource reference 71 AlibabaResourceReferenceTypeName AlibabaResourceReferenceType = "Name" 72 // AlibabaResourceReferenceTypeTags enum property to identify a tags type resource reference 73 AlibabaResourceReferenceTypeTags AlibabaResourceReferenceType = "Tags" 74 ) 75 76 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 77 78 // AlibabaCloudMachineProviderConfig is the Schema for the alibabacloudmachineproviderconfig API 79 // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). 80 // +openshift:compatibility-gen:level=1 81 // +k8s:openapi-gen=true 82 type AlibabaCloudMachineProviderConfig struct { 83 metav1.TypeMeta `json:",inline"` 84 85 // metadata is the standard object's metadata. 86 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 87 metav1.ObjectMeta `json:"metadata,omitempty"` 88 89 // More detail about alibabacloud ECS 90 // https://www.alibabacloud.com/help/doc-detail/25499.htm?spm=a2c63.l28256.b99.727.496d7453jF7Moz 91 92 //The instance type of the instance. 93 InstanceType string `json:"instanceType"` 94 95 // The ID of the vpc 96 VpcID string `json:"vpcId"` 97 98 // The ID of the region in which to create the instance. You can call the DescribeRegions operation to query the most recent region list. 99 RegionID string `json:"regionId"` 100 101 // The ID of the zone in which to create the instance. You can call the DescribeZones operation to query the most recent region list. 102 ZoneID string `json:"zoneId"` 103 104 // The ID of the image used to create the instance. 105 ImageID string `json:"imageId"` 106 107 // DataDisks holds information regarding the extra disks attached to the instance 108 // +optional 109 DataDisks []DataDiskProperties `json:"dataDisk,omitempty"` 110 111 // SecurityGroups is a list of security group references to assign to the instance. 112 // A reference holds either the security group ID, the resource name, or the required tags to search. 113 // When more than one security group is returned for a tag search, all the groups are associated with the instance up to the 114 // maximum number of security groups to which an instance can belong. 115 // For more information, see the "Security group limits" section in Limits. 116 // https://www.alibabacloud.com/help/en/doc-detail/25412.htm 117 SecurityGroups []AlibabaResourceReference `json:"securityGroups,omitempty"` 118 119 // Bandwidth describes the internet bandwidth strategy for the instance 120 // +optional 121 Bandwidth BandwidthProperties `json:"bandwidth,omitempty"` 122 123 // SystemDisk holds the properties regarding the system disk for the instance 124 // +optional 125 SystemDisk SystemDiskProperties `json:"systemDisk,omitempty"` 126 127 // VSwitch is a reference to the vswitch to use for this instance. 128 // A reference holds either the vSwitch ID, the resource name, or the required tags to search. 129 // When more than one vSwitch is returned for a tag search, only the first vSwitch returned will be used. 130 // This parameter is required when you create an instance of the VPC type. 131 // You can call the DescribeVSwitches operation to query the created vSwitches. 132 VSwitch AlibabaResourceReference `json:"vSwitch"` 133 134 // RAMRoleName is the name of the instance Resource Access Management (RAM) role. This allows the instance to perform API calls as this specified RAM role. 135 // +optional 136 RAMRoleName string `json:"ramRoleName,omitempty"` 137 138 // ResourceGroup references the resource group to which to assign the instance. 139 // A reference holds either the resource group ID, the resource name, or the required tags to search. 140 // When more than one resource group are returned for a search, an error will be produced and the Machine will not be created. 141 // Resource Groups do not support searching by tags. 142 ResourceGroup AlibabaResourceReference `json:"resourceGroup"` 143 144 // Tenancy specifies whether to create the instance on a dedicated host. 145 // Valid values: 146 // 147 // default: creates the instance on a non-dedicated host. 148 // host: creates the instance on a dedicated host. If you do not specify the DedicatedHostID parameter, Alibaba Cloud automatically selects a dedicated host for the instance. 149 // Empty value means no opinion and the platform chooses the a default, which is subject to change over time. 150 // Currently the default is `default`. 151 // +optional 152 Tenancy InstanceTenancy `json:"tenancy,omitempty"` 153 154 // UserDataSecret contains a local reference to a secret that contains the 155 // UserData to apply to the instance 156 // +optional 157 UserDataSecret *corev1.LocalObjectReference `json:"userDataSecret,omitempty"` 158 159 // CredentialsSecret is a reference to the secret with alibabacloud credentials. Otherwise, defaults to permissions 160 // provided by attached RAM role where the actuator is running. 161 // +optional 162 CredentialsSecret *corev1.LocalObjectReference `json:"credentialsSecret,omitempty"` 163 164 // Tags are the set of metadata to add to an instance. 165 // +optional 166 Tags []Tag `json:"tag,omitempty"` 167 } 168 169 // ResourceTagReference is a reference to a specific AlibabaCloud resource by ID, or tags. 170 // Only one of ID or Tags may be specified. Specifying more than one will result in 171 // a validation error. 172 type AlibabaResourceReference struct { 173 // type identifies the resource reference type for this entry. 174 Type AlibabaResourceReferenceType `json:"type"` 175 176 // ID of resource 177 // +optional 178 ID *string `json:"id,omitempty"` 179 180 // Name of the resource 181 // +optional 182 Name *string `json:"name,omitempty"` 183 184 // Tags is a set of metadata based upon ECS object tags used to identify a resource. 185 // For details about usage when multiple resources are found, please see the owning parent field documentation. 186 // +optional 187 Tags *[]Tag `json:"tags,omitempty"` 188 } 189 190 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 191 192 // AlibabaCloudMachineProviderConfigList contains a list of AlibabaCloudMachineProviderConfig 193 // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). 194 // +openshift:compatibility-gen:level=1 195 type AlibabaCloudMachineProviderConfigList struct { 196 metav1.TypeMeta `json:",inline"` 197 198 // metadata is the standard list's metadata. 199 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 200 metav1.ListMeta `json:"metadata,omitempty"` 201 202 Items []AlibabaCloudMachineProviderConfig `json:"items"` 203 } 204 205 // AlibabaCloudMachineProviderStatus is the Schema for the alibabacloudmachineproviderconfig API 206 // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). 207 // +openshift:compatibility-gen:level=1 208 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 209 type AlibabaCloudMachineProviderStatus struct { 210 metav1.TypeMeta `json:",inline"` 211 212 // metadata is the standard object's metadata. 213 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 214 metav1.ObjectMeta `json:"metadata,omitempty"` 215 216 // InstanceID is the instance ID of the machine created in alibabacloud 217 // +optional 218 InstanceID *string `json:"instanceId,omitempty"` 219 220 // InstanceState is the state of the alibabacloud instance for this machine 221 // +optional 222 InstanceState *string `json:"instanceState,omitempty"` 223 224 // Conditions is a set of conditions associated with the Machine to indicate 225 // errors or other status 226 // +optional 227 Conditions []metav1.Condition `json:"conditions,omitempty"` 228 } 229 230 // SystemDiskProperties contains the information regarding the system disk including performance, size, name, and category 231 type SystemDiskProperties struct { 232 // Category is the category of the system disk. 233 // Valid values: 234 // cloud_essd: ESSD. When the parameter is set to this value, you can use the SystemDisk.PerformanceLevel parameter to specify the performance level of the disk. 235 // cloud_efficiency: ultra disk. 236 // cloud_ssd: standard SSD. 237 // cloud: basic disk. 238 // Empty value means no opinion and the platform chooses the a default, which is subject to change over time. 239 // Currently for non-I/O optimized instances of retired instance types, the default is `cloud`. 240 // Currently for other instances, the default is `cloud_efficiency`. 241 // +kubebuilder:validation:Enum="cloud_efficiency"; "cloud_ssd"; "cloud_essd"; "cloud" 242 // +optional 243 Category string `json:"category,omitempty"` 244 245 // PerformanceLevel is the performance level of the ESSD used as the system disk. 246 // Valid values: 247 // 248 // PL0: A single ESSD can deliver up to 10,000 random read/write IOPS. 249 // PL1: A single ESSD can deliver up to 50,000 random read/write IOPS. 250 // PL2: A single ESSD can deliver up to 100,000 random read/write IOPS. 251 // PL3: A single ESSD can deliver up to 1,000,000 random read/write IOPS. 252 // Empty value means no opinion and the platform chooses a default, which is subject to change over time. 253 // Currently the default is `PL1`. 254 // For more information about ESSD performance levels, see ESSDs. 255 // +kubebuilder:validation:Enum="PL0"; "PL1"; "PL2"; "PL3" 256 // +optional 257 PerformanceLevel string `json:"performanceLevel,omitempty"` 258 259 // Name is the name of the system disk. If the name is specified the name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-). 260 // Empty value means the platform chooses a default, which is subject to change over time. 261 // Currently the default is `""`. 262 // +kubebuilder:validation:MaxLength=128 263 // +optional 264 Name string `json:"name,omitempty"` 265 266 // Size is the size of the system disk. Unit: GiB. Valid values: 20 to 500. 267 // The value must be at least 20 and greater than or equal to the size of the image. 268 // Empty value means the platform chooses a default, which is subject to change over time. 269 // Currently the default is `40` or the size of the image depending on whichever is greater. 270 // +optional 271 Size int64 `json:"size,omitempty"` 272 } 273 274 // DataDisk contains the information regarding the datadisk attached to an instance 275 type DataDiskProperties struct { 276 // Name is the name of data disk N. If the name is specified the name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-). 277 // 278 // Empty value means the platform chooses a default, which is subject to change over time. 279 // Currently the default is `""`. 280 // +optional 281 Name string `name:"diskName,omitempty"` 282 283 // SnapshotID is the ID of the snapshot used to create data disk N. Valid values of N: 1 to 16. 284 // 285 // When the DataDisk.N.SnapshotID parameter is specified, the DataDisk.N.Size parameter is ignored. The data disk is created based on the size of the specified snapshot. 286 // Use snapshots created after July 15, 2013. Otherwise, an error is returned and your request is rejected. 287 // 288 // +optional 289 SnapshotID string `name:"snapshotId,omitempty"` 290 291 // Size of the data disk N. Valid values of N: 1 to 16. Unit: GiB. Valid values: 292 // 293 // Valid values when DataDisk.N.Category is set to cloud_efficiency: 20 to 32768 294 // Valid values when DataDisk.N.Category is set to cloud_ssd: 20 to 32768 295 // Valid values when DataDisk.N.Category is set to cloud_essd: 20 to 32768 296 // Valid values when DataDisk.N.Category is set to cloud: 5 to 2000 297 // The value of this parameter must be greater than or equal to the size of the snapshot specified by the SnapshotID parameter. 298 // +optional 299 Size int64 `name:"size,omitempty"` 300 301 // DiskEncryption specifies whether to encrypt data disk N. 302 // 303 // Empty value means the platform chooses a default, which is subject to change over time. 304 // Currently the default is `disabled`. 305 // +kubebuilder:validation:Enum="encrypted";"disabled" 306 // +optional 307 DiskEncryption AlibabaDiskEncryptionMode `name:"diskEncryption,omitempty"` 308 309 // PerformanceLevel is the performance level of the ESSD used as as data disk N. The N value must be the same as that in DataDisk.N.Category when DataDisk.N.Category is set to cloud_essd. 310 // Empty value means no opinion and the platform chooses a default, which is subject to change over time. 311 // Currently the default is `PL1`. 312 // Valid values: 313 // 314 // PL0: A single ESSD can deliver up to 10,000 random read/write IOPS. 315 // PL1: A single ESSD can deliver up to 50,000 random read/write IOPS. 316 // PL2: A single ESSD can deliver up to 100,000 random read/write IOPS. 317 // PL3: A single ESSD can deliver up to 1,000,000 random read/write IOPS. 318 // For more information about ESSD performance levels, see ESSDs. 319 // +kubebuilder:validation:Enum="PL0"; "PL1"; "PL2"; "PL3" 320 // +optional 321 PerformanceLevel AlibabaDiskPerformanceLevel `name:"performanceLevel,omitempty"` 322 323 // Category describes the type of data disk N. 324 // Valid values: 325 // cloud_efficiency: ultra disk 326 // cloud_ssd: standard SSD 327 // cloud_essd: ESSD 328 // cloud: basic disk 329 // Empty value means no opinion and the platform chooses the a default, which is subject to change over time. 330 // Currently for non-I/O optimized instances of retired instance types, the default is `cloud`. 331 // Currently for other instances, the default is `cloud_efficiency`. 332 // +kubebuilder:validation:Enum="cloud_efficiency"; "cloud_ssd"; "cloud_essd"; "cloud" 333 // +optional 334 Category AlibabaDiskCategory `name:"category,omitempty"` 335 336 // KMSKeyID is the ID of the Key Management Service (KMS) key to be used by data disk N. 337 // Empty value means no opinion and the platform chooses the a default, which is subject to change over time. 338 // Currently the default is `""` which is interpreted as do not use KMSKey encryption. 339 // +optional 340 KMSKeyID string `name:"kmsKeyId,omitempty"` 341 342 // DiskPreservation specifies whether to release data disk N along with the instance. 343 // Empty value means no opinion and the platform chooses the a default, which is subject to change over time. 344 // Currently the default is `DeleteWithInstance` 345 // +kubebuilder:validation:Enum="DeleteWithInstance";"PreserveDisk" 346 // +optional 347 DiskPreservation AlibabaDiskPreservationPolicy `name:"diskPreservation,omitempty"` 348 } 349 350 // Tag The tags of ECS Instance 351 type Tag struct { 352 // Key is the name of the key pair 353 Key string `name:"Key"` 354 // Value is the value or data of the key pair 355 Value string `name:"value"` 356 } 357 358 // Bandwidth describes the bandwidth strategy for the network of the instance 359 type BandwidthProperties struct { 360 // InternetMaxBandwidthIn is the maximum inbound public bandwidth. Unit: Mbit/s. Valid values: 361 // When the purchased outbound public bandwidth is less than or equal to 10 Mbit/s, the valid values of this parameter are 1 to 10. 362 // Currently the default is `10` when outbound bandwidth is less than or equal to 10 Mbit/s. 363 // When the purchased outbound public bandwidth is greater than 10, the valid values are 1 to the InternetMaxBandwidthOut value. 364 // Currently the default is the value used for `InternetMaxBandwidthOut` when outbound public bandwidth is greater than 10. 365 // +optional 366 InternetMaxBandwidthIn int64 `json:"internetMaxBandwidthIn,omitempty"` 367 368 // InternetMaxBandwidthOut is the maximum outbound public bandwidth. Unit: Mbit/s. Valid values: 0 to 100. 369 // When a value greater than 0 is used then a public IP address is assigned to the instance. 370 // Empty value means no opinion and the platform chooses the a default, which is subject to change over time. 371 // Currently the default is `0` 372 // +optional 373 InternetMaxBandwidthOut int64 `json:"internetMaxBandwidthOut,omitempty"` 374 } 375