From 64a3618babcdbd2b85239d012a2f73f7d5ba4df0 Mon Sep 17 00:00:00 2001 From: TinaMor Date: Tue, 16 Jul 2024 11:44:22 +0000 Subject: [PATCH] Add WS2025 VHD - Adds commands for Windows Server 2025 VHD and SIG images - Adds Purchase Plan info for Azure Market Place Images --- images/capi/Makefile | 4 ++++ images/capi/azure_targets.sh | 8 ++++---- images/capi/packer/azure/packer-windows.json | 5 +++++ images/capi/packer/azure/scripts/init-sig.sh | 15 ++++++++++++++- .../packer/azure/windows-2025-containerd.json | 18 ++++++++++++++++++ 5 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 images/capi/packer/azure/windows-2025-containerd.json diff --git a/images/capi/Makefile b/images/capi/Makefile index 53489c9f4a..5e9aa24a77 100644 --- a/images/capi/Makefile +++ b/images/capi/Makefile @@ -655,6 +655,7 @@ build-azure-sig-azurelinux-3: ## Builds Azure Linux 3 Azure managed image in Sha build-azure-sig-rhel-8: ## Builds RHEL 8 Azure managed image in Shared Image Gallery build-azure-sig-windows-2019-containerd: ## Builds Windows Server 2019 with containerd Azure managed image in Shared Image Gallery build-azure-sig-windows-2022-containerd: ## Builds Windows Server 2022 with containerd Azure managed image in Shared Image Gallery +build-azure-sig-windows-2025-containerd: ## Builds Windows Server 2025 with containerd Azure managed image in Shared Image Gallery build-azure-sig-windows-2019-containerd-cvm: ## Builds Windows Server 2019 with containerd CVM Azure managed image in Shared Image Gallery build-azure-sig-windows-2022-containerd-cvm: ## Builds Windows Server 2022 with containerd CVM Azure managed image in Shared Image Gallery build-azure-vhd-ubuntu-2004: ## Builds Ubuntu 20.04 VHD image for Azure @@ -666,6 +667,7 @@ build-azure-vhd-azurelinux-3: ## Builds Azure Linux 3 VHD image for Azure build-azure-vhd-rhel-8: ## Builds RHEL 8 VHD image for Azure build-azure-vhd-windows-2019-containerd: ## Builds for Windows Server 2019 with containerd build-azure-vhd-windows-2022-containerd: ## Builds for Windows Server 2022 with containerd +build-azure-vhd-windows-2025-containerd: ## Builds for Windows Server 2025 with containerd build-azure-sig-windows-annual-containerd: ## Builds for Windows Server Annual Channel with containerd build-azure-sig-centos-7-gen2: ## Builds CentOS Gen2 managed image in Shared Image Gallery build-azure-sig-mariner-2-gen2: ## Builds Azure Linux 2 Gen2 managed image in Shared Image Gallery @@ -875,6 +877,7 @@ validate-azure-sig-ubuntu-2204: ## Validates Ubuntu 22.04 Azure managed image in validate-azure-sig-ubuntu-2404: ## Validates Ubuntu 24.04 Azure managed image in Shared Image Gallery Packer config validate-azure-sig-windows-2019-containerd: ## Validate Windows Server 2019 with containerd Azure managed image in Shared Image Gallery Packer config validate-azure-sig-windows-2022-containerd: ## Validate Windows Server 2022 with containerd Azure managed image in Shared Image Gallery Packer config +validate-azure-sig-windows-2025-containerd: ## Validate Windows Server 2025 with containerd Azure managed image in Shared Image Gallery Packer config validate-azure-sig-windows-annual-containerd: ## Validate Windows Server Annual Channel with containerd Azure managed image in Shared Image Gallery Packer config validate-azure-vhd-centos-7: ## Validates CentOS 7 VHD image Azure Packer config validate-azure-vhd-mariner-2: ## Validates Azure Linux 2 VHD image Azure Packer config @@ -885,6 +888,7 @@ validate-azure-vhd-ubuntu-2204: ## Validates Ubuntu 22.04 VHD image Azure Packer validate-azure-vhd-ubuntu-2404: ## Validates Ubuntu 24.04 VHD image Azure Packer config validate-azure-vhd-windows-2019-containerd: ## Validate Windows Server 2019 VHD with containerd image Azure Packer config validate-azure-vhd-windows-2022-containerd: ## Validate Windows Server 2022 VHD with containerd image Azure Packer config +validate-azure-vhd-windows-2025-containerd: ## Validate Windows Server 2025 VHD with containerd image Azure Packer config validate-azure-sig-centos-7-gen2: ## Validates CentOS 7 Azure managed image in Shared Image Gallery Packer config validate-azure-sig-mariner-2-gen2: ## Validates Azure Linux 2 Gen2 Azure managed image in Shared Image Gallery Packer config validate-azure-sig-azurelinux-3-gen2: ## Validates Azure Linux 3 Gen2 Azure managed image in Shared Image Gallery Packer config diff --git a/images/capi/azure_targets.sh b/images/capi/azure_targets.sh index 952fc26c7f..3d1211a625 100644 --- a/images/capi/azure_targets.sh +++ b/images/capi/azure_targets.sh @@ -1,7 +1,7 @@ -VHD_TARGETS="ubuntu-2004 ubuntu-2204 ubuntu-2404 centos-7 mariner-2 azurelinux-3 rhel-8 windows-2019-containerd windows-2022-containerd" -VHD_CI_TARGETS="ubuntu-2204 ubuntu-2404 mariner-2 windows-2019-containerd windows-2022-containerd" -SIG_TARGETS="ubuntu-2004 ubuntu-2204 ubuntu-2404 centos-7 mariner-2 azurelinux-3 rhel-8 windows-2019-containerd windows-2022-containerd flatcar" -SIG_CI_TARGETS="ubuntu-2204 ubuntu-2404 mariner-2 windows-2019-containerd windows-2022-containerd flatcar" +VHD_TARGETS="ubuntu-2004 ubuntu-2204 ubuntu-2404 centos-7 mariner-2 azurelinux-3 rhel-8 windows-2019-containerd windows-2022-containerd windows-2025-containerd" +VHD_CI_TARGETS="ubuntu-2204 ubuntu-2404 mariner-2 windows-2019-containerd windows-2022-containerd windows-2025-containerd" +SIG_TARGETS="ubuntu-2004 ubuntu-2204 ubuntu-2404 centos-7 mariner-2 azurelinux-3 rhel-8 windows-2019-containerd windows-2022-containerd windows-2025-containerd flatcar" +SIG_CI_TARGETS="ubuntu-2204 ubuntu-2404 mariner-2 windows-2019-containerd windows-2022-containerd windows-2025-containerd flatcar" SIG_GEN2_TARGETS="ubuntu-2004 ubuntu-2204 ubuntu-2404 centos-7 mariner-2 azurelinux-3 flatcar" SIG_GEN2_CI_TARGETS="ubuntu-2204 ubuntu-2404 mariner-2 flatcar" SIG_CVM_TARGETS="ubuntu-2004 ubuntu-2204 ubuntu-2404 windows-2019-containerd windows-2022-containerd" diff --git a/images/capi/packer/azure/packer-windows.json b/images/capi/packer/azure/packer-windows.json index d8e2184592..42d0048f03 100644 --- a/images/capi/packer/azure/packer-windows.json +++ b/images/capi/packer/azure/packer-windows.json @@ -59,6 +59,11 @@ "name": "sig-{{user `build_name`}}", "os_disk_size_gb": "{{user `os_disk_size_gb`}}", "os_type": "Windows", + "plan_info": { + "plan_name": "{{user `plan_image_sku`}}", + "plan_product": "{{user `plan_image_offer`}}", + "plan_publisher": "{{user `plan_image_publisher`}}" + }, "private_virtual_network_with_public_ip": "{{user `private_virtual_network_with_public_ip`}}", "shared_gallery_image_version_exclude_from_latest": "{{ user `exclude_from_latest` }}", "shared_image_gallery": { diff --git a/images/capi/packer/azure/scripts/init-sig.sh b/images/capi/packer/azure/scripts/init-sig.sh index 65120f21a6..3c803fa20f 100755 --- a/images/capi/packer/azure/scripts/init-sig.sh +++ b/images/capi/packer/azure/scripts/init-sig.sh @@ -14,6 +14,13 @@ eval "$tracestate" export RESOURCE_GROUP_NAME="${RESOURCE_GROUP_NAME:-cluster-api-images}" export AZURE_LOCATION="${AZURE_LOCATION:-southcentralus}" + +# Creating Azure VMs from a Marketplace Image requires a Purchase Plan +# https://portal.azure.com/#view/Microsoft_Azure_Marketplace/GalleryItemDetailsBladeNopdl/id/microsoftwindowsserver.microsoftserveroperatingsystems-previews/selectionMode~/false/resourceGroupId//resourceGroupLocation//dontDiscardJourney~/false +export PLAN_PUBLISHER="${PLAN_PUBLISHER:-''}" +export PLAN_OFFER="${PLAN_OFFER:-''}" +export PLAN_NAME="${PLAN_NAME:-''}" + if ! az group show -n ${RESOURCE_GROUP_NAME} -o none 2>/dev/null; then az group create -n ${RESOURCE_GROUP_NAME} -l ${AZURE_LOCATION} --tags ${TAGS:-} fi @@ -50,7 +57,10 @@ create_image_definition() { --sku ${SIG_SKU:-$2} \ --hyper-v-generation ${3} \ --os-type ${4} \ - --features ${5:-''} + --features ${5:-''} \ + --plan-name ${PLAN_NAME} \ + --plan-product ${PLAN_OFFER} \ + --plan-publisher ${PLAN_PUBLISHER} } SIG_TARGET=$1 @@ -83,6 +93,9 @@ case ${SIG_TARGET} in windows-2022-containerd) create_image_definition ${SIG_TARGET} "win-2022-containerd" "V1" "Windows" ;; + windows-2025-containerd) + create_image_definition ${SIG_TARGET} "win-2025-containerd" "V2" "Windows" + ;; windows-annual-containerd) create_image_definition ${SIG_TARGET} "win-annual-containerd" "V1" "Windows" ;; diff --git a/images/capi/packer/azure/windows-2025-containerd.json b/images/capi/packer/azure/windows-2025-containerd.json new file mode 100644 index 0000000000..2129fde463 --- /dev/null +++ b/images/capi/packer/azure/windows-2025-containerd.json @@ -0,0 +1,18 @@ +{ + "additional_registry_images": "false", + "additional_registry_images_list": "", + "build_name": "windows-2025-containerd", + "distribution": "windows", + "distribution_version": "2025", + "image_offer": "microsoftserveroperatingsystems-previews", + "image_publisher": "MicrosoftWindowsServer", + "image_sku": "windows-server-2025-azure-edition-hotpatch", + "image_version": "latest", + "load_additional_components": "false", + "runtime": "containerd", + "vm_size": "Standard_D4s_v3", + "windows_updates_kbs": "", + "plan_image_sku": "windows-server-2025-azure-edition-hotpatch", + "plan_image_offer": "microsoftserveroperatingsystems-previews", + "plan_image_publisher": "microsoftwindowsserver" +} \ No newline at end of file