From 62d90f191bfca45faa8e34d86fdb3301747c320a Mon Sep 17 00:00:00 2001 From: patrickdillon Date: Thu, 18 Nov 2021 10:17:39 -0500 Subject: [PATCH] Add Image Type to Azure Machine Provider Spec With Azure marketplace images, some images require that the subscription accept the terms of a purchase plan before using; and that purchase plan information must be included in Azure API calls when provisioning a VM. Images that do not require purchase plans must not submit purchase plan info. This adds an image type to distinguish between Marketplace images with or without purchase plans. It could be used in the future to support images from galleries. --- machine/v1beta1/types_azureprovider.go | 20 +++++++++++++++++++ .../zz_generated.swagger_doc_generated.go | 1 + 2 files changed, 21 insertions(+) diff --git a/machine/v1beta1/types_azureprovider.go b/machine/v1beta1/types_azureprovider.go index e185a0193cf..65aea789563 100644 --- a/machine/v1beta1/types_azureprovider.go +++ b/machine/v1beta1/types_azureprovider.go @@ -174,8 +174,28 @@ type Image struct { Version string `json:"version"` // ResourceID specifies an image to use by ID ResourceID string `json:"resourceID"` + // Type identifies the source of the image and related information, such as purchase plans. + // Valid values are "ID", "MarketplaceWithPlan", "MarketplaceNoPlan", and omitted, which + // means no opinion and the platform chooses a good default which may change over time. + // Currently that default is "MarketplaceNoPlan" if publisher data is supplied, or "ID" if not. + // For more information about purchase plans, see: + // https://docs.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage#check-the-purchase-plan-information + // +optional + Type AzureImageType `json:"type,omitempty"` } +// AzureImageType provides an enumeration for the valid image types. +type AzureImageType string + +const ( + // AzureImageTypeID specifies that the image should be referenced by its resource ID. + AzureImageTypeID AzureImageType = "ID" + // AzureImageTypeMarketplaceNoPlan are images available from the marketplace that do not require a purchase plan. + AzureImageTypeMarketplaceNoPlan AzureImageType = "MarketplaceNoPlan" + // AzureImageTypeMarketplaceWithPlan require a purchase plan. Upstream these images are referred to as "ThirdParty." + AzureImageTypeMarketplaceWithPlan AzureImageType = "MarketplaceWithPlan" +) + type OSDisk struct { // OSType is the operating system type of the OS disk. Possible values include "Linux" and "Windows". OSType string `json:"osType"` diff --git a/machine/v1beta1/zz_generated.swagger_doc_generated.go b/machine/v1beta1/zz_generated.swagger_doc_generated.go index 6b569f4aaa3..9f01fad1eb2 100644 --- a/machine/v1beta1/zz_generated.swagger_doc_generated.go +++ b/machine/v1beta1/zz_generated.swagger_doc_generated.go @@ -225,6 +225,7 @@ var map_Image = map[string]string{ "sku": "SKU specifies an instance of an offer, such as a major release of a distribution. For example, 18.04-LTS, 2019-Datacenter", "version": "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.", "resourceID": "ResourceID specifies an image to use by ID", + "type": "Type identifies the source of the image and related information, such as purchase plans. Valid values are \"ID\", \"MarketplaceWithPlan\", \"MarketplaceNoPlan\", and omitted, which means no opinion and the platform chooses a good default which may change over time. Currently that default is \"MarketplaceNoPlan\" if publisher data is supplied, or \"ID\" if not. For more information about purchase plans, see: https://docs.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage#check-the-purchase-plan-information", } func (Image) SwaggerDoc() map[string]string {