Skip to content

fix(autoscaler): reject Price expander for Hetzner provider - #4661

Merged
ksail-bot[bot] merged 2 commits into
mainfrom
devantler/fix-hetzner-autoscaler-price-expander
May 9, 2026
Merged

fix(autoscaler): reject Price expander for Hetzner provider#4661
ksail-bot[bot] merged 2 commits into
mainfrom
devantler/fix-hetzner-autoscaler-price-expander

Conversation

@devantler

Copy link
Copy Markdown
Contributor

Summary

The Hetzner cloud provider in the upstream cluster-autoscaler does not implement the pricing API, causing a fatal crash (CrashLoopBackOff) when --expander=price is passed:

F0509 08:08:19.491791  1 expander_factory.go:89] Couldn't access cloud provider pricing for price expander: Not implemented

This PR adds provider-aware validation in ValidateAutoscalerConfig to reject AutoscalerExpanderPrice when the provider is Hetzner, with a clear error message suggesting LeastWaste or Random as alternatives.

Changes

  • pkg/apis/cluster/v1alpha1/errors.go — New ErrExpanderNotSupportedForProvider sentinel error
  • pkg/apis/cluster/v1alpha1/validation.go — New validateExpanderForProvider function called from ValidateAutoscalerConfig; rejects Price for Hetzner with helpful alternative suggestions
  • pkg/apis/cluster/v1alpha1/autoscaler_test.go — 3 new test cases: Price+Hetzner (error), Price+Docker (ok), LeastWaste+Hetzner (ok)

Validation

  • go build ./...
  • go test ./pkg/apis/cluster/v1alpha1/... ✅ (26/26 pass)

Fixes #4660

The Hetzner cloud provider in the upstream cluster-autoscaler does not
implement the pricing API, causing a fatal crash when --expander=price
is passed. Add provider-aware validation in ValidateAutoscalerConfig to
reject AutoscalerExpanderPrice for ProviderHetzner with a clear error
message suggesting LeastWaste or Random as alternatives.

Fixes #4660

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 9, 2026 08:34
@github-project-automation github-project-automation Bot moved this to 🫴 Ready in 🌊 Project Board May 9, 2026
@devantler
devantler marked this pull request as ready for review May 9, 2026 08:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds provider-aware autoscaler validation to prevent a known crash scenario in upstream cluster-autoscaler when using the Hetzner cloud provider with the Price expander (pricing API not implemented), returning an actionable validation error instead of allowing a CrashLoopBackOff.

Changes:

  • Introduces a new sentinel error ErrExpanderNotSupportedForProvider for unsupported provider/expander combinations.
  • Adds validateExpanderForProvider and wires it into ValidateAutoscalerConfig to reject Price on Hetzner with suggested alternatives.
  • Extends autoscaler validation tests with coverage for Hetzner/Docker provider combinations and allowed expanders.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
pkg/apis/cluster/v1alpha1/validation.go Adds provider-aware expander validation and invokes it from ValidateAutoscalerConfig.
pkg/apis/cluster/v1alpha1/errors.go Adds a new sentinel error for unsupported expander/provider combinations.
pkg/apis/cluster/v1alpha1/autoscaler_test.go Adds test cases covering the Hetzner Price rejection and valid alternatives.

@github-actions

github-actions Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

MegaLinter analysis: Success

✅ Linters with no issues

actionlint, git_diff, hadolint, jscpd, jsonlint, lychee, markdown-table-formatter, markdownlint, prettier, prettier, stylelint, syft, trivy-sbom, trufflehog, v8r, v8r, yamllint

See detailed reports in MegaLinter artifacts

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ksail-bot
ksail-bot Bot enabled auto-merge May 9, 2026 08:47
@codecov

codecov Bot commented May 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.50.

Benchmark suite Current: f9c0c09 Previous: c9821bf Ratio
BenchmarkCluster_MarshalJSON/FullProductionCluster (github.com/devantler-tech/ksail/v7/pkg/apis/cluster/v1alpha1) 169864 ns/op 20670 B/op 465 allocs/op 79803 ns/op 20660 B/op 465 allocs/op 2.13
BenchmarkCluster_MarshalJSON/FullProductionCluster (github.com/devantler-tech/ksail/v7/pkg/apis/cluster/v1alpha1) - ns/op 169864 ns/op 79803 ns/op 2.13
BenchmarkYAMLEncode/Minimal (github.com/devantler-tech/ksail/v7/pkg/apis/cluster/v1alpha1) 158808 ns/op 21320 B/op 388 allocs/op 70570 ns/op 21320 B/op 388 allocs/op 2.25
BenchmarkYAMLEncode/Minimal (github.com/devantler-tech/ksail/v7/pkg/apis/cluster/v1alpha1) - ns/op 158808 ns/op 70570 ns/op 2.25
BenchmarkYAMLEncode/FullProductionCluster (github.com/devantler-tech/ksail/v7/pkg/apis/cluster/v1alpha1) 178517 ns/op 32448 B/op 433 allocs/op 80784 ns/op 32448 B/op 433 allocs/op 2.21
BenchmarkYAMLEncode/FullProductionCluster (github.com/devantler-tech/ksail/v7/pkg/apis/cluster/v1alpha1) - ns/op 178517 ns/op 80784 ns/op 2.21
BenchmarkJSONEncode (github.com/devantler-tech/ksail/v7/pkg/apis/cluster/v1alpha1) 107993 ns/op 15832 B/op 384 allocs/op 68209 ns/op 15831 B/op 384 allocs/op 1.58
BenchmarkJSONEncode (github.com/devantler-tech/ksail/v7/pkg/apis/cluster/v1alpha1) - ns/op 107993 ns/op 68209 ns/op 1.58

This comment was automatically generated by workflow using github-action-benchmark.

@ksail-bot
ksail-bot Bot added this pull request to the merge queue May 9, 2026
Merged via the queue into main with commit c1c50f1 May 9, 2026
62 checks passed
@ksail-bot
ksail-bot Bot deleted the devantler/fix-hetzner-autoscaler-price-expander branch May 9, 2026 09:54
@github-project-automation github-project-automation Bot moved this from 🫴 Ready to ✅ Done in 🌊 Project Board May 9, 2026
github-actions Bot added a commit that referenced this pull request May 9, 2026
The Hetzner cloud provider does not implement the pricing API, so
AutoscalerExpanderPrice causes a fatal crash. KSail now rejects this
combination at validation time (fix #4661). Update the hetzner.mdx
autoscaler reference to remove Price from the valid expander list and
add a note explaining the constraint.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
github-actions Bot added a commit that referenced this pull request May 9, 2026
The Hetzner cloud provider in upstream cluster-autoscaler does not
implement the pricing API. KSail now rejects Price as an expander
for Hetzner clusters (see fix #4661). Update docs to reflect the
supported strategies: LeastWaste, LeastNodes, Random.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
github-merge-queue Bot pushed a commit that referenced this pull request May 9, 2026
…4664)

* docs: note Price expander unsupported for Hetzner provider

The Hetzner cloud provider does not implement the pricing API, so
AutoscalerExpanderPrice causes a fatal crash. KSail now rejects this
combination at validation time (fix #4661). Update the hetzner.mdx
autoscaler reference to remove Price from the valid expander list and
add a note explaining the constraint.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* docs: clarify Price expander rejected at validation not runtime

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

bug: Cluster Autoscaler crashes with expander: Price on Hetzner — pricing API not implemented

3 participants