feat: 5s configurable metrics refresh + per-context auth resilience - #27
Merged
Conversation
Two robustness fixes from real-cluster use. Metrics refresh: was hardcoded to 15s. Now `runtime.metrics_interval_secs` (default 5s — k9s polls every 2s; ours is bounded by metrics-server's ~15s sample resolution, so 5s is live without hammering the API on large fleets). Threaded through run()/App::new. Per-context auth resilience: a context that can't authenticate (expired SSO / exec-auth failure) no longer aborts the whole app at startup. Provider client warmup is best-effort (logs a warning, doesn't propagate), and replace_watch_plan records a per-context StateDelta::Error — surfaced as [XX] with the auth message — instead of failing the call. Other clusters stay fully usable, and the broken context recovers on a later watch tick once credentials refresh. Tests: bad-context watch plan records an error delta and returns Ok. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two robustness fixes that came out of real-cluster use.
Metrics refresh interval (configurable, default 5s)
Was hardcoded to 15s. Now
runtime.metrics_interval_secs(default 5s). k9s polls everything every 2s; ours is bounded by metrics-server's ~15s sample resolution, so 5s is noticeably more live without hammering the API on large fleets — raise it for 20-cluster/10k-pod setups if needed.Per-context auth resilience
A context that can't authenticate (expired SSO / exec-auth failure) no longer aborts startup — previously one bad context killed the whole app:
Now: provider client warmup is best-effort (logs a warning), and
replace_watch_planrecords a per-contextStateDelta::Error— shown as[XX]with the auth message — instead of failing the call. Other clusters stay fully usable; the broken context recovers on its own on a later watch tick once credentials refresh.Testing
make validategreen (110 tests + release build)🤖 Generated with Claude Code