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