diff --git a/azure/scope/machinepool.go b/azure/scope/machinepool.go index 473912a0da5f..91b794f60872 100644 --- a/azure/scope/machinepool.go +++ b/azure/scope/machinepool.go @@ -314,7 +314,7 @@ func (m *MachinePoolScope) PatchObject(ctx context.Context) error { // AzureMachineTemplate gets the Azure machine template in this scope. func (m *MachinePoolScope) AzureMachineTemplate(ctx context.Context) (*infrav1.AzureMachineTemplate, error) { - ctx, span := tele.Tracer().Start(ctx, "scope.MachinePoolScope.AzureMachineTemplate") + ctx, span := tele.Tracer().Start(ctx, "scope.MachinePoolScope.AzureMachinePoolMachineTemplate") defer span.End() ref := m.MachinePool.Spec.Template.Spec.InfrastructureRef diff --git a/azure/scope/machinepool_test.go b/azure/scope/machinepool_test.go index 3c0cbcfb7e3a..7a0cd5b6f9e6 100644 --- a/azure/scope/machinepool_test.go +++ b/azure/scope/machinepool_test.go @@ -54,7 +54,7 @@ func TestMachinePoolScope_Name(t *testing.T) { Name: "machine-90123456", }, Spec: infrav1exp.AzureMachinePoolSpec{ - Template: infrav1exp.AzureMachineTemplate{ + Template: infrav1exp.AzureMachinePoolMachineTemplate{ OSDisk: infrav1.OSDisk{ OSType: "Windows", }, diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremachinepools.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremachinepools.yaml index 113f7f6e1776..24e7fca3acd0 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremachinepools.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremachinepools.yaml @@ -97,7 +97,7 @@ spec: description: RoleAssignmentName is the name of the role assignment to create for a system assigned identity. It can be any valid GUID. If not specified, a random GUID will be generated. type: string template: - description: Template contains the details used to build a replica virtual machine within the Machine Pool + description: Template contains the details used to build a replica virtual machine within the Machine Pool. properties: acceleratedNetworking: description: AcceleratedNetworking enables or disables Azure accelerated networking. If omitted, it will be set based on whether the requested VMSize supports accelerated networking. If AcceleratedNetworking is set to true with a VMSize that does not support it, Azure will return an error. diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremachinetemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremachinetemplates.yaml index 5b7e743a7de3..ba504acdcdf6 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremachinetemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_azuremachinetemplates.yaml @@ -276,193 +276,6 @@ spec: type: object served: true storage: false - - name: v1alpha3 - schema: - openAPIV3Schema: - description: AzureMachineTemplate defines the template for an AzureMachine. - properties: - acceleratedNetworking: - description: AcceleratedNetworking enables or disables Azure accelerated networking. If omitted, it will be set based on whether the requested VMSize supports accelerated networking. If AcceleratedNetworking is set to true with a VMSize that does not support it, Azure will return an error. - type: boolean - dataDisks: - description: DataDisks specifies the list of data disks to be created for a Virtual Machine - items: - description: DataDisk specifies the parameters that are used to add one or more data disks to the machine. - properties: - cachingType: - type: string - diskSizeGB: - description: DiskSizeGB is the size in GB to assign to the data disk. - format: int32 - type: integer - lun: - description: 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. The value must be between 0 and 63. - format: int32 - type: integer - managedDisk: - description: ManagedDisk defines the managed disk options for a VM. - properties: - diskEncryptionSet: - description: DiskEncryptionSetParameters defines disk encryption options. - properties: - id: - description: ID defines resourceID for diskEncryptionSet resource. It must be in the same subscription - type: string - type: object - storageAccountType: - type: string - required: - - storageAccountType - type: object - nameSuffix: - description: NameSuffix is the suffix to be appended to the machine name to generate the disk name. Each disk name will be in format _. - type: string - required: - - diskSizeGB - - nameSuffix - type: object - type: array - image: - description: Image is used to provide details of an image to use during Virtual Machine creation. If image details are omitted the image will default the Azure Marketplace "capi" offer, which is based on Ubuntu. - properties: - id: - description: ID specifies an image to use by ID - type: string - marketplace: - description: Marketplace specifies an image to use from the Azure Marketplace - properties: - offer: - description: Offer specifies the name of a group of related images created by the publisher. For example, UbuntuServer, WindowsServer - minLength: 1 - type: string - publisher: - description: Publisher is the name of the organization that created the image - minLength: 1 - type: string - sku: - description: SKU specifies an instance of an offer, such as a major release of a distribution. For example, 18.04-LTS, 2019-Datacenter - minLength: 1 - type: string - thirdPartyImage: - default: false - description: ThirdPartyImage indicates the image is published by a third party publisher and a Plan will be generated for it. - type: boolean - version: - description: Version specifies the version of an image sku. The allowed formats are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. Specify 'latest' to use the latest version of an image available at deploy time. Even if you use 'latest', the VM image will not automatically update after deploy time even if a new version becomes available. - minLength: 1 - type: string - required: - - offer - - publisher - - sku - - version - type: object - sharedGallery: - description: SharedGallery specifies an image to use from an Azure Shared Image Gallery - properties: - gallery: - description: Gallery specifies the name of the shared image gallery that contains the image - minLength: 1 - type: string - name: - description: Name is the name of the image - minLength: 1 - type: string - resourceGroup: - description: ResourceGroup specifies the resource group containing the shared image gallery - minLength: 1 - type: string - subscriptionID: - description: SubscriptionID is the identifier of the subscription that contains the shared image gallery - minLength: 1 - type: string - version: - description: Version specifies the version of the marketplace image. The allowed formats are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. Specify 'latest' to use the latest version of an image available at deploy time. Even if you use 'latest', the VM image will not automatically update after deploy time even if a new version becomes available. - minLength: 1 - type: string - required: - - gallery - - name - - resourceGroup - - subscriptionID - - version - type: object - type: object - osDisk: - description: OSDisk contains the operating system disk information for a Virtual Machine - properties: - cachingType: - type: string - diffDiskSettings: - description: DiffDiskSettings describe ephemeral disk settings for the os disk. - properties: - option: - description: Option enables ephemeral OS when set to "Local" See https://docs.microsoft.com/en-us/azure/virtual-machines/ephemeral-os-disks for full details - enum: - - Local - type: string - required: - - option - type: object - diskSizeGB: - format: int32 - type: integer - managedDisk: - description: ManagedDisk defines the managed disk options for a VM. - properties: - diskEncryptionSet: - description: DiskEncryptionSetParameters defines disk encryption options. - properties: - id: - description: ID defines resourceID for diskEncryptionSet resource. It must be in the same subscription - type: string - type: object - storageAccountType: - type: string - required: - - storageAccountType - type: object - osType: - type: string - required: - - diskSizeGB - - managedDisk - - osType - type: object - securityProfile: - description: SecurityProfile specifies the Security profile settings for a virtual machine. - properties: - encryptionAtHost: - description: This field indicates whether Host Encryption should be enabled or disabled for a virtual machine or virtual machine scale set. Default is disabled. - type: boolean - type: object - spotVMOptions: - description: SpotVMOptions allows the ability to specify the Machine should use a Spot VM - properties: - maxPrice: - anyOf: - - type: integer - - type: string - description: MaxPrice defines the maximum price the user is willing to pay for Spot VM instances - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - sshPublicKey: - description: SSHPublicKey is the SSH public key string base64 encoded to add to a Virtual Machine - type: string - terminateNotificationTimeout: - description: TerminateNotificationTimeout enables or disables VMSS scheduled events termination notification with specified timeout allowed values are between 5 and 15 (mins) - type: integer - vmSize: - description: VMSize is the size of the Virtual Machine to build. See https://docs.microsoft.com/en-us/rest/api/compute/virtualmachines/createorupdate#virtualmachinesizetypes - type: string - required: - - vmSize - - osDisk - - sshPublicKey - type: object - served: true - storage: false - name: v1alpha4 schema: openAPIV3Schema: @@ -714,198 +527,6 @@ spec: type: object served: true storage: true - - name: v1alpha4 - schema: - openAPIV3Schema: - description: AzureMachineTemplate defines the template for an AzureMachine. - properties: - acceleratedNetworking: - description: AcceleratedNetworking enables or disables Azure accelerated networking. If omitted, it will be set based on whether the requested VMSize supports accelerated networking. If AcceleratedNetworking is set to true with a VMSize that does not support it, Azure will return an error. - type: boolean - dataDisks: - description: DataDisks specifies the list of data disks to be created for a Virtual Machine - items: - description: DataDisk specifies the parameters that are used to add one or more data disks to the machine. - properties: - cachingType: - description: CachingType specifies the caching requirements. - enum: - - None - - ReadOnly - - ReadWrite - type: string - diskSizeGB: - description: DiskSizeGB is the size in GB to assign to the data disk. - format: int32 - type: integer - lun: - description: 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. The value must be between 0 and 63. - format: int32 - type: integer - managedDisk: - description: ManagedDisk specifies the Managed Disk parameters for the data disk. - properties: - diskEncryptionSet: - description: DiskEncryptionSetParameters defines disk encryption options. - properties: - id: - description: ID defines resourceID for diskEncryptionSet resource. It must be in the same subscription - type: string - type: object - storageAccountType: - type: string - type: object - nameSuffix: - description: NameSuffix is the suffix to be appended to the machine name to generate the disk name. Each disk name will be in format _. - type: string - required: - - diskSizeGB - - nameSuffix - type: object - type: array - image: - description: Image is used to provide details of an image to use during Virtual Machine creation. If image details are omitted the image will default the Azure Marketplace "capi" offer, which is based on Ubuntu. - properties: - id: - description: ID specifies an image to use by ID - type: string - marketplace: - description: Marketplace specifies an image to use from the Azure Marketplace - properties: - offer: - description: Offer specifies the name of a group of related images created by the publisher. For example, UbuntuServer, WindowsServer - minLength: 1 - type: string - publisher: - description: Publisher is the name of the organization that created the image - minLength: 1 - type: string - sku: - description: SKU specifies an instance of an offer, such as a major release of a distribution. For example, 18.04-LTS, 2019-Datacenter - minLength: 1 - type: string - thirdPartyImage: - default: false - description: ThirdPartyImage indicates the image is published by a third party publisher and a Plan will be generated for it. - type: boolean - version: - description: Version specifies the version of an image sku. The allowed formats are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. Specify 'latest' to use the latest version of an image available at deploy time. Even if you use 'latest', the VM image will not automatically update after deploy time even if a new version becomes available. - minLength: 1 - type: string - required: - - offer - - publisher - - sku - - version - type: object - sharedGallery: - description: SharedGallery specifies an image to use from an Azure Shared Image Gallery - properties: - gallery: - description: Gallery specifies the name of the shared image gallery that contains the image - minLength: 1 - type: string - name: - description: Name is the name of the image - minLength: 1 - type: string - resourceGroup: - description: ResourceGroup specifies the resource group containing the shared image gallery - minLength: 1 - type: string - subscriptionID: - description: SubscriptionID is the identifier of the subscription that contains the shared image gallery - minLength: 1 - type: string - version: - description: Version specifies the version of the marketplace image. The allowed formats are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. Specify 'latest' to use the latest version of an image available at deploy time. Even if you use 'latest', the VM image will not automatically update after deploy time even if a new version becomes available. - minLength: 1 - type: string - required: - - gallery - - name - - resourceGroup - - subscriptionID - - version - type: object - type: object - osDisk: - description: OSDisk contains the operating system disk information for a Virtual Machine - properties: - cachingType: - description: CachingType specifies the caching requirements. - enum: - - None - - ReadOnly - - ReadWrite - type: string - diffDiskSettings: - description: DiffDiskSettings describe ephemeral disk settings for the os disk. - properties: - option: - description: Option enables ephemeral OS when set to "Local" See https://docs.microsoft.com/en-us/azure/virtual-machines/ephemeral-os-disks for full details - enum: - - Local - type: string - required: - - option - type: object - diskSizeGB: - format: int32 - type: integer - managedDisk: - description: ManagedDisk specifies the Managed Disk parameters for the OS disk. - properties: - diskEncryptionSet: - description: DiskEncryptionSetParameters defines disk encryption options. - properties: - id: - description: ID defines resourceID for diskEncryptionSet resource. It must be in the same subscription - type: string - type: object - storageAccountType: - type: string - type: object - osType: - type: string - required: - - diskSizeGB - - osType - type: object - securityProfile: - description: SecurityProfile specifies the Security profile settings for a virtual machine. - properties: - encryptionAtHost: - description: This field indicates whether Host Encryption should be enabled or disabled for a virtual machine or virtual machine scale set. Default is disabled. - type: boolean - type: object - spotVMOptions: - description: SpotVMOptions allows the ability to specify the Machine should use a Spot VM - properties: - maxPrice: - anyOf: - - type: integer - - type: string - description: MaxPrice defines the maximum price the user is willing to pay for Spot VM instances - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - sshPublicKey: - description: SSHPublicKey is the SSH public key string base64 encoded to add to a Virtual Machine - type: string - terminateNotificationTimeout: - description: TerminateNotificationTimeout enables or disables VMSS scheduled events termination notification with specified timeout allowed values are between 5 and 15 (mins) - type: integer - vmSize: - description: VMSize is the size of the Virtual Machine to build. See https://docs.microsoft.com/en-us/rest/api/compute/virtualmachines/createorupdate#virtualmachinesizetypes - type: string - required: - - vmSize - - osDisk - - sshPublicKey - type: object - served: true - storage: false status: acceptedNames: kind: "" diff --git a/exp/api/v1alpha3/azuremachinepool_types.go b/exp/api/v1alpha3/azuremachinepool_types.go index 51c21350af68..19252883dd29 100644 --- a/exp/api/v1alpha3/azuremachinepool_types.go +++ b/exp/api/v1alpha3/azuremachinepool_types.go @@ -25,8 +25,8 @@ import ( ) type ( - // AzureMachineTemplate defines the template for an AzureMachine. - AzureMachineTemplate struct { + // AzureMachinePoolMachineTemplate defines the template for an AzureMachinePool machine. + AzureMachinePoolMachineTemplate struct { // VMSize is the size of the Virtual Machine to build. // See https://docs.microsoft.com/en-us/rest/api/compute/virtualmachines/createorupdate#virtualmachinesizetypes VMSize string `json:"vmSize"` @@ -73,8 +73,8 @@ type ( // Location is the Azure region location e.g. westus2 Location string `json:"location"` - // Template contains the details used to build a replica virtual machine within the Machine Pool - Template AzureMachineTemplate `json:"template"` + // Template contains the details used to build a replica virtual machine within the Machine Pool. + Template AzureMachinePoolMachineTemplate `json:"template"` // AdditionalTags is an optional set of tags to add to an instance, in addition to the ones added by default by the // Azure provider. If both the AzureCluster and the AzureMachine specify the same tag name with different values, the diff --git a/exp/api/v1alpha3/zz_generated.conversion.go b/exp/api/v1alpha3/zz_generated.conversion.go index 5795209fa6a4..22968e981733 100644 --- a/exp/api/v1alpha3/zz_generated.conversion.go +++ b/exp/api/v1alpha3/zz_generated.conversion.go @@ -70,6 +70,16 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddGeneratedConversionFunc((*AzureMachinePoolMachineTemplate)(nil), (*v1alpha4.AzureMachinePoolMachineTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_AzureMachinePoolMachineTemplate_To_v1alpha4_AzureMachinePoolMachineTemplate(a.(*AzureMachinePoolMachineTemplate), b.(*v1alpha4.AzureMachinePoolMachineTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.AzureMachinePoolMachineTemplate)(nil), (*AzureMachinePoolMachineTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_AzureMachinePoolMachineTemplate_To_v1alpha3_AzureMachinePoolMachineTemplate(a.(*v1alpha4.AzureMachinePoolMachineTemplate), b.(*AzureMachinePoolMachineTemplate), scope) + }); err != nil { + return err + } if err := s.AddGeneratedConversionFunc((*AzureMachinePoolSpec)(nil), (*v1alpha4.AzureMachinePoolSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha3_AzureMachinePoolSpec_To_v1alpha4_AzureMachinePoolSpec(a.(*AzureMachinePoolSpec), b.(*v1alpha4.AzureMachinePoolSpec), scope) }); err != nil { @@ -90,16 +100,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*AzureMachineTemplate)(nil), (*v1alpha4.AzureMachineTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_AzureMachineTemplate_To_v1alpha4_AzureMachineTemplate(a.(*AzureMachineTemplate), b.(*v1alpha4.AzureMachineTemplate), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha4.AzureMachineTemplate)(nil), (*AzureMachineTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_AzureMachineTemplate_To_v1alpha3_AzureMachineTemplate(a.(*v1alpha4.AzureMachineTemplate), b.(*AzureMachineTemplate), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*AzureManagedCluster)(nil), (*v1alpha4.AzureManagedCluster)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha3_AzureManagedCluster_To_v1alpha4_AzureManagedCluster(a.(*AzureManagedCluster), b.(*v1alpha4.AzureManagedCluster), scope) }); err != nil { @@ -397,9 +397,65 @@ func Convert_v1alpha4_AzureMachinePoolList_To_v1alpha3_AzureMachinePoolList(in * return autoConvert_v1alpha4_AzureMachinePoolList_To_v1alpha3_AzureMachinePoolList(in, out, s) } +func autoConvert_v1alpha3_AzureMachinePoolMachineTemplate_To_v1alpha4_AzureMachinePoolMachineTemplate(in *AzureMachinePoolMachineTemplate, out *v1alpha4.AzureMachinePoolMachineTemplate, s conversion.Scope) error { + out.VMSize = in.VMSize + if in.Image != nil { + in, out := &in.Image, &out.Image + *out = new(clusterapiproviderazureapiv1alpha4.Image) + if err := Convert_v1alpha3_Image_To_v1alpha4_Image(*in, *out, s); err != nil { + return err + } + } else { + out.Image = nil + } + if err := Convert_v1alpha3_OSDisk_To_v1alpha4_OSDisk(&in.OSDisk, &out.OSDisk, s); err != nil { + return err + } + out.DataDisks = *(*[]clusterapiproviderazureapiv1alpha4.DataDisk)(unsafe.Pointer(&in.DataDisks)) + out.SSHPublicKey = in.SSHPublicKey + out.AcceleratedNetworking = (*bool)(unsafe.Pointer(in.AcceleratedNetworking)) + out.TerminateNotificationTimeout = (*int)(unsafe.Pointer(in.TerminateNotificationTimeout)) + out.SecurityProfile = (*clusterapiproviderazureapiv1alpha4.SecurityProfile)(unsafe.Pointer(in.SecurityProfile)) + out.SpotVMOptions = (*clusterapiproviderazureapiv1alpha4.SpotVMOptions)(unsafe.Pointer(in.SpotVMOptions)) + return nil +} + +// Convert_v1alpha3_AzureMachinePoolMachineTemplate_To_v1alpha4_AzureMachinePoolMachineTemplate is an autogenerated conversion function. +func Convert_v1alpha3_AzureMachinePoolMachineTemplate_To_v1alpha4_AzureMachinePoolMachineTemplate(in *AzureMachinePoolMachineTemplate, out *v1alpha4.AzureMachinePoolMachineTemplate, s conversion.Scope) error { + return autoConvert_v1alpha3_AzureMachinePoolMachineTemplate_To_v1alpha4_AzureMachinePoolMachineTemplate(in, out, s) +} + +func autoConvert_v1alpha4_AzureMachinePoolMachineTemplate_To_v1alpha3_AzureMachinePoolMachineTemplate(in *v1alpha4.AzureMachinePoolMachineTemplate, out *AzureMachinePoolMachineTemplate, s conversion.Scope) error { + out.VMSize = in.VMSize + if in.Image != nil { + in, out := &in.Image, &out.Image + *out = new(clusterapiproviderazureapiv1alpha3.Image) + if err := Convert_v1alpha4_Image_To_v1alpha3_Image(*in, *out, s); err != nil { + return err + } + } else { + out.Image = nil + } + if err := Convert_v1alpha4_OSDisk_To_v1alpha3_OSDisk(&in.OSDisk, &out.OSDisk, s); err != nil { + return err + } + out.DataDisks = *(*[]clusterapiproviderazureapiv1alpha3.DataDisk)(unsafe.Pointer(&in.DataDisks)) + out.SSHPublicKey = in.SSHPublicKey + out.AcceleratedNetworking = (*bool)(unsafe.Pointer(in.AcceleratedNetworking)) + out.TerminateNotificationTimeout = (*int)(unsafe.Pointer(in.TerminateNotificationTimeout)) + out.SecurityProfile = (*clusterapiproviderazureapiv1alpha3.SecurityProfile)(unsafe.Pointer(in.SecurityProfile)) + out.SpotVMOptions = (*clusterapiproviderazureapiv1alpha3.SpotVMOptions)(unsafe.Pointer(in.SpotVMOptions)) + return nil +} + +// Convert_v1alpha4_AzureMachinePoolMachineTemplate_To_v1alpha3_AzureMachinePoolMachineTemplate is an autogenerated conversion function. +func Convert_v1alpha4_AzureMachinePoolMachineTemplate_To_v1alpha3_AzureMachinePoolMachineTemplate(in *v1alpha4.AzureMachinePoolMachineTemplate, out *AzureMachinePoolMachineTemplate, s conversion.Scope) error { + return autoConvert_v1alpha4_AzureMachinePoolMachineTemplate_To_v1alpha3_AzureMachinePoolMachineTemplate(in, out, s) +} + func autoConvert_v1alpha3_AzureMachinePoolSpec_To_v1alpha4_AzureMachinePoolSpec(in *AzureMachinePoolSpec, out *v1alpha4.AzureMachinePoolSpec, s conversion.Scope) error { out.Location = in.Location - if err := Convert_v1alpha3_AzureMachineTemplate_To_v1alpha4_AzureMachineTemplate(&in.Template, &out.Template, s); err != nil { + if err := Convert_v1alpha3_AzureMachinePoolMachineTemplate_To_v1alpha4_AzureMachinePoolMachineTemplate(&in.Template, &out.Template, s); err != nil { return err } out.AdditionalTags = *(*clusterapiproviderazureapiv1alpha4.Tags)(unsafe.Pointer(&in.AdditionalTags)) @@ -418,7 +474,7 @@ func Convert_v1alpha3_AzureMachinePoolSpec_To_v1alpha4_AzureMachinePoolSpec(in * func autoConvert_v1alpha4_AzureMachinePoolSpec_To_v1alpha3_AzureMachinePoolSpec(in *v1alpha4.AzureMachinePoolSpec, out *AzureMachinePoolSpec, s conversion.Scope) error { out.Location = in.Location - if err := Convert_v1alpha4_AzureMachineTemplate_To_v1alpha3_AzureMachineTemplate(&in.Template, &out.Template, s); err != nil { + if err := Convert_v1alpha4_AzureMachinePoolMachineTemplate_To_v1alpha3_AzureMachinePoolMachineTemplate(&in.Template, &out.Template, s); err != nil { return err } out.AdditionalTags = *(*clusterapiproviderazureapiv1alpha3.Tags)(unsafe.Pointer(&in.AdditionalTags)) @@ -471,62 +527,6 @@ func Convert_v1alpha4_AzureMachinePoolStatus_To_v1alpha3_AzureMachinePoolStatus( return autoConvert_v1alpha4_AzureMachinePoolStatus_To_v1alpha3_AzureMachinePoolStatus(in, out, s) } -func autoConvert_v1alpha3_AzureMachineTemplate_To_v1alpha4_AzureMachineTemplate(in *AzureMachineTemplate, out *v1alpha4.AzureMachineTemplate, s conversion.Scope) error { - out.VMSize = in.VMSize - if in.Image != nil { - in, out := &in.Image, &out.Image - *out = new(clusterapiproviderazureapiv1alpha4.Image) - if err := Convert_v1alpha3_Image_To_v1alpha4_Image(*in, *out, s); err != nil { - return err - } - } else { - out.Image = nil - } - if err := Convert_v1alpha3_OSDisk_To_v1alpha4_OSDisk(&in.OSDisk, &out.OSDisk, s); err != nil { - return err - } - out.DataDisks = *(*[]clusterapiproviderazureapiv1alpha4.DataDisk)(unsafe.Pointer(&in.DataDisks)) - out.SSHPublicKey = in.SSHPublicKey - out.AcceleratedNetworking = (*bool)(unsafe.Pointer(in.AcceleratedNetworking)) - out.TerminateNotificationTimeout = (*int)(unsafe.Pointer(in.TerminateNotificationTimeout)) - out.SecurityProfile = (*clusterapiproviderazureapiv1alpha4.SecurityProfile)(unsafe.Pointer(in.SecurityProfile)) - out.SpotVMOptions = (*clusterapiproviderazureapiv1alpha4.SpotVMOptions)(unsafe.Pointer(in.SpotVMOptions)) - return nil -} - -// Convert_v1alpha3_AzureMachineTemplate_To_v1alpha4_AzureMachineTemplate is an autogenerated conversion function. -func Convert_v1alpha3_AzureMachineTemplate_To_v1alpha4_AzureMachineTemplate(in *AzureMachineTemplate, out *v1alpha4.AzureMachineTemplate, s conversion.Scope) error { - return autoConvert_v1alpha3_AzureMachineTemplate_To_v1alpha4_AzureMachineTemplate(in, out, s) -} - -func autoConvert_v1alpha4_AzureMachineTemplate_To_v1alpha3_AzureMachineTemplate(in *v1alpha4.AzureMachineTemplate, out *AzureMachineTemplate, s conversion.Scope) error { - out.VMSize = in.VMSize - if in.Image != nil { - in, out := &in.Image, &out.Image - *out = new(clusterapiproviderazureapiv1alpha3.Image) - if err := Convert_v1alpha4_Image_To_v1alpha3_Image(*in, *out, s); err != nil { - return err - } - } else { - out.Image = nil - } - if err := Convert_v1alpha4_OSDisk_To_v1alpha3_OSDisk(&in.OSDisk, &out.OSDisk, s); err != nil { - return err - } - out.DataDisks = *(*[]clusterapiproviderazureapiv1alpha3.DataDisk)(unsafe.Pointer(&in.DataDisks)) - out.SSHPublicKey = in.SSHPublicKey - out.AcceleratedNetworking = (*bool)(unsafe.Pointer(in.AcceleratedNetworking)) - out.TerminateNotificationTimeout = (*int)(unsafe.Pointer(in.TerminateNotificationTimeout)) - out.SecurityProfile = (*clusterapiproviderazureapiv1alpha3.SecurityProfile)(unsafe.Pointer(in.SecurityProfile)) - out.SpotVMOptions = (*clusterapiproviderazureapiv1alpha3.SpotVMOptions)(unsafe.Pointer(in.SpotVMOptions)) - return nil -} - -// Convert_v1alpha4_AzureMachineTemplate_To_v1alpha3_AzureMachineTemplate is an autogenerated conversion function. -func Convert_v1alpha4_AzureMachineTemplate_To_v1alpha3_AzureMachineTemplate(in *v1alpha4.AzureMachineTemplate, out *AzureMachineTemplate, s conversion.Scope) error { - return autoConvert_v1alpha4_AzureMachineTemplate_To_v1alpha3_AzureMachineTemplate(in, out, s) -} - func autoConvert_v1alpha3_AzureManagedCluster_To_v1alpha4_AzureManagedCluster(in *AzureManagedCluster, out *v1alpha4.AzureManagedCluster, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta if err := Convert_v1alpha3_AzureManagedClusterSpec_To_v1alpha4_AzureManagedClusterSpec(&in.Spec, &out.Spec, s); err != nil { diff --git a/exp/api/v1alpha3/zz_generated.deepcopy.go b/exp/api/v1alpha3/zz_generated.deepcopy.go index c356dcc923ef..eab9528b9b64 100644 --- a/exp/api/v1alpha3/zz_generated.deepcopy.go +++ b/exp/api/v1alpha3/zz_generated.deepcopy.go @@ -106,6 +106,54 @@ func (in *AzureMachinePoolList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzureMachinePoolMachineTemplate) DeepCopyInto(out *AzureMachinePoolMachineTemplate) { + *out = *in + if in.Image != nil { + in, out := &in.Image, &out.Image + *out = new(apiv1alpha3.Image) + (*in).DeepCopyInto(*out) + } + in.OSDisk.DeepCopyInto(&out.OSDisk) + if in.DataDisks != nil { + in, out := &in.DataDisks, &out.DataDisks + *out = make([]apiv1alpha3.DataDisk, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.AcceleratedNetworking != nil { + in, out := &in.AcceleratedNetworking, &out.AcceleratedNetworking + *out = new(bool) + **out = **in + } + if in.TerminateNotificationTimeout != nil { + in, out := &in.TerminateNotificationTimeout, &out.TerminateNotificationTimeout + *out = new(int) + **out = **in + } + if in.SecurityProfile != nil { + in, out := &in.SecurityProfile, &out.SecurityProfile + *out = new(apiv1alpha3.SecurityProfile) + (*in).DeepCopyInto(*out) + } + if in.SpotVMOptions != nil { + in, out := &in.SpotVMOptions, &out.SpotVMOptions + *out = new(apiv1alpha3.SpotVMOptions) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachinePoolMachineTemplate. +func (in *AzureMachinePoolMachineTemplate) DeepCopy() *AzureMachinePoolMachineTemplate { + if in == nil { + return nil + } + out := new(AzureMachinePoolMachineTemplate) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AzureMachinePoolSpec) DeepCopyInto(out *AzureMachinePoolSpec) { *out = *in @@ -192,54 +240,6 @@ func (in *AzureMachinePoolStatus) DeepCopy() *AzureMachinePoolStatus { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachineTemplate) DeepCopyInto(out *AzureMachineTemplate) { - *out = *in - if in.Image != nil { - in, out := &in.Image, &out.Image - *out = new(apiv1alpha3.Image) - (*in).DeepCopyInto(*out) - } - in.OSDisk.DeepCopyInto(&out.OSDisk) - if in.DataDisks != nil { - in, out := &in.DataDisks, &out.DataDisks - *out = make([]apiv1alpha3.DataDisk, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.AcceleratedNetworking != nil { - in, out := &in.AcceleratedNetworking, &out.AcceleratedNetworking - *out = new(bool) - **out = **in - } - if in.TerminateNotificationTimeout != nil { - in, out := &in.TerminateNotificationTimeout, &out.TerminateNotificationTimeout - *out = new(int) - **out = **in - } - if in.SecurityProfile != nil { - in, out := &in.SecurityProfile, &out.SecurityProfile - *out = new(apiv1alpha3.SecurityProfile) - (*in).DeepCopyInto(*out) - } - if in.SpotVMOptions != nil { - in, out := &in.SpotVMOptions, &out.SpotVMOptions - *out = new(apiv1alpha3.SpotVMOptions) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachineTemplate. -func (in *AzureMachineTemplate) DeepCopy() *AzureMachineTemplate { - if in == nil { - return nil - } - out := new(AzureMachineTemplate) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AzureManagedCluster) DeepCopyInto(out *AzureManagedCluster) { *out = *in diff --git a/exp/api/v1alpha4/azuremachinepool_default_test.go b/exp/api/v1alpha4/azuremachinepool_default_test.go index 515a19316e50..2ff2ef4271aa 100644 --- a/exp/api/v1alpha4/azuremachinepool_default_test.go +++ b/exp/api/v1alpha4/azuremachinepool_default_test.go @@ -84,7 +84,7 @@ func createMachinePoolWithSSHPublicKey(t *testing.T, sshPublicKey string) *Azure func hardcodedAzureMachinePoolWithSSHKey(sshPublicKey string) *AzureMachinePool { return &AzureMachinePool{ Spec: AzureMachinePoolSpec{ - Template: AzureMachineTemplate{ + Template: AzureMachinePoolMachineTemplate{ SSHPublicKey: sshPublicKey, }, }, diff --git a/exp/api/v1alpha4/azuremachinepool_test.go b/exp/api/v1alpha4/azuremachinepool_test.go index 6969a9b73388..df6bce85b7c6 100644 --- a/exp/api/v1alpha4/azuremachinepool_test.go +++ b/exp/api/v1alpha4/azuremachinepool_test.go @@ -46,7 +46,7 @@ func TestAzureMachinePool_Validate(t *testing.T) { Factory: func(_ *gomega.GomegaWithT) *exp.AzureMachinePool { return &exp.AzureMachinePool{ Spec: exp.AzureMachinePoolSpec{ - Template: exp.AzureMachineTemplate{ + Template: exp.AzureMachinePoolMachineTemplate{ Image: &infrav1.Image{ SharedGallery: &infrav1.AzureSharedGalleryImage{ SubscriptionID: "foo", @@ -69,7 +69,7 @@ func TestAzureMachinePool_Validate(t *testing.T) { Factory: func(_ *gomega.GomegaWithT) *exp.AzureMachinePool { return &exp.AzureMachinePool{ Spec: exp.AzureMachinePoolSpec{ - Template: exp.AzureMachineTemplate{ + Template: exp.AzureMachinePoolMachineTemplate{ Image: new(infrav1.Image), }, }, @@ -85,7 +85,7 @@ func TestAzureMachinePool_Validate(t *testing.T) { Factory: func(_ *gomega.GomegaWithT) *exp.AzureMachinePool { return &exp.AzureMachinePool{ Spec: exp.AzureMachinePoolSpec{ - Template: exp.AzureMachineTemplate{ + Template: exp.AzureMachinePoolMachineTemplate{ TerminateNotificationTimeout: to.IntPtr(7), }, }, @@ -100,7 +100,7 @@ func TestAzureMachinePool_Validate(t *testing.T) { Factory: func(_ *gomega.GomegaWithT) *exp.AzureMachinePool { return &exp.AzureMachinePool{ Spec: exp.AzureMachinePoolSpec{ - Template: exp.AzureMachineTemplate{ + Template: exp.AzureMachinePoolMachineTemplate{ TerminateNotificationTimeout: to.IntPtr(20), }, }, @@ -116,7 +116,7 @@ func TestAzureMachinePool_Validate(t *testing.T) { Factory: func(_ *gomega.GomegaWithT) *exp.AzureMachinePool { return &exp.AzureMachinePool{ Spec: exp.AzureMachinePoolSpec{ - Template: exp.AzureMachineTemplate{ + Template: exp.AzureMachinePoolMachineTemplate{ TerminateNotificationTimeout: to.IntPtr(3), }, }, diff --git a/exp/api/v1alpha4/azuremachinepool_types.go b/exp/api/v1alpha4/azuremachinepool_types.go index 6c81a1aabdb4..42ca42359711 100644 --- a/exp/api/v1alpha4/azuremachinepool_types.go +++ b/exp/api/v1alpha4/azuremachinepool_types.go @@ -25,8 +25,8 @@ import ( ) type ( - // AzureMachineTemplate defines the template for an AzureMachine. - AzureMachineTemplate struct { + // AzureMachinePoolMachineTemplate defines the template for an AzureMachine. + AzureMachinePoolMachineTemplate struct { // VMSize is the size of the Virtual Machine to build. // See https://docs.microsoft.com/en-us/rest/api/compute/virtualmachines/createorupdate#virtualmachinesizetypes VMSize string `json:"vmSize"` @@ -74,7 +74,7 @@ type ( Location string `json:"location"` // Template contains the details used to build a replica virtual machine within the Machine Pool - Template AzureMachineTemplate `json:"template"` + Template AzureMachinePoolMachineTemplate `json:"template"` // AdditionalTags is an optional set of tags to add to an instance, in addition to the ones added by default by the // Azure provider. If both the AzureCluster and the AzureMachine specify the same tag name with different values, the diff --git a/exp/api/v1alpha4/azuremachinepool_webhook_test.go b/exp/api/v1alpha4/azuremachinepool_webhook_test.go index 49725241973f..98a62842b135 100644 --- a/exp/api/v1alpha4/azuremachinepool_webhook_test.go +++ b/exp/api/v1alpha4/azuremachinepool_webhook_test.go @@ -197,7 +197,7 @@ func createMachinePoolWithtMarketPlaceImage(t *testing.T, publisher, offer, sku, return &AzureMachinePool{ Spec: AzureMachinePoolSpec{ - Template: AzureMachineTemplate{ + Template: AzureMachinePoolMachineTemplate{ Image: image, SSHPublicKey: validSSHPublicKey, TerminateNotificationTimeout: terminateNotificationTimeout, @@ -219,7 +219,7 @@ func createMachinePoolWithSharedImage(t *testing.T, subscriptionID, resourceGrou return &AzureMachinePool{ Spec: AzureMachinePoolSpec{ - Template: AzureMachineTemplate{ + Template: AzureMachinePoolMachineTemplate{ Image: image, SSHPublicKey: validSSHPublicKey, TerminateNotificationTimeout: terminateNotificationTimeout, @@ -235,7 +235,7 @@ func createMachinePoolWithImageByID(t *testing.T, imageID string, terminateNotif return &AzureMachinePool{ Spec: AzureMachinePoolSpec{ - Template: AzureMachineTemplate{ + Template: AzureMachinePoolMachineTemplate{ Image: image, SSHPublicKey: validSSHPublicKey, TerminateNotificationTimeout: terminateNotificationTimeout, diff --git a/exp/api/v1alpha4/zz_generated.deepcopy.go b/exp/api/v1alpha4/zz_generated.deepcopy.go index c54a3c368c44..46b484d592c6 100644 --- a/exp/api/v1alpha4/zz_generated.deepcopy.go +++ b/exp/api/v1alpha4/zz_generated.deepcopy.go @@ -106,6 +106,54 @@ func (in *AzureMachinePoolList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzureMachinePoolMachineTemplate) DeepCopyInto(out *AzureMachinePoolMachineTemplate) { + *out = *in + if in.Image != nil { + in, out := &in.Image, &out.Image + *out = new(apiv1alpha4.Image) + (*in).DeepCopyInto(*out) + } + in.OSDisk.DeepCopyInto(&out.OSDisk) + if in.DataDisks != nil { + in, out := &in.DataDisks, &out.DataDisks + *out = make([]apiv1alpha4.DataDisk, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.AcceleratedNetworking != nil { + in, out := &in.AcceleratedNetworking, &out.AcceleratedNetworking + *out = new(bool) + **out = **in + } + if in.TerminateNotificationTimeout != nil { + in, out := &in.TerminateNotificationTimeout, &out.TerminateNotificationTimeout + *out = new(int) + **out = **in + } + if in.SecurityProfile != nil { + in, out := &in.SecurityProfile, &out.SecurityProfile + *out = new(apiv1alpha4.SecurityProfile) + (*in).DeepCopyInto(*out) + } + if in.SpotVMOptions != nil { + in, out := &in.SpotVMOptions, &out.SpotVMOptions + *out = new(apiv1alpha4.SpotVMOptions) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachinePoolMachineTemplate. +func (in *AzureMachinePoolMachineTemplate) DeepCopy() *AzureMachinePoolMachineTemplate { + if in == nil { + return nil + } + out := new(AzureMachinePoolMachineTemplate) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AzureMachinePoolSpec) DeepCopyInto(out *AzureMachinePoolSpec) { *out = *in @@ -192,54 +240,6 @@ func (in *AzureMachinePoolStatus) DeepCopy() *AzureMachinePoolStatus { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AzureMachineTemplate) DeepCopyInto(out *AzureMachineTemplate) { - *out = *in - if in.Image != nil { - in, out := &in.Image, &out.Image - *out = new(apiv1alpha4.Image) - (*in).DeepCopyInto(*out) - } - in.OSDisk.DeepCopyInto(&out.OSDisk) - if in.DataDisks != nil { - in, out := &in.DataDisks, &out.DataDisks - *out = make([]apiv1alpha4.DataDisk, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.AcceleratedNetworking != nil { - in, out := &in.AcceleratedNetworking, &out.AcceleratedNetworking - *out = new(bool) - **out = **in - } - if in.TerminateNotificationTimeout != nil { - in, out := &in.TerminateNotificationTimeout, &out.TerminateNotificationTimeout - *out = new(int) - **out = **in - } - if in.SecurityProfile != nil { - in, out := &in.SecurityProfile, &out.SecurityProfile - *out = new(apiv1alpha4.SecurityProfile) - (*in).DeepCopyInto(*out) - } - if in.SpotVMOptions != nil { - in, out := &in.SpotVMOptions, &out.SpotVMOptions - *out = new(apiv1alpha4.SpotVMOptions) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachineTemplate. -func (in *AzureMachineTemplate) DeepCopy() *AzureMachineTemplate { - if in == nil { - return nil - } - out := new(AzureMachineTemplate) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AzureManagedCluster) DeepCopyInto(out *AzureManagedCluster) { *out = *in