[bug] azure spot: no fallback to next candidate when VM size has no capacity (SkuNotAvailable)

オープン
#946 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 4 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
azure, go

調査の方向性

Start by reading pkg/provider/azure/data/spot.go, especially selectSpotChoice, and trace how its selected VM size and location reach VM creation. The reproduction shows Azure can return capacity errors such as SkuNotAvailable; inspect how those errors surface during stack updates and how candidate choices are ranked. Done means capacity-related failures try the next ranked candidate, with tests covering retry behavior and exhaustion.

索引モデルが issue の本文から書いたものです。

説明

Description

On Azure, spot provisioning fails hard when the selected VM size has no capacity in the selected region. mapt picks a single (size, location) pair and, when Azure rejects it with SkuNotAvailable (capacity restriction), the stack update fails and create exits 1 — no other candidate is tried.

Because the selection is based on eviction rates + prices only (pkg/provider/azure/data/spot.go → selectSpotChoice), which change slowly, the same unavailable pair tends to be picked again on subsequent runs.

Reproduction

mapt v0.14.5 (tekton task tkn/infra-azure-rhel.yaml):

mapt azure rhel create \
  --cpus 4 --memory 32 --gpus 0 --nested-virt --arch amd64 --version 10.1 --disk-size 200 \
  --spot --spot-eviction-tolerance lowest --spot-increase-rate 30 \
  --spot-excluded-regions westindia,centralindia,southindia,australiacentral,australiacentral2,australiaeast,australiasoutheast,southafricanorth,southafricawest \
  ...
Full log output
DEBU running 'mapt azure rhel create'
DEBU Creating RHEL Server
DEBU context initialized for mapt0f84237d
DEBU Based on avg prices for instance types [Standard_E4as_v5 Standard_E4as_v6 Standard_E4bs_v5 Standard_E4ns_v6 Standard_E4s_v4 Standard_E4s_v6 Standard_E4s_v5 Standard_F4ams_v7 Standard_F4ams_v6 Standard_FX4ms_v2 Standard_D8as_v6 Standard_D8as_v5 Standard_D8ns_v6 Standard_D8s_v4 Standard_D8s_v6 Standard_D8s_v5 Standard_E8as_v5 Standard_E8as_v6 Standard_E8bs_v5 Standard_E8ns_v6] is az centralus, current avg price is 0.13 and max price is 0.13 with a score of 0-5
DEBU Spot data: {[Standard_E8ns_v6] 0.16500120000000001 centralus  0}
DEBU managing stack stackAzureLinux-mapt-rhel-podman-desktop-877726682
INFO Updating (stackAzureLinux-mapt-rhel-podman-desktop-877726682):
INFO
INFO  +  pulumi:pulumi:Stack mapt-rhel-podman-desktop-877726682-stackAzureLinux-mapt-rhel-podman-desktop-877726682 creating (0s)
DEBU About to create the VM with compute.NewVirtualMachine
INFO  +  tls:index:PrivateKey main-als-privatekey-user creating (0s)
INFO  +  azure-native:resources:ResourceGroup main-als-rg creating (0s)
INFO  +  tls:index:PrivateKey main-als-privatekey-user created (3s)
INFO  +  azure-native:resources:ResourceGroup main-als-rg created (5s)
INFO  +  azure-native:network:NetworkSecurityGroup main-als-sg creating (0s)
INFO  +  azure-native:network:VirtualNetwork main-als-vn creating (0s)
INFO  +  azure-native:network:PublicIPAddress main-als-pip creating (0s)
INFO  +  azure-native:network:NetworkSecurityGroup main-als-sg created (2s)
INFO  +  azure-native:network:PublicIPAddress main-als-pip created (3s)
INFO  +  azure-native:network:VirtualNetwork main-als-vn created (5s)
INFO  +  azure-native:network:Subnet main-als-sn creating (0s)
INFO  +  azure-native:network:Subnet main-als-sn created (4s)
INFO  +  azure-native:network:NetworkInterface main-als-ni creating (0s)
INFO  +  azure-native:network:NetworkInterface main-als-ni created (2s)
INFO  +  azure-native:compute:VirtualMachine main-als-vm creating (0s)
INFO  +  azure-native:compute:VirtualMachine main-als-vm creating (1s) error: Status=409 Code="SkuNotAvailable" Message="The requested VM size for resource 'Following SKUs have failed for Capacity Restrictions: Standard_E8ns_v6' is currently not available in location 'centralus'. Please try another size or deploy to a different location or different zone. See https://aka.ms/azureskunotavailable for details."
INFO  +  azure-native:compute:VirtualMachine main-als-vm **creating failed** error: Status=409 Code="SkuNotAvailable" Message="The requested VM size for resource 'Following SKUs have failed for Capacity Restrictions: Standard_E8ns_v6' is currently not available in location 'centralus'. Please try another size or deploy to a different location or different zone. See https://aka.ms/azureskunotavailable for details."
INFO  +  pulumi:pulumi:Stack mapt-rhel-podman-desktop-877726682-stackAzureLinux-mapt-rhel-podman-desktop-877726682 creating (27s) error: update failed
INFO  +  pulumi:pulumi:Stack mapt-rhel-podman-desktop-877726682-stackAzureLinux-mapt-rhel-podman-desktop-877726682 **creating failed (26s)** 1 error
INFO Diagnostics:
INFO   azure-native:compute:VirtualMachine (main-als-vm):
INFO     error: Status=409 Code="SkuNotAvailable" Message="The requested VM size for resource 'Following SKUs have failed for Capacity Restrictions: Standard_E8ns_v6' is currently not available in location 'centralus'. Please try another size or deploy to a different location or different zone. See https://aka.ms/azureskunotavailable for details."
INFO
INFO   pulumi:pulumi:Stack (mapt-rhel-podman-desktop-877726682-stackAzureLinux-mapt-rhel-podman-desktop-877726682):
INFO     error: update failed
INFO
INFO Outputs:
INFO     main-alsHost          : "<redacted>"
INFO     main-alsUserPrivatekey: [secret]
INFO     main-alsUsername      : "rhqp"
INFO
INFO Resources:
INFO     + 8 created
INFO     2 errored
INFO
INFO Duration: 28s
INFO
ERRO failed to run update: exit status 1
Expected

When the VM creation fails due to capacity (SkuNotAvailable, AllocationFailed, ZonalAllocationFailed, OverconstrainedAllocationRequest, spot OperationNotAllowed max-price), mapt should try the next best candidate from the ranked spot results (other size and/or location) instead of failing.

Possible approaches
  • Keep the ranked list of spot choices (not just the top one) and on capacity errors destroy/re-target the VM resource with the next candidate, up to N attempts.
  • Pre-filter candidates using SKU restrictions (Resource SKUs API, restrictions with reasonCode) and/or Azure Spot Placement Score, so capacity is part of the score (related: #222).
  • Optional flag to fall back to on-demand in a given location if all spot candidates fail.

Related: #242 (spot failing on Azure due to capacity / price), #222.

主要言語
Go
スター
25
フォーク
41
平均マージ
5日 3時間
マージ済み PR(30日)
16

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

redhat-developer/mapt のほかの issue

redhat-developer/mapt の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。