sigs.k8s.io/cluster-api-provider-azure@v1.17.0/api/v1beta1/types_class.go (about)

     1  /*
     2  Copyright 2022 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  	corev1 "k8s.io/api/core/v1"
    21  	"k8s.io/apimachinery/pkg/api/resource"
    22  	clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
    23  )
    24  
    25  // AzureClusterClassSpec defines the AzureCluster properties that may be shared across several Azure clusters.
    26  type AzureClusterClassSpec struct {
    27  	// +optional
    28  	SubscriptionID string `json:"subscriptionID,omitempty"`
    29  
    30  	Location string `json:"location"`
    31  
    32  	// ExtendedLocation is an optional set of ExtendedLocation properties for clusters on Azure public MEC.
    33  	// +optional
    34  	ExtendedLocation *ExtendedLocationSpec `json:"extendedLocation,omitempty"`
    35  
    36  	// AdditionalTags is an optional set of tags to add to Azure resources managed by the Azure provider, in addition to the
    37  	// ones added by default.
    38  	// +optional
    39  	AdditionalTags Tags `json:"additionalTags,omitempty"`
    40  
    41  	// IdentityRef is a reference to an AzureIdentity to be used when reconciling this cluster
    42  	// +optional
    43  	IdentityRef *corev1.ObjectReference `json:"identityRef,omitempty"`
    44  
    45  	// AzureEnvironment is the name of the AzureCloud to be used.
    46  	// The default value that would be used by most users is "AzurePublicCloud", other values are:
    47  	// - ChinaCloud: "AzureChinaCloud"
    48  	// - GermanCloud: "AzureGermanCloud"
    49  	// - PublicCloud: "AzurePublicCloud"
    50  	// - USGovernmentCloud: "AzureUSGovernmentCloud"
    51  	//
    52  	// Note that values other than the default must also be accompanied by corresponding changes to the
    53  	// aso-controller-settings Secret to configure ASO to refer to the non-Public cloud. ASO currently does
    54  	// not support referring to multiple different clouds in a single installation. The following fields must
    55  	// be defined in the Secret:
    56  	// - AZURE_AUTHORITY_HOST
    57  	// - AZURE_RESOURCE_MANAGER_ENDPOINT
    58  	// - AZURE_RESOURCE_MANAGER_AUDIENCE
    59  	//
    60  	// See the [ASO docs] for more details.
    61  	//
    62  	// [ASO docs]: https://azure.github.io/azure-service-operator/guide/aso-controller-settings-options/
    63  	// +optional
    64  	AzureEnvironment string `json:"azureEnvironment,omitempty"`
    65  
    66  	// CloudProviderConfigOverrides is an optional set of configuration values that can be overridden in azure cloud provider config.
    67  	// This is only a subset of options that are available in azure cloud provider config.
    68  	// Some values for the cloud provider config are inferred from other parts of cluster api provider azure spec, and may not be available for overrides.
    69  	// See: https://cloud-provider-azure.sigs.k8s.io/install/configs
    70  	// Note: All cloud provider config values can be customized by creating the secret beforehand. CloudProviderConfigOverrides is only used when the secret is managed by the Azure Provider.
    71  	// +optional
    72  	CloudProviderConfigOverrides *CloudProviderConfigOverrides `json:"cloudProviderConfigOverrides,omitempty"`
    73  
    74  	// FailureDomains is a list of failure domains in the cluster's region, used to restrict
    75  	// eligibility to host the control plane. A FailureDomain maps to an availability zone,
    76  	// which is a separated group of datacenters within a region.
    77  	// See: https://learn.microsoft.com/azure/reliability/availability-zones-overview
    78  	// +optional
    79  	FailureDomains clusterv1.FailureDomains `json:"failureDomains,omitempty"`
    80  }
    81  
    82  // AzureManagedControlPlaneClassSpec defines the AzureManagedControlPlane properties that may be shared across several azure managed control planes.
    83  type AzureManagedControlPlaneClassSpec struct {
    84  	// MachineTemplate contains information about how machines
    85  	// should be shaped when creating or updating a control plane.
    86  	// For the AzureManagedControlPlaneTemplate, this field is used
    87  	// only to fulfill the CAPI contract.
    88  	// +optional
    89  	MachineTemplate *AzureManagedControlPlaneTemplateMachineTemplate `json:"machineTemplate,omitempty"`
    90  
    91  	// ResourceGroupName is the name of the Azure resource group for this AKS Cluster.
    92  	// Immutable.
    93  	ResourceGroupName string `json:"resourceGroupName"`
    94  
    95  	// Version defines the desired Kubernetes version.
    96  	// +kubebuilder:validation:MinLength:=2
    97  	Version string `json:"version"`
    98  
    99  	// VirtualNetwork describes the virtual network for the AKS cluster. It will be created if it does not already exist.
   100  	// +optional
   101  	VirtualNetwork ManagedControlPlaneVirtualNetwork `json:"virtualNetwork,omitempty"`
   102  
   103  	// SubscriptionID is the GUID of the Azure subscription that owns this cluster.
   104  	// +optional
   105  	SubscriptionID string `json:"subscriptionID,omitempty"`
   106  
   107  	// Location is a string matching one of the canonical Azure region names. Examples: "westus2", "eastus".
   108  	Location string `json:"location"`
   109  
   110  	// AdditionalTags is an optional set of tags to add to Azure resources managed by the Azure provider, in addition to the
   111  	// ones added by default.
   112  	// +optional
   113  	AdditionalTags Tags `json:"additionalTags,omitempty"`
   114  
   115  	// NetworkPlugin used for building Kubernetes network.
   116  	// +kubebuilder:validation:Enum=azure;kubenet;none
   117  	// +optional
   118  	NetworkPlugin *string `json:"networkPlugin,omitempty"`
   119  
   120  	// NetworkPluginMode is the mode the network plugin should use.
   121  	// Allowed value is "overlay".
   122  	// +kubebuilder:validation:Enum=overlay
   123  	// +optional
   124  	NetworkPluginMode *NetworkPluginMode `json:"networkPluginMode,omitempty"`
   125  
   126  	// NetworkPolicy used for building Kubernetes network.
   127  	// +kubebuilder:validation:Enum=azure;calico;cilium
   128  	// +optional
   129  	NetworkPolicy *string `json:"networkPolicy,omitempty"`
   130  
   131  	// NetworkDataplane is the dataplane used for building the Kubernetes network.
   132  	// +kubebuilder:validation:Enum=azure;cilium
   133  	// +optional
   134  	NetworkDataplane *NetworkDataplaneType `json:"networkDataplane,omitempty"`
   135  
   136  	// Outbound configuration used by Nodes.
   137  	// +kubebuilder:validation:Enum=loadBalancer;managedNATGateway;userAssignedNATGateway;userDefinedRouting
   138  	// +optional
   139  	OutboundType *ManagedControlPlaneOutboundType `json:"outboundType,omitempty"`
   140  
   141  	// DNSServiceIP is an IP address assigned to the Kubernetes DNS service.
   142  	// It must be within the Kubernetes service address range specified in serviceCidr.
   143  	// Immutable.
   144  	// +optional
   145  	DNSServiceIP *string `json:"dnsServiceIP,omitempty"`
   146  
   147  	// LoadBalancerSKU is the SKU of the loadBalancer to be provisioned.
   148  	// Immutable.
   149  	// +kubebuilder:validation:Enum=Basic;Standard
   150  	// +kubebuilder:default:=Standard
   151  	// +optional
   152  	LoadBalancerSKU *string `json:"loadBalancerSKU,omitempty"`
   153  
   154  	// IdentityRef is a reference to a AzureClusterIdentity to be used when reconciling this cluster
   155  	IdentityRef *corev1.ObjectReference `json:"identityRef"`
   156  
   157  	// AadProfile is Azure Active Directory configuration to integrate with AKS for aad authentication.
   158  	// +optional
   159  	AADProfile *AADProfile `json:"aadProfile,omitempty"`
   160  
   161  	// AddonProfiles are the profiles of managed cluster add-on.
   162  	// +optional
   163  	AddonProfiles []AddonProfile `json:"addonProfiles,omitempty"`
   164  
   165  	// SKU is the SKU of the AKS to be provisioned.
   166  	// +optional
   167  	SKU *AKSSku `json:"sku,omitempty"`
   168  
   169  	// LoadBalancerProfile is the profile of the cluster load balancer.
   170  	// +optional
   171  	LoadBalancerProfile *LoadBalancerProfile `json:"loadBalancerProfile,omitempty"`
   172  
   173  	// APIServerAccessProfile is the access profile for AKS API server.
   174  	// Immutable except for `authorizedIPRanges`.
   175  	// +optional
   176  	APIServerAccessProfile *APIServerAccessProfile `json:"apiServerAccessProfile,omitempty"`
   177  
   178  	// AutoscalerProfile is the parameters to be applied to the cluster-autoscaler when enabled
   179  	// +optional
   180  	AutoScalerProfile *AutoScalerProfile `json:"autoscalerProfile,omitempty"`
   181  
   182  	// AzureEnvironment is the name of the AzureCloud to be used.
   183  	// The default value that would be used by most users is "AzurePublicCloud", other values are:
   184  	// - ChinaCloud: "AzureChinaCloud"
   185  	// - PublicCloud: "AzurePublicCloud"
   186  	// - USGovernmentCloud: "AzureUSGovernmentCloud"
   187  	//
   188  	// Note that values other than the default must also be accompanied by corresponding changes to the
   189  	// aso-controller-settings Secret to configure ASO to refer to the non-Public cloud. ASO currently does
   190  	// not support referring to multiple different clouds in a single installation. The following fields must
   191  	// be defined in the Secret:
   192  	// - AZURE_AUTHORITY_HOST
   193  	// - AZURE_RESOURCE_MANAGER_ENDPOINT
   194  	// - AZURE_RESOURCE_MANAGER_AUDIENCE
   195  	//
   196  	// See the [ASO docs] for more details.
   197  	//
   198  	// [ASO docs]: https://azure.github.io/azure-service-operator/guide/aso-controller-settings-options/
   199  	// +optional
   200  	AzureEnvironment string `json:"azureEnvironment,omitempty"`
   201  
   202  	// Identity configuration used by the AKS control plane.
   203  	// +optional
   204  	Identity *Identity `json:"identity,omitempty"`
   205  
   206  	// KubeletUserAssignedIdentity is the user-assigned identity for kubelet.
   207  	// For authentication with Azure Container Registry.
   208  	// +optional
   209  	KubeletUserAssignedIdentity string `json:"kubeletUserAssignedIdentity,omitempty"`
   210  
   211  	// HTTPProxyConfig is the HTTP proxy configuration for the cluster.
   212  	// Immutable.
   213  	// +optional
   214  	HTTPProxyConfig *HTTPProxyConfig `json:"httpProxyConfig,omitempty"`
   215  
   216  	// OIDCIssuerProfile is the OIDC issuer profile of the Managed Cluster.
   217  	// +optional
   218  	OIDCIssuerProfile *OIDCIssuerProfile `json:"oidcIssuerProfile,omitempty"`
   219  
   220  	// DisableLocalAccounts disables getting static credentials for this cluster when set. Expected to only be used for AAD clusters.
   221  	// +optional
   222  	DisableLocalAccounts *bool `json:"disableLocalAccounts,omitempty"`
   223  
   224  	// FleetsMember is the spec for the fleet this cluster is a member of.
   225  	// See also [AKS doc].
   226  	//
   227  	// [AKS doc]: https://learn.microsoft.com/en-us/azure/templates/microsoft.containerservice/2023-03-15-preview/fleets/members
   228  	// +optional
   229  	FleetsMember *FleetsMemberClassSpec `json:"fleetsMember,omitempty"`
   230  
   231  	// Extensions is a list of AKS extensions to be installed on the cluster.
   232  	// +optional
   233  	Extensions []AKSExtension `json:"extensions,omitempty"`
   234  
   235  	// AutoUpgradeProfile defines the auto upgrade configuration.
   236  	// +optional
   237  	AutoUpgradeProfile *ManagedClusterAutoUpgradeProfile `json:"autoUpgradeProfile,omitempty"`
   238  
   239  	// SecurityProfile defines the security profile for cluster.
   240  	// +optional
   241  	SecurityProfile *ManagedClusterSecurityProfile `json:"securityProfile,omitempty"`
   242  
   243  	// ASOManagedClusterPatches defines JSON merge patches to be applied to the generated ASO ManagedCluster resource.
   244  	// WARNING: This is meant to be used sparingly to enable features for development and testing that are not
   245  	// otherwise represented in the CAPZ API. Misconfiguration that conflicts with CAPZ's normal mode of
   246  	// operation is possible.
   247  	// +optional
   248  	ASOManagedClusterPatches []string `json:"asoManagedClusterPatches,omitempty"`
   249  
   250  	// EnablePreviewFeatures enables preview features for the cluster.
   251  	// +optional
   252  	EnablePreviewFeatures *bool `json:"enablePreviewFeatures,omitempty"`
   253  }
   254  
   255  // ManagedClusterAutoUpgradeProfile defines the auto upgrade profile for a managed cluster.
   256  type ManagedClusterAutoUpgradeProfile struct {
   257  	// UpgradeChannel determines the type of upgrade channel for automatically upgrading the cluster.
   258  	// +kubebuilder:validation:Enum=node-image;none;patch;rapid;stable
   259  	// +optional
   260  	UpgradeChannel *UpgradeChannel `json:"upgradeChannel,omitempty"`
   261  }
   262  
   263  // AzureManagedMachinePoolClassSpec defines the AzureManagedMachinePool properties that may be shared across several Azure managed machinepools.
   264  type AzureManagedMachinePoolClassSpec struct {
   265  	// AdditionalTags is an optional set of tags to add to Azure resources managed by the
   266  	// Azure provider, in addition to the ones added by default.
   267  	// +optional
   268  	AdditionalTags Tags `json:"additionalTags,omitempty"`
   269  
   270  	// Name is the name of the agent pool. If not specified, CAPZ uses the name of the CR as the agent pool name.
   271  	// Immutable.
   272  	// +optional
   273  	Name *string `json:"name,omitempty"`
   274  
   275  	// Mode represents the mode of an agent pool. Possible values include: System, User.
   276  	// +kubebuilder:validation:Enum=System;User
   277  	Mode string `json:"mode"`
   278  
   279  	// SKU is the size of the VMs in the node pool.
   280  	// Immutable.
   281  	SKU string `json:"sku"`
   282  
   283  	// OSDiskSizeGB is the disk size for every machine in this agent pool.
   284  	// If you specify 0, it will apply the default osDisk size according to the vmSize specified.
   285  	// Immutable.
   286  	// +optional
   287  	OSDiskSizeGB *int `json:"osDiskSizeGB,omitempty"`
   288  
   289  	// AvailabilityZones - Availability zones for nodes. Must use VirtualMachineScaleSets AgentPoolType.
   290  	// Immutable.
   291  	// +optional
   292  	AvailabilityZones []string `json:"availabilityZones,omitempty"`
   293  
   294  	// Node labels represent the labels for all of the nodes present in node pool.
   295  	// See also [AKS doc].
   296  	//
   297  	// [AKS doc]: https://learn.microsoft.com/azure/aks/use-labels
   298  	// +optional
   299  	NodeLabels map[string]string `json:"nodeLabels,omitempty"`
   300  
   301  	// Taints specifies the taints for nodes present in this agent pool.
   302  	// See also [AKS doc].
   303  	//
   304  	// [AKS doc]: https://learn.microsoft.com/azure/aks/use-multiple-node-pools#setting-node-pool-taints
   305  	// +optional
   306  	Taints Taints `json:"taints,omitempty"`
   307  
   308  	// Scaling specifies the autoscaling parameters for the node pool.
   309  	// +optional
   310  	Scaling *ManagedMachinePoolScaling `json:"scaling,omitempty"`
   311  
   312  	// MaxPods specifies the kubelet `--max-pods` configuration for the node pool.
   313  	// Immutable.
   314  	// See also [AKS doc], [K8s doc].
   315  	//
   316  	// [AKS doc]: https://learn.microsoft.com/azure/aks/configure-azure-cni#configure-maximum---new-clusters
   317  	// [K8s doc]: https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/
   318  	// +optional
   319  	MaxPods *int `json:"maxPods,omitempty"`
   320  
   321  	// OsDiskType specifies the OS disk type for each node in the pool. Allowed values are 'Ephemeral' and 'Managed' (default).
   322  	// Immutable.
   323  	// See also [AKS doc].
   324  	//
   325  	// [AKS doc]: https://learn.microsoft.com/azure/aks/cluster-configuration#ephemeral-os
   326  	// +kubebuilder:validation:Enum=Ephemeral;Managed
   327  	// +kubebuilder:default=Managed
   328  	// +optional
   329  	OsDiskType *string `json:"osDiskType,omitempty"`
   330  
   331  	// EnableUltraSSD enables the storage type UltraSSD_LRS for the agent pool.
   332  	// Immutable.
   333  	// +optional
   334  	EnableUltraSSD *bool `json:"enableUltraSSD,omitempty"`
   335  
   336  	// OSType specifies the virtual machine operating system. Default to Linux. Possible values include: 'Linux', 'Windows'.
   337  	// 'Windows' requires the AzureManagedControlPlane's `spec.networkPlugin` to be `azure`.
   338  	// Immutable.
   339  	// See also [AKS doc].
   340  	//
   341  	// [AKS doc]: https://learn.microsoft.com/rest/api/aks/agent-pools/create-or-update?tabs=HTTP#ostype
   342  	// +kubebuilder:validation:Enum=Linux;Windows
   343  	// +optional
   344  	OSType *string `json:"osType,omitempty"`
   345  
   346  	// EnableNodePublicIP controls whether or not nodes in the pool each have a public IP address.
   347  	// Immutable.
   348  	// +optional
   349  	EnableNodePublicIP *bool `json:"enableNodePublicIP,omitempty"`
   350  
   351  	// NodePublicIPPrefixID specifies the public IP prefix resource ID which VM nodes should use IPs from.
   352  	// Immutable.
   353  	// +optional
   354  	NodePublicIPPrefixID *string `json:"nodePublicIPPrefixID,omitempty"`
   355  
   356  	// ScaleSetPriority specifies the ScaleSetPriority value. Default to Regular. Possible values include: 'Regular', 'Spot'
   357  	// Immutable.
   358  	// +kubebuilder:validation:Enum=Regular;Spot
   359  	// +optional
   360  	ScaleSetPriority *string `json:"scaleSetPriority,omitempty"`
   361  
   362  	// ScaleDownMode affects the cluster autoscaler behavior. Default to Delete. Possible values include: 'Deallocate', 'Delete'
   363  	// +kubebuilder:validation:Enum=Deallocate;Delete
   364  	// +kubebuilder:default=Delete
   365  	// +optional
   366  	ScaleDownMode *string `json:"scaleDownMode,omitempty"`
   367  
   368  	// SpotMaxPrice defines max price to pay for spot instance. Possible values are any decimal value greater than zero or -1.
   369  	// If you set the max price to be -1, the VM won't be evicted based on price. The price for the VM will be the current price
   370  	// for spot or the price for a standard VM, which ever is less, as long as there's capacity and quota available.
   371  	// +optional
   372  	SpotMaxPrice *resource.Quantity `json:"spotMaxPrice,omitempty"`
   373  
   374  	// KubeletConfig specifies the kubelet configurations for nodes.
   375  	// Immutable.
   376  	// +optional
   377  	KubeletConfig *KubeletConfig `json:"kubeletConfig,omitempty"`
   378  
   379  	// KubeletDiskType specifies the kubelet disk type. Default to OS. Possible values include: 'OS', 'Temporary'.
   380  	// Requires Microsoft.ContainerService/KubeletDisk preview feature to be set.
   381  	// Immutable.
   382  	// See also [AKS doc].
   383  	//
   384  	// [AKS doc]: https://learn.microsoft.com/rest/api/aks/agent-pools/create-or-update?tabs=HTTP#kubeletdisktype
   385  	// +kubebuilder:validation:Enum=OS;Temporary
   386  	// +optional
   387  	KubeletDiskType *KubeletDiskType `json:"kubeletDiskType,omitempty"`
   388  
   389  	// LinuxOSConfig specifies the custom Linux OS settings and configurations.
   390  	// Immutable.
   391  	// +optional
   392  	LinuxOSConfig *LinuxOSConfig `json:"linuxOSConfig,omitempty"`
   393  
   394  	// SubnetName specifies the Subnet where the MachinePool will be placed
   395  	// Immutable.
   396  	// +optional
   397  	SubnetName *string `json:"subnetName,omitempty"`
   398  
   399  	// EnableFIPS indicates whether FIPS is enabled on the node pool.
   400  	// Immutable.
   401  	// +optional
   402  	EnableFIPS *bool `json:"enableFIPS,omitempty"`
   403  
   404  	// EnableEncryptionAtHost indicates whether host encryption is enabled on the node pool.
   405  	// Immutable.
   406  	// See also [AKS doc].
   407  	//
   408  	// [AKS doc]: https://learn.microsoft.com/en-us/azure/aks/enable-host-encryption
   409  	// +optional
   410  	EnableEncryptionAtHost *bool `json:"enableEncryptionAtHost,omitempty"`
   411  
   412  	// ASOManagedClustersAgentPoolPatches defines JSON merge patches to be applied to the generated ASO ManagedClustersAgentPool resource.
   413  	// WARNING: This is meant to be used sparingly to enable features for development and testing that are not
   414  	// otherwise represented in the CAPZ API. Misconfiguration that conflicts with CAPZ's normal mode of
   415  	// operation is possible.
   416  	// +optional
   417  	ASOManagedClustersAgentPoolPatches []string `json:"asoManagedClustersAgentPoolPatches,omitempty"`
   418  }
   419  
   420  // ManagedControlPlaneVirtualNetworkClassSpec defines the ManagedControlPlaneVirtualNetwork properties that may be shared across several managed control plane vnets.
   421  type ManagedControlPlaneVirtualNetworkClassSpec struct {
   422  	CIDRBlock string `json:"cidrBlock"`
   423  	// +optional
   424  	Subnet ManagedControlPlaneSubnet `json:"subnet,omitempty"`
   425  }
   426  
   427  // APIServerAccessProfileClassSpec defines the APIServerAccessProfile properties that may be shared across several API server access profiles.
   428  type APIServerAccessProfileClassSpec struct {
   429  	// EnablePrivateCluster indicates whether to create the cluster as a private cluster or not.
   430  	// +optional
   431  	EnablePrivateCluster *bool `json:"enablePrivateCluster,omitempty"`
   432  
   433  	// PrivateDNSZone enables private dns zone mode for private cluster.
   434  	// +optional
   435  	PrivateDNSZone *string `json:"privateDNSZone,omitempty"`
   436  
   437  	// EnablePrivateClusterPublicFQDN indicates whether to create additional public FQDN for private cluster or not.
   438  	// +optional
   439  	EnablePrivateClusterPublicFQDN *bool `json:"enablePrivateClusterPublicFQDN,omitempty"`
   440  }
   441  
   442  // ExtendedLocationSpec defines the ExtendedLocation properties to enable CAPZ for Azure public MEC.
   443  type ExtendedLocationSpec struct {
   444  	// Name defines the name for the extended location.
   445  	Name string `json:"name"`
   446  
   447  	// Type defines the type for the extended location.
   448  	// +kubebuilder:validation:Enum=EdgeZone
   449  	Type string `json:"type"`
   450  }
   451  
   452  // NetworkClassSpec defines the NetworkSpec properties that may be shared across several Azure clusters.
   453  type NetworkClassSpec struct {
   454  	// PrivateDNSZoneName defines the zone name for the Azure Private DNS.
   455  	// +optional
   456  	PrivateDNSZoneName string `json:"privateDNSZoneName,omitempty"`
   457  }
   458  
   459  // VnetClassSpec defines the VnetSpec properties that may be shared across several Azure clusters.
   460  type VnetClassSpec struct {
   461  	// CIDRBlocks defines the virtual network's address space, specified as one or more address prefixes in CIDR notation.
   462  	// +optional
   463  	CIDRBlocks []string `json:"cidrBlocks,omitempty"`
   464  
   465  	// Tags is a collection of tags describing the resource.
   466  	// +optional
   467  	Tags Tags `json:"tags,omitempty"`
   468  }
   469  
   470  // SubnetClassSpec defines the SubnetSpec properties that may be shared across several Azure clusters.
   471  type SubnetClassSpec struct {
   472  	// Name defines a name for the subnet resource.
   473  	Name string `json:"name"`
   474  
   475  	// Role defines the subnet role (eg. Node, ControlPlane)
   476  	// +kubebuilder:validation:Enum=node;control-plane;bastion;cluster
   477  	Role SubnetRole `json:"role"`
   478  
   479  	// CIDRBlocks defines the subnet's address space, specified as one or more address prefixes in CIDR notation.
   480  	// +optional
   481  	CIDRBlocks []string `json:"cidrBlocks,omitempty"`
   482  
   483  	// ServiceEndpoints is a slice of Virtual Network service endpoints to enable for the subnets.
   484  	// +optional
   485  	ServiceEndpoints ServiceEndpoints `json:"serviceEndpoints,omitempty"`
   486  
   487  	// PrivateEndpoints defines a list of private endpoints that should be attached to this subnet.
   488  	// +optional
   489  	PrivateEndpoints PrivateEndpoints `json:"privateEndpoints,omitempty"`
   490  }
   491  
   492  // LoadBalancerClassSpec defines the LoadBalancerSpec properties that may be shared across several Azure clusters.
   493  type LoadBalancerClassSpec struct {
   494  	// +optional
   495  	SKU SKU `json:"sku,omitempty"`
   496  	// +optional
   497  	Type LBType `json:"type,omitempty"`
   498  	// IdleTimeoutInMinutes specifies the timeout for the TCP idle connection.
   499  	// +optional
   500  	IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"`
   501  }
   502  
   503  // FleetsMemberClassSpec defines the FleetsMemberSpec properties that may be shared across several Azure clusters.
   504  type FleetsMemberClassSpec struct {
   505  	// Group is the group this member belongs to for multi-cluster update management.
   506  	// +optional
   507  	Group string `json:"group,omitempty"`
   508  
   509  	// ManagerName is the name of the fleet manager.
   510  	ManagerName string `json:"managerName"`
   511  
   512  	// ManagerResourceGroup is the resource group of the fleet manager.
   513  	ManagerResourceGroup string `json:"managerResourceGroup"`
   514  }
   515  
   516  // SecurityGroupClass defines the SecurityGroup properties that may be shared across several Azure clusters.
   517  type SecurityGroupClass struct {
   518  	// +optional
   519  	SecurityRules SecurityRules `json:"securityRules,omitempty"`
   520  	// +optional
   521  	Tags Tags `json:"tags,omitempty"`
   522  }
   523  
   524  // FrontendIPClass defines the FrontendIP properties that may be shared across several Azure clusters.
   525  type FrontendIPClass struct {
   526  	// +optional
   527  	PrivateIPAddress string `json:"privateIP,omitempty"`
   528  }
   529  
   530  // setDefaults sets default values for AzureClusterClassSpec.
   531  func (acc *AzureClusterClassSpec) setDefaults() {
   532  	if acc.AzureEnvironment == "" {
   533  		acc.AzureEnvironment = DefaultAzureCloud
   534  	}
   535  }
   536  
   537  // setDefaults sets default values for VnetClassSpec.
   538  func (vc *VnetClassSpec) setDefaults() {
   539  	if len(vc.CIDRBlocks) == 0 {
   540  		vc.CIDRBlocks = []string{DefaultVnetCIDR}
   541  	}
   542  }
   543  
   544  // setDefaults sets default values for SubnetClassSpec.
   545  func (sc *SubnetClassSpec) setDefaults(cidr string) {
   546  	if len(sc.CIDRBlocks) == 0 {
   547  		sc.CIDRBlocks = []string{cidr}
   548  	}
   549  }
   550  
   551  // setDefaults sets default values for SecurityGroupClass.
   552  func (sgc *SecurityGroupClass) setDefaults() {
   553  	for i := range sgc.SecurityRules {
   554  		if sgc.SecurityRules[i].Direction == "" {
   555  			sgc.SecurityRules[i].Direction = SecurityRuleDirectionInbound
   556  		}
   557  	}
   558  }