Skip to content

feat: make VM reboot timeout configurable via --vm-reboot-timeout - #414

Merged
ovi-ionos merged 7 commits into
masterfrom
feat/ICNAS-875
Sep 2, 2026
Merged

feat: make VM reboot timeout configurable via --vm-reboot-timeout#414
ovi-ionos merged 7 commits into
masterfrom
feat/ICNAS-875

Conversation

@ovi-ionos

@ovi-ionos ovi-ionos commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Description of your changes

This PR adds:

  • a --vm-reboot-timeout flag to be able to configure the amount of time waited after a VM has been rebooted when using the statemap feature
  • a boolean flag --extend-serverset-timeout-for-vm-reboot to optionally be able to extend the timeout of the ServerSet controller, without needing to change the global timeout for all other controllers. This is necessary, otherwise a --vm-reboot-timeout longer than the global --timeout would not actually be applied... This is a compromise, to avoid having to raise --timeout for all controllers to unnecessarily high values.
  • a check to exit early with an error at startup when --vm-reboot-timeout is configured manually beyond the --timeout without also setting --extend-serverset-timeout-for-vm-reboot. This is intended to guard against unintentional misconfiguration, and will only fire if the user manually specifies the --vm-reboot-timeout flag, and never with the default configuration (which already has --timeout lower than --vm-reboot-timeout). One could instead log a warning, but I think it's likely that would not be noticed and hence not stop accidental misconfiguration...
  • a fix for WaitForResource in 3c81447. The calculated deadline wasn't actually properly passed to the function callback, it always received the overall outer context without the more specific deadline. This should not matter, because the callbacks usually complete fast.

Instead of this (a bit over-specific) --extend-serverset-timeout-for-vm-reboot flag, one could also introduce a --timeout-per-resource flag mirroring --max-reconcile-rate-per-resource. That would make the timeout for any controller in this provider configurable, and then one just has to know to increase the timeout for SSet.
If you'd prefer that solution, let me know.

Checklist

I have:

  • Add PR name as appropriate (e.g. feat/fix/doc/test/refactor)
  • Run make reviewable and make crds.clean to ensure the PR is ready for review
  • Add or update tests (if applicable)
  • Add or update Documentation using make docs.update (if applicable)
  • Update docs/CHANGELOG.md file (label: upcoming release)
  • Check Sonar Cloud Scan

Copilot AI lite review requested due to automatic review settings August 28, 2026 11:41
@ovi-ionos
ovi-ionos force-pushed the feat/ICNAS-875 branch 2 times, most recently from 7703748 to 89e3d56 Compare August 28, 2026 11:44

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

This PR makes the VM reboot wait (used by the ServerSet state map / failover orchestration path) configurable via CLI flags, and wires that configuration through provider options into the ServerSet controller so the controller’s reconcile timeout can optionally be widened to accommodate longer reboot waits.

Changes:

  • Add --vm-reboot-timeout and --extend-serverset-timeout-for-vm-reboot flags and plumb them into ConfigurationOptions.
  • Pass the configured VM reboot timeout into the ServerSet controller’s connector/external logic and use it in kube.WaitForResource calls.
  • Remove the hard-coded VMRebootTimeout constant and clarify ServerSet ready timeout usage in comments.

Reviewed changes

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

Show a summary per file
File Description
pkg/kube/kube.go Removes the fixed VM reboot timeout constant and updates timeout-related comments.
internal/utils/configuration.go Extends provider configuration options with VM reboot timeout + “extend ServerSet timeout” toggle and exposes getters.
internal/controller/serverset/setup.go Computes a ServerSet-specific reconcile timeout and passes VM reboot timeout into the connector.
internal/controller/serverset/serverset.go Uses the configured VM reboot timeout for post-reboot readiness waits instead of a constant.
cmd/provider/main.go Defines the new CLI flags, warns about ineffective combinations, and constructs configuration options with the new values.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/controller/serverset/setup.go
Comment thread cmd/provider/main.go Outdated
Comment thread internal/utils/configuration.go

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

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Comment thread internal/controller/serverset/serverset.go
Comment thread cmd/provider/main.go

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

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

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

cmd/provider/main.go:97

  • The kingpin.Fatalf format string uses %s (expects a stringer like time.Duration), but the arguments passed are *time.Duration pointers (vmRebootTimeout, timeout). This will print as a fmt error (e.g. %!s(*time.Duration=...)) instead of the actual duration values.
		kingpin.Fatalf("--vm-reboot-timeout (%s) exceeds --timeout (%s) but --extend-serverset-timeout-for-vm-reboot is not set; "+
			"the VM reboot wait would be silently capped at ~--timeout and have no effect. "+
			"Either lower --vm-reboot-timeout or pass --extend-serverset-timeout-for-vm-reboot",
			vmRebootTimeout, timeout)

@cristiGuranIonos cristiGuranIonos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

might be a little better to put a per-resource timeout, but this should be fine since it will only ever be set in these conditions

@ovi-ionos
ovi-ionos removed the request for review from ionoscloudsdk September 1, 2026 12:12
ovi-ionos and others added 6 commits September 2, 2026 14:20
Replaces the hardcoded VMRebootTimeout constant with a provider flag
(default 120m, matching the prior behavior) so it can be configured
in each deployment.
In some situations our VMs might need be expected to take longer to
reestablish a safe state between themselves, which means we'd need
to configure a higher value here.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
--vm-reboot-timeout alone had no effect once raised past --timeout: the
wait already runs inside a context bounded by the ServerSet controller's
own managed.WithTimeout(opts.GetTimeout()), and context.WithTimeout can
only shrink a deadline, never extend it.

Add --extend-serverset-timeout-for-vm-reboot (default false, opt-in) to
widen only the ServerSet controller's own reconcile-timeout ceiling to
max(--timeout, --vm-reboot-timeout) when explicitly enabled. Every other
resource kind keeps using --timeout unchanged. Also log a non-fatal
warning at startup if --vm-reboot-timeout exceeds --timeout without the
new flag set, since that combination is silently capped.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
There's no legitimate reason to explicitly set
--vm-reboot-timeout above --timeout without also passing
--extend-serverset-timeout-for-vm-reboot: without the latter, the
value has zero effect (silently capped).

This check only fires when the user actually set the flag.
So this is intended to explicitly catch misconfigurations at startup.
It doesn't: StatefulServerSet's Ensure() only waits on this timeout
in the not-found (first creation) branch; every later Update()
pushes the spec change and returns without blocking on readiness.

I wanted to have this documented here, because it's non-obvious
from the name of the constant, and one might think this would also
override the VMRebootTimeout like the global controller timeout does.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
v1.2.6 was tagged (commits 89f9817, c6ce990) without a CHANGELOG
entry. Backfilling it separately from the Unreleased section above,
which covers this PR's own change.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
The poll callback discarded the context wait.PollUntilContextTimeout
actually passes it (which is bound to the per-call timeout) and closed
over the outer, unbounded one instead, so every fn call - across all
19 call sites, not just the new vm-reboot-timeout one - ran with a
looser deadline than the timeout it was supposed to respect.

Impact is narrow in practice (a cached client Get is normally fast).
Matches how --poll-jitter-percentage/--poll-not-ready were wired in, and
leaves NewConfigurationOptions' signature untouched.
@sonarqubecloud

sonarqubecloud Bot commented Sep 2, 2026

Copy link
Copy Markdown

@ovi-ionos
ovi-ionos merged commit cd11500 into master Sep 2, 2026
11 of 12 checks passed
@ovi-ionos
ovi-ionos deleted the feat/ICNAS-875 branch September 2, 2026 13:23
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.

3 participants