Skip to content

Commit cb791c6

Browse files
committed
fix(opencost): use Hetzner pricing API values and ECB FX rate
> 🤖 Generated by the Daily AI Assistant Replaced hand-edited assumptions with values pulled directly from the Hetzner Cloud Pricing API (`GET /v1/pricing`, location fsn1) and the ECB EUR→USD reference rate for 2026-05-27. API-verified (net of VAT): CX33 cap = €6.49 / server / month (hourly €0.0104) Volumes = €0.0572 / GB / month Egress = €1.00 / TB overage (€0.001 / GB; 20 TiB incl. per server) FX (ECB reference, 2026-05-27): 1.1637 EUR/USD. The previous 1.08 assumption was 8% low. Re-derived (50/50 CPU-RAM split, unchanged convention): €6.49 × 1.1637 = $7.5524 / server / month CPU = $7.5524 × 0.5 / 4 vCPU ≈ $0.9441 / vCPU-month (was 0.876) RAM = $7.5524 × 0.5 / 8 GB ≈ $0.4720 / GB-month (was 0.438) Vol = €0.0572 × 1.1637 ≈ $0.0666 / GB-month (was 0.0618) Egress = €0.001 × 1.1637 ≈ $0.001164 / GB (was 0.001 flat) End-to-end check (1 vCPU for 1 hour): ConfigMap CPU = 0.9441 → OpenCost / 730 = $0.001293 / vCPU-hour Real cost = (€6.49 × 0.5 / 4 vCPU / 730 hr) × 1.1637 = €0.001112 × 1.1637 = $0.001294 / vCPU-hour ✓ Using net (excl. VAT) because VAT is location-dependent (DK = 25%) and typically reclaimable for businesses; tracking it would conflate compute cost with tax overhead. Gross is +25% on every figure. Validated with `ksail workload validate` on both clusters/local and clusters/prod (256 files each).
1 parent 8830296 commit cb791c6

1 file changed

Lines changed: 27 additions & 18 deletions

File tree

k8s/bases/infrastructure/controllers/opencost/helm-release.yaml

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,42 +42,51 @@ spec:
4242
# Hetzner Cloud custom pricing — CX33 monthly cap decomposed into
4343
# per-resource-unit USD costs. CX33 spec verified live with
4444
# `kubectl get nodes`: 4 vCPU, 7916176 KiB RAM (8 GB nominal), 80 GB NVMe.
45-
# Price source: Hetzner price-adjustment doc, effective 2026-04-01:
46-
# https://docs.hetzner.com/general/infrastructure-and-availability/price-adjustment/
47-
# CX33 cap = €6.49 / server / month → $7.01 at EUR/USD ≈ 1.08
48-
# Volumes = €0.0572 / GB / month → $0.0618 / GB / month
45+
# Price source: Hetzner Cloud Pricing API (2026-05, location fsn1, net
46+
# of VAT — gross is +25% but VAT is reclaimable / location-dependent and
47+
# tracking it in OpenCost would conflate compute cost with tax overhead):
48+
# curl -H "Authorization: Bearer $HCLOUD_TOKEN" \
49+
# https://api.hetzner.cloud/v1/pricing
50+
# CX33 cap = €6.49 / server / month (hourly €0.0104)
51+
# Volumes = €0.0572 / GB / month
52+
# Egress = €1.00 / TB overage (€0.001 / GB; 20 TiB incl. per server)
53+
# FX: ECB EUR→USD reference rate 2026-05-27 = 1.1637.
4954
#
5055
# IMPORTANT: OpenCost interprets CPU / spotCPU / RAM / spotRAM / GPU / storage
5156
# in the costModel ConfigMap as USD PER MONTH and divides by HoursPerMonth=730
5257
# to get an hourly rate (opencost providerconfig.go:188, customprovider.go:95).
5358
# Network egress fields are passed through as-is (USD per GB transferred).
5459
#
55-
# 50/50 CPU-RAM split of the $7.01/server/month server cost (Hetzner does
56-
# not publish a CPU/RAM breakdown — this is an allocation convention):
57-
# CPU: $7.01 × 0.5 / 4 vCPU ≈ $0.876 / vCPU-month
58-
# RAM: $7.01 × 0.5 / 8 GB ≈ $0.438 / GB-month
60+
# Derivation:
61+
# €6.49/server/month × 1.1637 = $7.5524/server/month
62+
# 50/50 CPU-RAM split (Hetzner does not publish a breakdown — convention):
63+
# CPU: $7.5524 × 0.5 / 4 vCPU ≈ $0.9441 / vCPU-month
64+
# RAM: $7.5524 × 0.5 / 8 GB ≈ $0.4720 / GB-month
65+
# Volume: €0.0572 × 1.1637 ≈ $0.0666 / GB-month
66+
# Egress: €0.001 × 1.1637 ≈ $0.001164 / GB
5967
#
6068
# End-to-end sanity check (1 vCPU for 1 hour):
61-
# ConfigMap CPU = 0.876 → OpenCost / 730 = $0.00120 / vCPU-hour
62-
# Real cost = (€6.49 × 0.5 / 4 vCPU / 730 hr) × 1.08 = $0.00120 / vCPU-hour ✓
69+
# ConfigMap CPU = 0.9441 → OpenCost / 730 = $0.001293 / vCPU-hour
70+
# Real cost = (€6.49 × 0.5 / 4 vCPU / 730 hr) × 1.1637
71+
# = €0.001112 × 1.1637 = $0.001294 / vCPU-hour ✓
6372
# https://www.opencost.io/docs/configuration/on-prem#custom-pricing-using-the-opencost-helm-chart
6473
customPricing:
6574
enabled: true
6675
createConfigmap: true
6776
provider: custom
6877
costModel:
69-
description: "Hetzner Cloud CX33 — 4 vCPU / 8 GB / 80 GB NVMe (50/50 CPU-RAM split, USD/month)"
70-
CPU: 0.876
78+
description: "Hetzner Cloud CX33 — 4 vCPU / 8 GB / 80 GB NVMe (50/50 CPU-RAM split, USD/month net of VAT)"
79+
CPU: 0.9441
7180
spotCPU: 0
72-
RAM: 0.438
81+
RAM: 0.4720
7382
spotRAM: 0
7483
GPU: 0
75-
storage: 0.0618
84+
storage: 0.0666
7685
# Egress: passed through as USD per GB transferred; CX33 includes
77-
# 20 TB/month free, overage ≈ $0.001/GB on Hetzner Cloud.
78-
zoneNetworkEgress: 0.001
79-
regionNetworkEgress: 0.001
80-
internetNetworkEgress: 0.001
86+
# 20 TiB/month free, overage ≈ €1.00/TB = $0.001164/GB.
87+
zoneNetworkEgress: 0.001164
88+
regionNetworkEgress: 0.001164
89+
internetNetworkEgress: 0.001164
8190

8291
exporter:
8392
replicas: 1

0 commit comments

Comments
 (0)