fix: report Stopped phase when InferenceService.spec.replicas=0 on Metal path#498
Merged
Defilan merged 1 commit intoMay 19, 2026
Conversation
…tal path With spec.replicas=0 the metal-agent correctly tears down the runtime process, but the operator's determinePhase function had no replicas==0 branch on the Metal path, so it always returned Creating/WaitingForMetalAgent regardless of whether the user had intentionally stopped the service. The fix adds an early return in determinePhase: when desiredReplicas==0 and readyReplicas==0 it now returns PhaseStopped instead of falling through to the Metal Creating path. PhaseStopped is defined alongside the other phase constants in model_controller.go. Two regression tests cover both the generic and Metal code paths. Fixes defilantech#489 Signed-off-by: Christopher Maher <chris@mahercode.io>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
What
Report the
Stoppedphase on an InferenceService scaled tospec.replicas=0, instead ofCreating.Why
Fixes #489
When a Metal InferenceService is scaled to
spec.replicas=0, the metal-agent correctly tears down the runtime process, but the operator kept reportingCreating.determinePhasehad noreplicas==0branch, so a deliberately-stopped service was indistinguishable from one still coming up.How
determinePhase(scheduling.go): add an early return — whendesiredReplicas == 0 && readyReplicas == 0, returnStopped. It sits after thereadyReplicas > 0 -> Progressingcheck and before the Metal/generic branches, so it covers both paths.model_controller.go: add thePhaseStoppedconstant alongside the existing phase constants.Stoppedis already in thephasefield's kubebuilder enum (inferenceservice_types.go), so no CRD regeneration is needed.inferenceservice_reconcile_test.gocover the generic and Metal code paths.Checklist
make testpasses locallymake lintpasses locallygit commit -s) per DCO