sigs.k8s.io/cluster-api-provider-azure@v1.17.0/api/v1beta1/types.go (about) 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 v1beta1 18 19 import ( 20 "github.com/pkg/errors" 21 "k8s.io/apimachinery/pkg/api/resource" 22 "k8s.io/utils/net" 23 ) 24 25 const ( 26 // ControlPlane machine label. 27 ControlPlane string = "control-plane" 28 // Node machine label. 29 Node string = "node" 30 // Bastion subnet label. 31 Bastion string = "bastion" 32 // Cluster subnet label. 33 Cluster string = "cluster" 34 ) 35 36 // SecurityEncryptionType represents the Encryption Type when the virtual machine is a 37 // Confidential VM. 38 type SecurityEncryptionType string 39 40 const ( 41 // SecurityEncryptionTypeVMGuestStateOnly disables OS disk confidential encryption. 42 SecurityEncryptionTypeVMGuestStateOnly SecurityEncryptionType = "VMGuestStateOnly" 43 // SecurityEncryptionTypeDiskWithVMGuestState OS disk confidential encryption with a 44 // platform-managed key (PMK) or a customer-managed key (CMK). 45 SecurityEncryptionTypeDiskWithVMGuestState SecurityEncryptionType = "DiskWithVMGuestState" 46 ) 47 48 // SecurityTypes represents the SecurityType of the virtual machine. 49 type SecurityTypes string 50 51 const ( 52 // SecurityTypesConfidentialVM defines the SecurityType of the virtual machine as a Confidential VM. 53 SecurityTypesConfidentialVM SecurityTypes = "ConfidentialVM" 54 // SecurityTypesTrustedLaunch defines the SecurityType of the virtual machine as a Trusted Launch VM. 55 SecurityTypesTrustedLaunch SecurityTypes = "TrustedLaunch" 56 ) 57 58 // Futures is a slice of Future. 59 type Futures []Future 60 61 const ( 62 // PatchFuture is a future that was derived from a PATCH request. 63 PatchFuture string = "PATCH" 64 // PutFuture is a future that was derived from a PUT request. 65 PutFuture string = "PUT" 66 // DeleteFuture is a future that was derived from a DELETE request. 67 DeleteFuture string = "DELETE" 68 ) 69 70 // Future contains the data needed for an Azure long-running operation to continue across reconcile loops. 71 type Future struct { 72 // Type describes the type of future, such as update, create, delete, etc. 73 Type string `json:"type"` 74 75 // ResourceGroup is the Azure resource group for the resource. 76 // +optional 77 ResourceGroup string `json:"resourceGroup,omitempty"` 78 79 // ServiceName is the name of the Azure service. 80 // Together with the name of the resource, this forms the unique identifier for the future. 81 ServiceName string `json:"serviceName"` 82 83 // Name is the name of the Azure resource. 84 // Together with the service name, this forms the unique identifier for the future. 85 Name string `json:"name"` 86 87 // Data is the base64 url encoded json Azure AutoRest Future. 88 Data string `json:"data"` 89 } 90 91 // NetworkSpec specifies what the Azure networking resources should look like. 92 type NetworkSpec struct { 93 // Vnet is the configuration for the Azure virtual network. 94 // +optional 95 Vnet VnetSpec `json:"vnet,omitempty"` 96 97 // Subnets is the configuration for the control-plane subnet and the node subnet. 98 // +optional 99 Subnets Subnets `json:"subnets,omitempty"` 100 101 // APIServerLB is the configuration for the control-plane load balancer. 102 // +optional 103 APIServerLB LoadBalancerSpec `json:"apiServerLB,omitempty"` 104 105 // NodeOutboundLB is the configuration for the node outbound load balancer. 106 // +optional 107 NodeOutboundLB *LoadBalancerSpec `json:"nodeOutboundLB,omitempty"` 108 109 // ControlPlaneOutboundLB is the configuration for the control-plane outbound load balancer. 110 // This is different from APIServerLB, and is used only in private clusters (optionally) for enabling outbound traffic. 111 // +optional 112 ControlPlaneOutboundLB *LoadBalancerSpec `json:"controlPlaneOutboundLB,omitempty"` 113 114 NetworkClassSpec `json:",inline"` 115 } 116 117 // VnetSpec configures an Azure virtual network. 118 type VnetSpec struct { 119 // ResourceGroup is the name of the resource group of the existing virtual network 120 // or the resource group where a managed virtual network should be created. 121 // +optional 122 ResourceGroup string `json:"resourceGroup,omitempty"` 123 124 // ID is the Azure resource ID of the virtual network. 125 // READ-ONLY 126 // +optional 127 ID string `json:"id,omitempty"` 128 129 // Name defines a name for the virtual network resource. 130 Name string `json:"name"` 131 132 // Peerings defines a list of peerings of the newly created virtual network with existing virtual networks. 133 // +optional 134 Peerings VnetPeerings `json:"peerings,omitempty"` 135 136 VnetClassSpec `json:",inline"` 137 } 138 139 // VnetPeeringSpec specifies an existing remote virtual network to peer with the AzureCluster's virtual network. 140 type VnetPeeringSpec struct { 141 VnetPeeringClassSpec `json:",inline"` 142 } 143 144 // VnetPeeringClassSpec specifies a virtual network peering class. 145 type VnetPeeringClassSpec struct { 146 // ResourceGroup is the resource group name of the remote virtual network. 147 // +optional 148 ResourceGroup string `json:"resourceGroup,omitempty"` 149 150 // RemoteVnetName defines name of the remote virtual network. 151 RemoteVnetName string `json:"remoteVnetName"` 152 153 // ForwardPeeringProperties specifies VnetPeeringProperties for peering from the cluster's virtual network to the 154 // remote virtual network. 155 // +optional 156 ForwardPeeringProperties VnetPeeringProperties `json:"forwardPeeringProperties,omitempty"` 157 158 // ReversePeeringProperties specifies VnetPeeringProperties for peering from the remote virtual network to the 159 // cluster's virtual network. 160 // +optional 161 ReversePeeringProperties VnetPeeringProperties `json:"reversePeeringProperties,omitempty"` 162 } 163 164 // VnetPeeringProperties specifies virtual network peering properties. 165 type VnetPeeringProperties struct { 166 // AllowForwardedTraffic specifies whether the forwarded traffic from the VMs in the local virtual network will be 167 // allowed/disallowed in remote virtual network. 168 // +optional 169 AllowForwardedTraffic *bool `json:"allowForwardedTraffic,omitempty"` 170 171 // AllowGatewayTransit specifies if gateway links can be used in remote virtual networking to link to this virtual 172 // network. 173 // +optional 174 AllowGatewayTransit *bool `json:"allowGatewayTransit,omitempty"` 175 176 // AllowVirtualNetworkAccess specifies whether the VMs in the local virtual network space would be able to access 177 // the VMs in remote virtual network space. 178 // +optional 179 AllowVirtualNetworkAccess *bool `json:"allowVirtualNetworkAccess,omitempty"` 180 181 // UseRemoteGateways specifies if remote gateways can be used on this virtual network. 182 // If the flag is set to true, and allowGatewayTransit on remote peering is also set to true, the virtual network 183 // will use the gateways of the remote virtual network for transit. Only one peering can have this flag set to true. 184 // This flag cannot be set if virtual network already has a gateway. 185 // +optional 186 UseRemoteGateways *bool `json:"useRemoteGateways,omitempty"` 187 } 188 189 // VnetPeerings is a slice of VnetPeering. 190 type VnetPeerings []VnetPeeringSpec 191 192 // IsManaged returns true if the vnet is managed. 193 func (v *VnetSpec) IsManaged(clusterName string) bool { 194 return v.ID == "" || v.Tags.HasOwned(clusterName) 195 } 196 197 // Subnets is a slice of Subnet. 198 // +listType=map 199 // +listMapKey=name 200 type Subnets []SubnetSpec 201 202 // ServiceEndpoints is a slice of string. 203 // +listType=map 204 // +listMapKey=service 205 type ServiceEndpoints []ServiceEndpointSpec 206 207 // PrivateEndpoints is a slice of PrivateEndpointSpec. 208 // +listType=map 209 // +listMapKey=name 210 type PrivateEndpoints []PrivateEndpointSpec 211 212 // SecurityGroup defines an Azure security group. 213 type SecurityGroup struct { 214 // ID is the Azure resource ID of the security group. 215 // READ-ONLY 216 // +optional 217 ID string `json:"id,omitempty"` 218 Name string `json:"name"` 219 220 SecurityGroupClass `json:",inline"` 221 } 222 223 // RouteTable defines an Azure route table. 224 type RouteTable struct { 225 // ID is the Azure resource ID of the route table. 226 // READ-ONLY 227 // +optional 228 ID string `json:"id,omitempty"` 229 Name string `json:"name"` 230 } 231 232 // NatGateway defines an Azure NAT gateway. 233 // NAT gateway resources are part of Vnet NAT and provide outbound Internet connectivity for subnets of a virtual network. 234 type NatGateway struct { 235 // ID is the Azure resource ID of the NAT gateway. 236 // READ-ONLY 237 // +optional 238 ID string `json:"id,omitempty"` 239 // +optional 240 NatGatewayIP PublicIPSpec `json:"ip,omitempty"` 241 242 NatGatewayClassSpec `json:",inline"` 243 } 244 245 // NatGatewayClassSpec defines a NAT gateway class specification. 246 type NatGatewayClassSpec struct { 247 Name string `json:"name"` 248 } 249 250 // SecurityGroupProtocol defines the protocol type for a security group rule. 251 type SecurityGroupProtocol string 252 253 const ( 254 // SecurityGroupProtocolAll is a wildcard for all IP protocols. 255 SecurityGroupProtocolAll = SecurityGroupProtocol("*") 256 // SecurityGroupProtocolTCP represents the TCP protocol. 257 SecurityGroupProtocolTCP = SecurityGroupProtocol("Tcp") 258 // SecurityGroupProtocolUDP represents the UDP protocol. 259 SecurityGroupProtocolUDP = SecurityGroupProtocol("Udp") 260 // SecurityGroupProtocolICMP represents the ICMP protocol. 261 SecurityGroupProtocolICMP = SecurityGroupProtocol("Icmp") 262 ) 263 264 // SecurityRuleDirection defines the direction type for a security group rule. 265 type SecurityRuleDirection string 266 267 const ( 268 // SecurityRuleDirectionInbound defines an ingress security rule. 269 SecurityRuleDirectionInbound = SecurityRuleDirection("Inbound") 270 271 // SecurityRuleDirectionOutbound defines an egress security rule. 272 SecurityRuleDirectionOutbound = SecurityRuleDirection("Outbound") 273 ) 274 275 // SecurityRuleAccess defines the action type for a security group rule. 276 type SecurityRuleAccess string 277 278 const ( 279 // SecurityRuleActionAllow allows traffic defined in the rule. 280 SecurityRuleActionAllow SecurityRuleAccess = "Allow" 281 282 // SecurityRuleActionDeny denies traffic defined in the rule. 283 SecurityRuleActionDeny SecurityRuleAccess = "Deny" 284 ) 285 286 // SecurityRule defines an Azure security rule for security groups. 287 type SecurityRule struct { 288 // Name is a unique name within the network security group. 289 Name string `json:"name"` 290 // A description for this rule. Restricted to 140 chars. 291 Description string `json:"description"` 292 // Protocol specifies the protocol type. "Tcp", "Udp", "Icmp", or "*". 293 // +kubebuilder:validation:Enum=Tcp;Udp;Icmp;* 294 Protocol SecurityGroupProtocol `json:"protocol"` 295 // Direction indicates whether the rule applies to inbound, or outbound traffic. "Inbound" or "Outbound". 296 // +kubebuilder:validation:Enum=Inbound;Outbound 297 Direction SecurityRuleDirection `json:"direction"` 298 // Priority is a number between 100 and 4096. Each rule should have a unique value for priority. Rules are processed in priority order, with lower numbers processed before higher numbers. Once traffic matches a rule, processing stops. 299 // +optional 300 Priority int32 `json:"priority,omitempty"` 301 // SourcePorts specifies source port or range. Integer or range between 0 and 65535. Asterix '*' can also be used to match all ports. 302 // +optional 303 SourcePorts *string `json:"sourcePorts,omitempty"` 304 // DestinationPorts specifies the destination port or range. Integer or range between 0 and 65535. Asterix '*' can also be used to match all ports. 305 // +optional 306 DestinationPorts *string `json:"destinationPorts,omitempty"` 307 // Source specifies the CIDR or source IP range. Asterix '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from. 308 // +optional 309 Source *string `json:"source,omitempty"` 310 // Sources specifies The CIDR or source IP ranges. 311 Sources []*string `json:"sources,omitempty"` 312 // Destination is the destination address prefix. CIDR or destination IP range. Asterix '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. 313 // +optional 314 Destination *string `json:"destination,omitempty"` 315 // Action specifies whether network traffic is allowed or denied. Can either be "Allow" or "Deny". Defaults to "Allow". 316 // +kubebuilder:default=Allow 317 // +kubebuilder:validation:Enum=Allow;Deny 318 //+optional 319 Action SecurityRuleAccess `json:"action"` 320 } 321 322 // SecurityRules is a slice of Azure security rules for security groups. 323 // +listType=map 324 // +listMapKey=name 325 type SecurityRules []SecurityRule 326 327 // LoadBalancerSpec defines an Azure load balancer. 328 type LoadBalancerSpec struct { 329 // ID is the Azure resource ID of the load balancer. 330 // READ-ONLY 331 // +optional 332 ID string `json:"id,omitempty"` 333 // +optional 334 Name string `json:"name,omitempty"` 335 // +optional 336 FrontendIPs []FrontendIP `json:"frontendIPs,omitempty"` 337 // FrontendIPsCount specifies the number of frontend IP addresses for the load balancer. 338 // +optional 339 FrontendIPsCount *int32 `json:"frontendIPsCount,omitempty"` 340 // BackendPool describes the backend pool of the load balancer. 341 // +optional 342 BackendPool BackendPool `json:"backendPool,omitempty"` 343 344 LoadBalancerClassSpec `json:",inline"` 345 } 346 347 // SKU defines an Azure load balancer SKU. 348 type SKU string 349 350 const ( 351 // SKUStandard is the value for the Azure load balancer Standard SKU. 352 SKUStandard = SKU("Standard") 353 ) 354 355 // LBType defines an Azure load balancer Type. 356 type LBType string 357 358 const ( 359 // Internal is the value for the Azure load balancer internal type. 360 Internal = LBType("Internal") 361 // Public is the value for the Azure load balancer public type. 362 Public = LBType("Public") 363 ) 364 365 // FrontendIP defines a load balancer frontend IP configuration. 366 type FrontendIP struct { 367 // +kubebuilder:validation:MinLength=1 368 Name string `json:"name"` 369 // +optional 370 PublicIP *PublicIPSpec `json:"publicIP,omitempty"` 371 372 FrontendIPClass `json:",inline"` 373 } 374 375 // PublicIPSpec defines the inputs to create an Azure public IP address. 376 type PublicIPSpec struct { 377 Name string `json:"name"` 378 // +optional 379 DNSName string `json:"dnsName,omitempty"` 380 // +optional 381 IPTags []IPTag `json:"ipTags,omitempty"` 382 } 383 384 // IPTag contains the IpTag associated with the object. 385 type IPTag struct { 386 // Type specifies the IP tag type. Example: FirstPartyUsage. 387 Type string `json:"type"` 388 // Tag specifies the value of the IP tag associated with the public IP. Example: SQL. 389 Tag string `json:"tag"` 390 } 391 392 // VMState describes the state of an Azure virtual machine. 393 // Deprecated: use ProvisioningState. 394 type VMState string 395 396 // ProvisioningState describes the provisioning state of an Azure resource. 397 type ProvisioningState string 398 399 const ( 400 // Creating ... 401 Creating ProvisioningState = "Creating" 402 // Deleting ... 403 Deleting ProvisioningState = "Deleting" 404 // Failed ... 405 Failed ProvisioningState = "Failed" 406 // Migrating ... 407 Migrating ProvisioningState = "Migrating" 408 // Succeeded ... 409 Succeeded ProvisioningState = "Succeeded" 410 // Updating ... 411 Updating ProvisioningState = "Updating" 412 // Canceled represents an action which was initiated but terminated by the user before completion. 413 Canceled ProvisioningState = "Canceled" 414 // Deleted represents a deleted VM 415 // NOTE: This state is specific to capz, and does not have corresponding mapping in Azure API (https://learn.microsoft.com/azure/virtual-machines/states-billing#provisioning-states) 416 Deleted ProvisioningState = "Deleted" 417 ) 418 419 // Image defines information about the image to use for VM creation. 420 // There are three ways to specify an image: by ID, Marketplace Image or SharedImageGallery 421 // One of ID, SharedImage or Marketplace should be set. 422 type Image struct { 423 // ID specifies an image to use by ID 424 // +optional 425 ID *string `json:"id,omitempty"` 426 427 // SharedGallery specifies an image to use from an Azure Shared Image Gallery 428 // Deprecated: use ComputeGallery instead. 429 // +optional 430 SharedGallery *AzureSharedGalleryImage `json:"sharedGallery,omitempty"` 431 432 // Marketplace specifies an image to use from the Azure Marketplace 433 // +optional 434 Marketplace *AzureMarketplaceImage `json:"marketplace,omitempty"` 435 436 // ComputeGallery specifies an image to use from the Azure Compute Gallery 437 // +optional 438 ComputeGallery *AzureComputeGalleryImage `json:"computeGallery,omitempty"` 439 } 440 441 // AzureComputeGalleryImage defines an image in the Azure Compute Gallery to use for VM creation. 442 type AzureComputeGalleryImage struct { 443 // Gallery specifies the name of the compute image gallery that contains the image 444 // +kubebuilder:validation:MinLength=1 445 Gallery string `json:"gallery"` 446 // Name is the name of the image 447 // +kubebuilder:validation:MinLength=1 448 Name string `json:"name"` 449 // Version specifies the version of the marketplace image. The allowed formats 450 // are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. 451 // Specify 'latest' to use the latest version of an image available at deploy time. 452 // Even if you use 'latest', the VM image will not automatically update after deploy 453 // time even if a new version becomes available. 454 // +kubebuilder:validation:MinLength=1 455 Version string `json:"version"` 456 // SubscriptionID is the identifier of the subscription that contains the private compute gallery. 457 // +optional 458 SubscriptionID *string `json:"subscriptionID,omitempty"` 459 // ResourceGroup specifies the resource group containing the private compute gallery. 460 // +optional 461 ResourceGroup *string `json:"resourceGroup,omitempty"` 462 // Plan contains plan information. 463 // +optional 464 Plan *ImagePlan `json:"plan,omitempty"` 465 } 466 467 // ImagePlan contains plan information for marketplace images. 468 type ImagePlan struct { 469 // Publisher is the name of the organization that created the image 470 // +kubebuilder:validation:MinLength=1 471 Publisher string `json:"publisher"` 472 // Offer specifies the name of a group of related images created by the publisher. 473 // For example, UbuntuServer, WindowsServer 474 // +kubebuilder:validation:MinLength=1 475 Offer string `json:"offer"` 476 // SKU specifies an instance of an offer, such as a major release of a distribution. 477 // For example, 18.04-LTS, 2019-Datacenter 478 // +kubebuilder:validation:MinLength=1 479 SKU string `json:"sku"` 480 } 481 482 // AzureMarketplaceImage defines an image in the Azure Marketplace to use for VM creation. 483 type AzureMarketplaceImage struct { 484 ImagePlan `json:",inline"` 485 486 // Version specifies the version of an image sku. The allowed formats 487 // are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. 488 // Specify 'latest' to use the latest version of an image available at deploy time. 489 // Even if you use 'latest', the VM image will not automatically update after deploy 490 // time even if a new version becomes available. 491 // +kubebuilder:validation:MinLength=1 492 Version string `json:"version"` 493 // ThirdPartyImage indicates the image is published by a third party publisher and a Plan 494 // will be generated for it. 495 // +kubebuilder:default=false 496 // +optional 497 ThirdPartyImage bool `json:"thirdPartyImage"` 498 } 499 500 // AzureSharedGalleryImage defines an image in a Shared Image Gallery to use for VM creation. 501 type AzureSharedGalleryImage struct { 502 // SubscriptionID is the identifier of the subscription that contains the shared image gallery 503 // +kubebuilder:validation:MinLength=1 504 SubscriptionID string `json:"subscriptionID"` 505 // ResourceGroup specifies the resource group containing the shared image gallery 506 // +kubebuilder:validation:MinLength=1 507 ResourceGroup string `json:"resourceGroup"` 508 // Gallery specifies the name of the shared image gallery that contains the image 509 // +kubebuilder:validation:MinLength=1 510 Gallery string `json:"gallery"` 511 // Name is the name of the image 512 // +kubebuilder:validation:MinLength=1 513 Name string `json:"name"` 514 // Version specifies the version of the marketplace image. The allowed formats 515 // are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. 516 // Specify 'latest' to use the latest version of an image available at deploy time. 517 // Even if you use 'latest', the VM image will not automatically update after deploy 518 // time even if a new version becomes available. 519 // +kubebuilder:validation:MinLength=1 520 Version string `json:"version"` 521 // Publisher is the name of the organization that created the image. 522 // This value will be used to add a `Plan` in the API request when creating the VM/VMSS resource. 523 // This is needed when the source image from which this SIG image was built requires the `Plan` to be used. 524 // +optional 525 Publisher *string `json:"publisher,omitempty"` 526 // Offer specifies the name of a group of related images created by the publisher. 527 // For example, UbuntuServer, WindowsServer 528 // This value will be used to add a `Plan` in the API request when creating the VM/VMSS resource. 529 // This is needed when the source image from which this SIG image was built requires the `Plan` to be used. 530 // +optional 531 Offer *string `json:"offer,omitempty"` 532 // SKU specifies an instance of an offer, such as a major release of a distribution. 533 // For example, 18.04-LTS, 2019-Datacenter 534 // This value will be used to add a `Plan` in the API request when creating the VM/VMSS resource. 535 // This is needed when the source image from which this SIG image was built requires the `Plan` to be used. 536 // +optional 537 SKU *string `json:"sku,omitempty"` 538 } 539 540 // VMIdentity defines the identity of the virtual machine, if configured. 541 // +kubebuilder:validation:Enum=None;SystemAssigned;UserAssigned 542 type VMIdentity string 543 544 const ( 545 // VMIdentityNone ... 546 VMIdentityNone VMIdentity = "None" 547 // VMIdentitySystemAssigned ... 548 VMIdentitySystemAssigned VMIdentity = "SystemAssigned" 549 // VMIdentityUserAssigned ... 550 VMIdentityUserAssigned VMIdentity = "UserAssigned" 551 ) 552 553 // SpotEvictionPolicy defines the eviction policy for spot VMs, if configured. 554 // +kubebuilder:validation:Enum=Deallocate;Delete 555 type SpotEvictionPolicy string 556 557 const ( 558 // SpotEvictionPolicyDeallocate is the default eviction policy and will deallocate the VM when the node is marked for eviction. 559 SpotEvictionPolicyDeallocate SpotEvictionPolicy = "Deallocate" 560 // SpotEvictionPolicyDelete will delete the VM when the node is marked for eviction. 561 SpotEvictionPolicyDelete SpotEvictionPolicy = "Delete" 562 ) 563 564 // UserAssignedIdentity defines the user-assigned identities provided 565 // by the user to be assigned to Azure resources. 566 type UserAssignedIdentity struct { 567 // ProviderID is the identification ID of the user-assigned Identity, the format of an identity is: 568 // 'azure:///subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}' 569 ProviderID string `json:"providerID"` 570 } 571 572 // IdentityType represents different types of identities. 573 // +kubebuilder:validation:Enum=ServicePrincipal;UserAssignedMSI;ManualServicePrincipal;ServicePrincipalCertificate;WorkloadIdentity 574 type IdentityType string 575 576 const ( 577 // UserAssignedMSI represents a user-assigned managed identity. 578 UserAssignedMSI IdentityType = "UserAssignedMSI" 579 580 // ServicePrincipal represents a service principal using a client password as secret. 581 ServicePrincipal IdentityType = "ServicePrincipal" 582 583 // ManualServicePrincipal represents a manual service principal. 584 ManualServicePrincipal IdentityType = "ManualServicePrincipal" 585 586 // ServicePrincipalCertificate represents a service principal using a certificate as secret. 587 ServicePrincipalCertificate IdentityType = "ServicePrincipalCertificate" 588 589 // WorkloadIdentity represents a WorkloadIdentity. 590 WorkloadIdentity IdentityType = "WorkloadIdentity" 591 ) 592 593 // OSDisk defines the operating system disk for a VM. 594 // 595 // WARNING: this requires any updates to ManagedDisk to be manually converted. This is due to the odd issue with 596 // conversion-gen where the warning message generated uses a relative directory import rather than the fully 597 // qualified import when generating outside of the GOPATH. 598 type OSDisk struct { 599 OSType string `json:"osType"` 600 // DiskSizeGB is the size in GB to assign to the OS disk. 601 // Will have a default of 30GB if not provided 602 // +optional 603 DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` 604 // ManagedDisk specifies the Managed Disk parameters for the OS disk. 605 // +optional 606 ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` 607 // +optional 608 DiffDiskSettings *DiffDiskSettings `json:"diffDiskSettings,omitempty"` 609 // CachingType specifies the caching requirements. 610 // +optional 611 // +kubebuilder:validation:Enum=None;ReadOnly;ReadWrite 612 CachingType string `json:"cachingType,omitempty"` 613 } 614 615 // DataDisk specifies the parameters that are used to add one or more data disks to the machine. 616 type DataDisk struct { 617 // NameSuffix is the suffix to be appended to the machine name to generate the disk name. 618 // Each disk name will be in format <machineName>_<nameSuffix>. 619 NameSuffix string `json:"nameSuffix"` 620 // DiskSizeGB is the size in GB to assign to the data disk. 621 DiskSizeGB int32 `json:"diskSizeGB"` 622 // ManagedDisk specifies the Managed Disk parameters for the data disk. 623 // +optional 624 ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` 625 // Lun Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. 626 // The value must be between 0 and 63. 627 // +optional 628 Lun *int32 `json:"lun,omitempty"` 629 // CachingType specifies the caching requirements. 630 // +optional 631 // +kubebuilder:validation:Enum=None;ReadOnly;ReadWrite 632 CachingType string `json:"cachingType,omitempty"` 633 } 634 635 // VMExtension specifies the parameters for a custom VM extension. 636 type VMExtension struct { 637 // Name is the name of the extension. 638 Name string `json:"name"` 639 // Publisher is the name of the extension handler publisher. 640 Publisher string `json:"publisher"` 641 // Version specifies the version of the script handler. 642 Version string `json:"version"` 643 // Settings is a JSON formatted public settings for the extension. 644 // +optional 645 Settings Tags `json:"settings,omitempty"` 646 // ProtectedSettings is a JSON formatted protected settings for the extension. 647 // +optional 648 ProtectedSettings Tags `json:"protectedSettings,omitempty"` 649 } 650 651 // ManagedDiskParameters defines the parameters of a managed disk. 652 type ManagedDiskParameters struct { 653 // +optional 654 StorageAccountType string `json:"storageAccountType,omitempty"` 655 // DiskEncryptionSet specifies the customer-managed disk encryption set resource id for the managed disk. 656 // +optional 657 DiskEncryptionSet *DiskEncryptionSetParameters `json:"diskEncryptionSet,omitempty"` 658 // SecurityProfile specifies the security profile for the managed disk. 659 // +optional 660 SecurityProfile *VMDiskSecurityProfile `json:"securityProfile,omitempty"` 661 } 662 663 // VMDiskSecurityProfile specifies the security profile settings for the managed disk. 664 // It can be set only for Confidential VMs. 665 type VMDiskSecurityProfile struct { 666 // DiskEncryptionSet specifies the customer-managed disk encryption set resource id for the 667 // managed disk that is used for Customer Managed Key encrypted ConfidentialVM OS Disk and 668 // VMGuest blob. 669 // +optional 670 DiskEncryptionSet *DiskEncryptionSetParameters `json:"diskEncryptionSet,omitempty"` 671 // SecurityEncryptionType specifies the encryption type of the managed disk. 672 // It is set to DiskWithVMGuestState to encrypt the managed disk along with the VMGuestState 673 // blob, and to VMGuestStateOnly to encrypt the VMGuestState blob only. 674 // When set to VMGuestStateOnly, VirtualizedTrustedPlatformModule should be set to Enabled. 675 // When set to DiskWithVMGuestState, EncryptionAtHost should be disabled, SecureBoot and 676 // VirtualizedTrustedPlatformModule should be set to Enabled. 677 // It can be set only for Confidential VMs. 678 // +kubebuilder:validation:Enum=VMGuestStateOnly;DiskWithVMGuestState 679 // +optional 680 SecurityEncryptionType SecurityEncryptionType `json:"securityEncryptionType,omitempty"` 681 } 682 683 // DiskEncryptionSetParameters defines disk encryption options. 684 type DiskEncryptionSetParameters struct { 685 // ID defines resourceID for diskEncryptionSet resource. It must be in the same subscription 686 // +optional 687 ID string `json:"id,omitempty"` 688 } 689 690 // DiffDiskPlacement - Specifies the ephemeral disk placement for operating system disk. This property can be used by user 691 // in the request to choose the location i.e, cache disk, resource disk or nvme disk space for 692 // Ephemeral OS disk provisioning. For more information on Ephemeral OS disk size requirements, please refer Ephemeral OS 693 // disk size requirements for Windows VM at 694 // https://docs.microsoft.com/azure/virtual-machines/windows/ephemeral-os-disks#size-requirements and Linux VM at 695 // https://docs.microsoft.com/azure/virtual-machines/linux/ephemeral-os-disks#size-requirements. 696 type DiffDiskPlacement string 697 698 const ( 699 // DiffDiskPlacementCacheDisk places the OsDisk on cache disk. 700 DiffDiskPlacementCacheDisk DiffDiskPlacement = "CacheDisk" 701 702 // DiffDiskPlacementNvmeDisk places the OsDisk on NVMe disk. 703 DiffDiskPlacementNvmeDisk DiffDiskPlacement = "NvmeDisk" 704 705 // DiffDiskPlacementResourceDisk places the OsDisk on temp disk. 706 DiffDiskPlacementResourceDisk DiffDiskPlacement = "ResourceDisk" 707 ) 708 709 // PossibleDiffDiskPlacementValues returns the possible values for the DiffDiskPlacement const type. 710 func PossibleDiffDiskPlacementValues() []DiffDiskPlacement { 711 return []DiffDiskPlacement{ 712 DiffDiskPlacementCacheDisk, 713 DiffDiskPlacementNvmeDisk, 714 DiffDiskPlacementResourceDisk, 715 } 716 } 717 718 // DiffDiskSettings describe ephemeral disk settings for the os disk. 719 type DiffDiskSettings struct { 720 // Option enables ephemeral OS when set to "Local" 721 // See https://learn.microsoft.com/azure/virtual-machines/ephemeral-os-disks for full details 722 // +kubebuilder:validation:Enum=Local 723 Option string `json:"option"` 724 725 // Placement specifies the ephemeral disk placement for operating system disk. If placement is specified, Option must be set to "Local". 726 // +kubebuilder:validation:Enum=CacheDisk;NvmeDisk;ResourceDisk 727 // +optional 728 Placement *DiffDiskPlacement `json:"placement,omitempty"` 729 } 730 731 // SubnetRole defines the unique role of a subnet. 732 type SubnetRole string 733 734 const ( 735 // SubnetNode defines a Kubernetes workload node role. 736 SubnetNode = SubnetRole(Node) 737 738 // SubnetControlPlane defines a Kubernetes control plane node role. 739 SubnetControlPlane = SubnetRole(ControlPlane) 740 741 // SubnetBastion defines a Bastion subnet role. 742 SubnetBastion = SubnetRole(Bastion) 743 744 // SubnetCluster defines a role that can be used for both Kubernetes control plane node and Kubernetes workload node. 745 SubnetCluster = SubnetRole(Cluster) 746 ) 747 748 // SubnetSpec configures an Azure subnet. 749 type SubnetSpec struct { 750 // ID is the Azure resource ID of the subnet. 751 // READ-ONLY 752 // +optional 753 ID string `json:"id,omitempty"` 754 755 // SecurityGroup defines the NSG (network security group) that should be attached to this subnet. 756 // +optional 757 SecurityGroup SecurityGroup `json:"securityGroup,omitempty"` 758 759 // RouteTable defines the route table that should be attached to this subnet. 760 // +optional 761 RouteTable RouteTable `json:"routeTable,omitempty"` 762 763 // NatGateway associated with this subnet. 764 // +optional 765 NatGateway NatGateway `json:"natGateway,omitempty"` 766 767 SubnetClassSpec `json:",inline"` 768 } 769 770 // ServiceEndpointSpec configures an Azure Service Endpoint. 771 type ServiceEndpointSpec struct { 772 Service string `json:"service"` 773 774 Locations []string `json:"locations"` 775 } 776 777 // PrivateLinkServiceConnection defines the specification for a private link service connection associated with a private endpoint. 778 type PrivateLinkServiceConnection struct { 779 // Name specifies the name of the private link service. 780 // +optional 781 Name string `json:"name,omitempty"` 782 // PrivateLinkServiceID specifies the resource ID of the private link service. 783 PrivateLinkServiceID string `json:"privateLinkServiceID,omitempty"` 784 // GroupIDs specifies the ID(s) of the group(s) obtained from the remote resource that this private endpoint should connect to. 785 // +optional 786 GroupIDs []string `json:"groupIDs,omitempty"` 787 // RequestMessage specifies a message passed to the owner of the remote resource with the private endpoint connection request. 788 // +kubebuilder:validation:MaxLength=140 789 // +optional 790 RequestMessage string `json:"requestMessage,omitempty"` 791 } 792 793 // PrivateEndpointSpec configures an Azure Private Endpoint. 794 type PrivateEndpointSpec struct { 795 // Name specifies the name of the private endpoint. 796 Name string `json:"name"` 797 // Location specifies the region to create the private endpoint. 798 // +optional 799 Location string `json:"location,omitempty"` 800 // PrivateLinkServiceConnections specifies Private Link Service Connections of the private endpoint. 801 PrivateLinkServiceConnections []PrivateLinkServiceConnection `json:"privateLinkServiceConnections,omitempty"` 802 // CustomNetworkInterfaceName specifies the network interface name associated with the private endpoint. 803 // +optional 804 CustomNetworkInterfaceName string `json:"customNetworkInterfaceName,omitempty"` 805 // PrivateIPAddresses specifies the IP addresses for the network interface associated with the private endpoint. 806 // They have to be part of the subnet where the private endpoint is linked. 807 // +optional 808 PrivateIPAddresses []string `json:"privateIPAddresses,omitempty"` 809 // ApplicationSecurityGroups specifies the Application security group in which the private endpoint IP configuration is included. 810 // +optional 811 ApplicationSecurityGroups []string `json:"applicationSecurityGroups,omitempty"` 812 // ManualApproval specifies if the connection approval needs to be done manually or not. 813 // Set it true when the network admin does not have access to approve connections to the remote resource. 814 // Defaults to false. 815 // +optional 816 ManualApproval bool `json:"manualApproval,omitempty"` 817 } 818 819 // NetworkInterface defines a network interface. 820 type NetworkInterface struct { 821 // SubnetName specifies the subnet in which the new network interface will be placed. 822 SubnetName string `json:"subnetName,omitempty"` 823 824 // PrivateIPConfigs specifies the number of private IP addresses to attach to the interface. 825 // Defaults to 1 if not specified. 826 // +optional 827 PrivateIPConfigs int `json:"privateIPConfigs,omitempty"` 828 829 // AcceleratedNetworking enables or disables Azure accelerated networking. If omitted, it will be set based on 830 // whether the requested VMSize supports accelerated networking. 831 // If AcceleratedNetworking is set to true with a VMSize that does not support it, Azure will return an error. 832 // +kubebuilder:validation:nullable 833 // +optional 834 AcceleratedNetworking *bool `json:"acceleratedNetworking,omitempty"` 835 } 836 837 // GetControlPlaneSubnet returns a subnet that has a role assigned to controlplane or all. Subnets with role controlplane are given higher priority. 838 func (n *NetworkSpec) GetControlPlaneSubnet() (SubnetSpec, error) { 839 // Priority is given for subnet that have role assigned as controlplane 840 if subnet, err := n.GetSubnet(SubnetControlPlane); err == nil { 841 return subnet, nil 842 } 843 844 if subnet, err := n.GetSubnet(SubnetCluster); err == nil { 845 return subnet, nil 846 } 847 848 return SubnetSpec{}, errors.Errorf("no subnet found with role %s", SubnetControlPlane) 849 } 850 851 // GetSubnet returns a subnet based on the subnet role. 852 func (n *NetworkSpec) GetSubnet(role SubnetRole) (SubnetSpec, error) { 853 for _, sn := range n.Subnets { 854 if sn.Role == role { 855 return sn, nil 856 } 857 } 858 return SubnetSpec{}, errors.Errorf("no subnet found with role %s", role) 859 } 860 861 // UpdateControlPlaneSubnet updates the cluster control plane subnets. 862 func (n *NetworkSpec) UpdateControlPlaneSubnet(subnet SubnetSpec) { 863 n.UpdateSubnet(subnet, SubnetControlPlane) 864 n.UpdateSubnet(subnet, SubnetCluster) 865 } 866 867 // UpdateSubnet updates the subnet based on the subnet role. 868 func (n *NetworkSpec) UpdateSubnet(subnet SubnetSpec, role SubnetRole) { 869 for i, sn := range n.Subnets { 870 if sn.Role == role { 871 n.Subnets[i] = subnet 872 } 873 } 874 } 875 876 // IsNatGatewayEnabled returns whether or not a NAT gateway is enabled on the subnet. 877 func (s SubnetSpec) IsNatGatewayEnabled() bool { 878 return s.NatGateway.Name != "" 879 } 880 881 // IsIPv6Enabled returns whether or not IPv6 is enabled on the subnet. 882 func (s SubnetSpec) IsIPv6Enabled() bool { 883 for _, cidr := range s.CIDRBlocks { 884 if net.IsIPv6CIDRString(cidr) { 885 return true 886 } 887 } 888 return false 889 } 890 891 // SecurityProfile specifies the Security profile settings for a 892 // virtual machine or virtual machine scale set. 893 type SecurityProfile struct { 894 // This field indicates whether Host Encryption should be enabled 895 // or disabled for a virtual machine or virtual machine scale set. 896 // This should be disabled when SecurityEncryptionType is set to DiskWithVMGuestState. 897 // Default is disabled. 898 // +optional 899 EncryptionAtHost *bool `json:"encryptionAtHost,omitempty"` 900 // SecurityType specifies the SecurityType of the virtual machine. It has to be set to any specified value to 901 // enable UefiSettings. The default behavior is: UefiSettings will not be enabled unless this property is set. 902 // +kubebuilder:validation:Enum=ConfidentialVM;TrustedLaunch 903 // +optional 904 SecurityType SecurityTypes `json:"securityType,omitempty"` 905 // UefiSettings specifies the security settings like secure boot and vTPM used while creating the virtual machine. 906 // +optional 907 UefiSettings *UefiSettings `json:"uefiSettings,omitempty"` 908 } 909 910 // UefiSettings specifies the security settings like secure boot and vTPM used while creating the virtual 911 // machine. 912 // +optional 913 type UefiSettings struct { 914 // SecureBootEnabled specifies whether secure boot should be enabled on the virtual machine. 915 // Secure Boot verifies the digital signature of all boot components and halts the boot process if signature verification fails. 916 // If omitted, the platform chooses a default, which is subject to change over time, currently that default is false. 917 //+optional 918 SecureBootEnabled *bool `json:"secureBootEnabled,omitempty"` 919 // VTpmEnabled specifies whether vTPM should be enabled on the virtual machine. 920 // When true it enables the virtualized trusted platform module measurements to create a known good boot integrity policy baseline. 921 // The integrity policy baseline is used for comparison with measurements from subsequent VM boots to determine if anything has changed. 922 // This is required to be set to Enabled if SecurityEncryptionType is defined. 923 // If omitted, the platform chooses a default, which is subject to change over time, currently that default is false. 924 // +optional 925 VTpmEnabled *bool `json:"vTpmEnabled,omitempty"` 926 } 927 928 // AddressRecord specifies a DNS record mapping a hostname to an IPV4 or IPv6 address. 929 type AddressRecord struct { 930 Hostname string 931 IP string 932 } 933 934 // CloudProviderConfigOverrides represents the fields that can be overridden in azure cloud provider config. 935 type CloudProviderConfigOverrides struct { 936 // +optional 937 RateLimits []RateLimitSpec `json:"rateLimits,omitempty"` 938 // +optional 939 BackOffs BackOffConfig `json:"backOffs,omitempty"` 940 } 941 942 // BackOffConfig indicates the back-off config options. 943 type BackOffConfig struct { 944 // +optional 945 CloudProviderBackoff bool `json:"cloudProviderBackoff,omitempty"` 946 // +optional 947 CloudProviderBackoffRetries int `json:"cloudProviderBackoffRetries,omitempty"` 948 // +optional 949 CloudProviderBackoffExponent *resource.Quantity `json:"cloudProviderBackoffExponent,omitempty"` 950 // +optional 951 CloudProviderBackoffDuration int `json:"cloudProviderBackoffDuration,omitempty"` 952 // +optional 953 CloudProviderBackoffJitter *resource.Quantity `json:"cloudProviderBackoffJitter,omitempty"` 954 } 955 956 // RateLimitSpec represents the rate limit configuration for a particular kind of resource. 957 // Eg. loadBalancerRateLimit is used to configure rate limits for load balancers. 958 // This eventually gets converted to CloudProviderRateLimitConfig that cloud-provider-azure expects. 959 // See: https://github.com/kubernetes-sigs/cloud-provider-azure/blob/d585c2031925b39c925624302f22f8856e29e352/pkg/provider/azure_ratelimit.go#L25 960 // We cannot use CloudProviderRateLimitConfig directly because floating point values are not supported in controller-tools. 961 // See: https://github.com/kubernetes-sigs/controller-tools/issues/245 962 type RateLimitSpec struct { 963 // Name is the name of the rate limit spec. 964 // +kubebuilder:validation:Enum=defaultRateLimit;routeRateLimit;subnetsRateLimit;interfaceRateLimit;routeTableRateLimit;loadBalancerRateLimit;publicIPAddressRateLimit;securityGroupRateLimit;virtualMachineRateLimit;storageAccountRateLimit;diskRateLimit;snapshotRateLimit;virtualMachineScaleSetRateLimit;virtualMachineSizesRateLimit;availabilitySetRateLimit 965 Name string `json:"name"` 966 // +optional 967 Config RateLimitConfig `json:"config,omitempty"` 968 } 969 970 // RateLimitConfig indicates the rate limit config options. 971 type RateLimitConfig struct { 972 // +optional 973 CloudProviderRateLimit bool `json:"cloudProviderRateLimit,omitempty"` 974 // +optional 975 CloudProviderRateLimitQPS *resource.Quantity `json:"cloudProviderRateLimitQPS,omitempty"` 976 // +optional 977 CloudProviderRateLimitBucket int `json:"cloudProviderRateLimitBucket,omitempty"` 978 // +optional 979 CloudProviderRateLimitQPSWrite *resource.Quantity `json:"cloudProviderRateLimitQPSWrite,omitempty"` 980 // +optional 981 CloudProviderRateLimitBucketWrite int `json:"cloudProviderRateLimitBucketWrite,omitempty"` 982 } 983 984 const ( 985 // DefaultRateLimit ... 986 DefaultRateLimit = "defaultRateLimit" 987 // RouteRateLimit ... 988 RouteRateLimit = "routeRateLimit" 989 // SubnetsRateLimit ... 990 SubnetsRateLimit = "subnetsRateLimit" 991 // InterfaceRateLimit ... 992 InterfaceRateLimit = "interfaceRateLimit" 993 // RouteTableRateLimit ... 994 RouteTableRateLimit = "routeTableRateLimit" 995 // LoadBalancerRateLimit ... 996 LoadBalancerRateLimit = "loadBalancerRateLimit" 997 // PublicIPAddressRateLimit ... 998 PublicIPAddressRateLimit = "publicIPAddressRateLimit" 999 // SecurityGroupRateLimit ... 1000 SecurityGroupRateLimit = "securityGroupRateLimit" 1001 // VirtualMachineRateLimit ... 1002 VirtualMachineRateLimit = "virtualMachineRateLimit" 1003 // StorageAccountRateLimit ... 1004 StorageAccountRateLimit = "storageAccountRateLimit" 1005 // DiskRateLimit ... 1006 DiskRateLimit = "diskRateLimit" 1007 // SnapshotRateLimit ... 1008 SnapshotRateLimit = "snapshotRateLimit" 1009 // VirtualMachineScaleSetRateLimit ... 1010 VirtualMachineScaleSetRateLimit = "virtualMachineScaleSetRateLimit" 1011 // VirtualMachineSizesRateLimit ... 1012 VirtualMachineSizesRateLimit = "virtualMachineSizesRateLimit" 1013 // AvailabilitySetRateLimit ... 1014 AvailabilitySetRateLimit = "availabilitySetRateLimit" 1015 ) 1016 1017 // BastionHostSkuName is the name of the SKU used to specify the tier of Azure Bastion Host. 1018 type BastionHostSkuName string 1019 1020 const ( 1021 // BasicBastionHostSku SKU for the Azure Bastion Host. 1022 BasicBastionHostSku BastionHostSkuName = "Basic" 1023 // StandardBastionHostSku SKU for the Azure Bastion Host. 1024 StandardBastionHostSku BastionHostSkuName = "Standard" 1025 ) 1026 1027 // BastionSpec specifies how the Bastion feature should be set up for the cluster. 1028 type BastionSpec struct { 1029 // +optional 1030 AzureBastion *AzureBastion `json:"azureBastion,omitempty"` 1031 } 1032 1033 // AzureBastion specifies how the Azure Bastion cloud component should be configured. 1034 type AzureBastion struct { 1035 // +optional 1036 Name string `json:"name,omitempty"` 1037 // +optional 1038 Subnet SubnetSpec `json:"subnet,omitempty"` 1039 // +optional 1040 PublicIP PublicIPSpec `json:"publicIP,omitempty"` 1041 // BastionHostSkuName configures the tier of the Azure Bastion Host. Can be either Basic or Standard. Defaults to Basic. 1042 // +kubebuilder:default=Basic 1043 // +kubebuilder:validation:Enum=Basic;Standard 1044 // +optional 1045 Sku BastionHostSkuName `json:"sku,omitempty"` 1046 // EnableTunneling enables the native client support feature for the Azure Bastion Host. Defaults to false. 1047 // +kubebuilder:default=false 1048 // +optional 1049 EnableTunneling bool `json:"enableTunneling,omitempty"` 1050 } 1051 1052 // FleetsMember defines the fleets member configuration. 1053 // See also [AKS doc]. 1054 // 1055 // [AKS doc]: https://learn.microsoft.com/en-us/azure/templates/microsoft.containerservice/2023-03-15-preview/fleets/members 1056 type FleetsMember struct { 1057 // Name is the name of the member. 1058 // +optional 1059 Name string `json:"name,omitempty"` 1060 1061 FleetsMemberClassSpec `json:",inline"` 1062 } 1063 1064 // BackendPool describes the backend pool of the load balancer. 1065 type BackendPool struct { 1066 // Name specifies the name of backend pool for the load balancer. If not specified, the default name will 1067 // be set, depending on the load balancer role. 1068 // +optional 1069 Name string `json:"name,omitempty"` 1070 } 1071 1072 // IsTerminalProvisioningState returns true if the ProvisioningState is a terminal state for an Azure resource. 1073 func IsTerminalProvisioningState(state ProvisioningState) bool { 1074 return state == Failed || state == Succeeded 1075 } 1076 1077 // Diagnostics is used to configure the diagnostic settings of the virtual machine. 1078 type Diagnostics struct { 1079 // Boot configures the boot diagnostics settings for the virtual machine. 1080 // This allows to configure capturing serial output from the virtual machine on boot. 1081 // This is useful for debugging software based launch issues. 1082 // If not specified then Boot diagnostics (Managed) will be enabled. 1083 // +optional 1084 Boot *BootDiagnostics `json:"boot,omitempty"` 1085 } 1086 1087 // BootDiagnostics configures the boot diagnostics settings for the virtual machine. 1088 // This allows you to configure capturing serial output from the virtual machine on boot. 1089 // This is useful for debugging software based launch issues. 1090 // +union 1091 type BootDiagnostics struct { 1092 // StorageAccountType determines if the storage account for storing the diagnostics data 1093 // should be disabled (Disabled), provisioned by Azure (Managed) or by the user (UserManaged). 1094 // +kubebuilder:validation:Required 1095 // +unionDiscriminator 1096 StorageAccountType BootDiagnosticsStorageAccountType `json:"storageAccountType"` 1097 1098 // UserManaged provides a reference to the user-managed storage account. 1099 // +optional 1100 UserManaged *UserManagedBootDiagnostics `json:"userManaged,omitempty"` 1101 } 1102 1103 // BootDiagnosticsStorageAccountType defines the list of valid storage account types 1104 // for the boot diagnostics. 1105 // +kubebuilder:validation:Enum:="Managed";"UserManaged";"Disabled" 1106 type BootDiagnosticsStorageAccountType string 1107 1108 const ( 1109 // DisabledDiagnosticsStorage is used to determine that the diagnostics storage account 1110 // should be disabled. 1111 DisabledDiagnosticsStorage BootDiagnosticsStorageAccountType = "Disabled" 1112 1113 // ManagedDiagnosticsStorage is used to determine that the diagnostics storage account 1114 // should be provisioned by Azure. 1115 ManagedDiagnosticsStorage BootDiagnosticsStorageAccountType = "Managed" 1116 1117 // UserManagedDiagnosticsStorage is used to determine that the diagnostics storage account 1118 // should be provisioned by the User. 1119 UserManagedDiagnosticsStorage BootDiagnosticsStorageAccountType = "UserManaged" 1120 ) 1121 1122 // UserManagedBootDiagnostics provides a reference to a user-managed 1123 // storage account. 1124 type UserManagedBootDiagnostics struct { 1125 // StorageAccountURI is the URI of the user-managed storage account. 1126 // The URI typically will be `https://<mystorageaccountname>.blob.core.windows.net/` 1127 // but may differ if you are using Azure DNS zone endpoints. 1128 // You can find the correct endpoint by looking for the Blob Primary Endpoint in the 1129 // endpoints tab in the Azure console or with the CLI by issuing 1130 // `az storage account list --query='[].{name: name, "resource group": resourceGroup, "blob endpoint": primaryEndpoints.blob}'`. 1131 // +kubebuilder:validation:Required 1132 // +kubebuilder:validation:Pattern=`^https://` 1133 // +kubebuilder:validation:MaxLength=1024 1134 StorageAccountURI string `json:"storageAccountURI"` 1135 } 1136 1137 // OrchestrationModeType represents the orchestration mode for a Virtual Machine Scale Set backing an AzureMachinePool. 1138 // +kubebuilder:validation:Enum=Flexible;Uniform 1139 type OrchestrationModeType string 1140 1141 const ( 1142 // FlexibleOrchestrationMode treats VMs as individual resources accessible by standard VM APIs. 1143 FlexibleOrchestrationMode OrchestrationModeType = "Flexible" 1144 // UniformOrchestrationMode treats VMs as identical instances accessible by the VMSS VM API. 1145 UniformOrchestrationMode OrchestrationModeType = "Uniform" 1146 ) 1147 1148 // ExtensionPlan represents the plan for an AKS marketplace extension. 1149 type ExtensionPlan struct { 1150 // Name is the user-defined name of the 3rd Party Artifact that is being procured. 1151 // +optional 1152 Name string `json:"name,omitempty"` 1153 1154 // Product is the name of the 3rd Party artifact that is being procured. 1155 // +optional 1156 Product string `json:"product,omitempty"` 1157 1158 // PromotionCode is a publisher-provided promotion code as provisioned in Data Market for the said product/artifact. 1159 // +optional 1160 PromotionCode string `json:"promotionCode,omitempty"` 1161 1162 // Publisher is the name of the publisher of the 3rd Party Artifact that is being bought. 1163 // +optional 1164 Publisher string `json:"publisher,omitempty"` 1165 1166 // Version is the version of the plan. 1167 // +optional 1168 Version string `json:"version,omitempty"` 1169 } 1170 1171 // ExtensionScope defines the scope of the AKS marketplace extension, if configured. 1172 type ExtensionScope struct { 1173 // ScopeType is the scope of the extension. It can be either Cluster or Namespace, but not both. 1174 ScopeType ExtensionScopeType `json:"scopeType"` 1175 1176 // ReleaseNamespace is the namespace where the extension Release must be placed, for a Cluster-scoped extension. 1177 // Required for Cluster-scoped extensions. 1178 // +optional 1179 ReleaseNamespace string `json:"releaseNamespace,omitempty"` 1180 1181 // TargetNamespace is the namespace where the extension will be created for a Namespace-scoped extension. 1182 // Required for Namespace-scoped extensions. 1183 // +optional 1184 TargetNamespace string `json:"targetNamespace,omitempty"` 1185 } 1186 1187 // ExtensionScopeType defines the scope type of the AKS marketplace extension, if configured. 1188 // +kubebuilder:validation:Enum=Cluster;Namespace 1189 type ExtensionScopeType string 1190 1191 const ( 1192 // ExtensionScopeCluster ... 1193 ExtensionScopeCluster ExtensionScopeType = "Cluster" 1194 // ExtensionScopeNamespace ... 1195 ExtensionScopeNamespace ExtensionScopeType = "Namespace" 1196 ) 1197 1198 // ExtensionIdentity defines the identity of the AKS marketplace extension, if configured. 1199 // +kubebuilder:validation:Enum=SystemAssigned 1200 type ExtensionIdentity string 1201 1202 const ( 1203 // ExtensionIdentitySystemAssigned ... 1204 ExtensionIdentitySystemAssigned ExtensionIdentity = "SystemAssigned" 1205 ) 1206 1207 // AKSAssignedIdentity defines the AKS assigned-identity of the aks marketplace extension, if configured. 1208 // +kubebuilder:validation:Enum=SystemAssigned;UserAssigned 1209 type AKSAssignedIdentity string 1210 1211 const ( 1212 // AKSAssignedIdentitySystemAssigned ... 1213 AKSAssignedIdentitySystemAssigned AKSAssignedIdentity = "SystemAssigned" 1214 1215 // AKSAssignedIdentityUserAssigned ... 1216 AKSAssignedIdentityUserAssigned AKSAssignedIdentity = "UserAssigned" 1217 )