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

Đang mở
#946 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 4 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
azure, go
Lĩnh vực
cloud, infrastructure

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Go
Star
25
Fork
41
Merge trung bình
5 ngày 3 giờ
Pull request đã merge (30 ngày)
16

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của redhat-developer/mapt

Tất cả issue của redhat-developer/mapt

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.