Refactor ScaleExtender + block scale-to-zero#2
Open
s4ros wants to merge 2 commits into
Open
Conversation
Introduces a unified `dao.Scaler` interface and implementation to handle resource scaling logic, replacing direct type assertions. This simplifies the code and makes it more robust when dealing with different resource types.
When scaling a single resource, the dialog used to pre-fill the replicas field with "0" whenever both the CRD scale subresource and the READY column failed to yield a count. A user pressing OK without editing would silently scale the workload to zero. makeScaleForm now uses the empty string as an "unknown" sentinel (so a legitimately scaled-to-zero workload still pre-fills 0) and returns an error when neither read path succeeds, which the caller surfaces via the flash bar. Bulk-scale keeps the documented "0 default, must type a target" behaviour. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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
dao.Scalerinterface and implementation to replace direct type assertions inScaleExtender. Cleaner handling of different resource types.Background
The
dao.Scalerrefactor was originally bundled into the multi-tab feature branch. Reviewer flagged it as unrelated; it has been extracted here for independent review. Thefeature/tabsPR contains two revert commits that neutralise these changes there.Behavioural change in
makeScaleFormBefore: when both
replicasFromScaleSubresourceandreplicasFromReadyfailed, the dialog opened with"0"pre-filled and only aslog.Warnwas logged. Confirming without editing → workload scaled to zero.After:
""is used as the "unknown" sentinel instead of"0", so a legitimate scaled-to-zero workload still pre-fills correctly.showScaleDialogsurfaces it via the flash bar and the dialog never opens.len(fqns) > 1) keeps the documented0default — there is no single "current" value to pre-fill there, so the user must explicitly type the target.Test plan
go build ./...0correctly0default, user must type target🤖 Generated with Claude Code