Skip to content

Add onctl sizes: the VM sizes --type takes, per provider - #1170

Merged
cdalar merged 1 commit into
mainfrom
feat/sizes
Oct 4, 2026
Merged

cdalar merged 1 commit into
mainfrom
feat/sizes

Conversation

@cdalar

@cdalar cdalar commented Oct 4, 2026

Copy link
Copy Markdown
Owner

onctl sizes lists what --type accepts for the current provider. It's a new optional SizeLister interface, like ImageLister. This PR covers boxes, Hetzner and OVH; AWS, GCP and Azure come next, since they need region handling and filtering.

$ onctl sizes -p hetzner          # live output, location fsn1
NAME      VCPU   MEMORY    DISK      ARCH   PRICE/HOUR   PRICE/MONTH
cax11     2      4 GiB     40 GiB    arm    0.0096 EUR   5.99 EUR
cx23      2      4 GiB     40 GiB    x86    0.0088 EUR   5.49 EUR
ccx13 *   2      8 GiB     80 GiB    x86    0.0689 EUR   42.99 EUR
...
$ onctl sizes -p boxes
NAME      VCPU   MEMORY   DISK
small *   1      4 GiB    8 GiB
medium    2      8 GiB    10 GiB
large     4      16 GiB   30 GiB

Per provider

  • boxes: GET /api/sizes; the service's default is marked.
  • Hetzner: server types offered in the configured location, with that location's prices.
    • Deprecated types are left out, and so are types not available there.
    • Prices are shown in EUR. Server-type prices carry no currency (only /pricing does), and ls's cost column makes the same assumption.
  • OVH: flavors available in the configured region. No prices, because the API publishes none.
  • fc / ch: says to use --vcpu/--memory, since these providers have no fixed sizes.

Output

  • Sorted smallest first; the configured default is marked *.
  • Columns no size fills in are left out, e.g. prices for OVH and boxes.
  • onctl create --type <TAB> completes from the same list.

Tests

  • Hetzner against a fake API: location filter, deprecation, prices for the right location, sort order, default.
  • OVH against its fake API: region and availability filtering.
  • boxes /api/sizes.
  • The table formatting.
  • go test -race -shuffle=on ./... and golangci-lint are clean.
  • Checked live against Hetzner and boxctl.io.

🤖 Generated with Claude Code

https://claude.ai/code/session_01U8g3mHkS6JmtYVYc4AjcV4

A SizeLister optional interface, like ImageLister, implemented for:

- boxes: /api/sizes (small/medium/large, the service's default marked)
- Hetzner: server types offered in the configured location, with that
  location's hourly and monthly prices; deprecated types and types not
  available there are left out. Prices are in EUR (server-type prices
  carry no currency; the cost column in ls makes the same assumption).
- OVH: flavors available in the configured region (no prices: the API
  publishes none).

Smallest first, the configured default marked with *, and columns no
size fills in are left out. fc/ch say they take --vcpu/--memory instead.
create's --type completes from the same list. AWS, GCP and Azure follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U8g3mHkS6JmtYVYc4AjcV4
@cdalar
cdalar enabled auto-merge (squash) October 4, 2026 21:48
@codecov

codecov Bot commented Oct 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.85714% with 38 lines in your changes missing coverage. Please review.
✅ Project coverage is 39.83%. Comparing base (3d7097f) to head (851c79b).

Files with missing lines Patch % Lines
cmd/sizes.go 59.67% 25 Missing ⚠️
pkg/cloud/sizes.go 86.88% 8 Missing ⚠️
internal/providerboxes/client.go 0.00% 4 Missing ⚠️
pkg/cloud/boxes.go 92.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1170      +/-   ##
==========================================
+ Coverage   39.09%   39.83%   +0.74%     
==========================================
  Files          59       61       +2     
  Lines        6244     6384     +140     
==========================================
+ Hits         2441     2543     +102     
- Misses       3803     3841      +38     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cdalar
cdalar merged commit 5138508 into main Oct 4, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

⌂ 换网址