Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces an explicit mode field to StormServiceSpec and StormServiceStatus to support "Replica" and "Pooled" deployment modes, with backward compatibility defaulting based on the replica count. It updates CRDs, client configurations, documentation, and the controller, while adding webhook validation to prevent invalid replica configurations in pooled mode. The review feedback highlights a critical need to make the deployment mode immutable during updates to prevent disruptive controller reconciliation errors, and suggests adding a corresponding unit test to verify this validation.
There was a problem hiding this comment.
Pull request overview
Adds an explicit spec.mode (Replica/Pooled) to the StormService API so deployment mode intent is no longer implicit/ambiguous (especially when replicas: 1). The change is reinforced via webhook defaulting/validation and surfaced via status.mode, with samples/docs updated accordingly.
Changes:
- Introduce
StormServiceMode+StormServiceSpec.ResolvedMode()and addspec.mode/status.modefields. - Mutating/validating webhook records the resolved mode and validates mode/replicas constraints; controller reports mode into status.
- Regenerate CRDs/applyconfig and update docs, samples, and webhook tests.
Reviewed changes
Copilot reviewed 10 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
api/orchestration/v1alpha1/stormservice_types.go |
Adds spec.mode, status.mode, StormServiceMode, and ResolvedMode() logic. |
pkg/webhook/stormservice_webhook.go |
Defaults spec.mode; adds mode/replicas validation and (currently) mode immutability on update. |
pkg/controller/stormservice/sync.go |
Reports resolved mode in status.mode. |
pkg/webhook/stormservice_webhook_test.go |
Adds unit tests for mode defaulting, validation, and update behavior. |
test/utils/wrapper/stormservice.go |
Adds wrapper helper to set Mode() in tests. |
test/integration/webhook/stormservice_webhook_test.go |
Updates expected defaulted StormService to include spec.mode. |
samples/autoscaling/stormservice-replica.yaml |
Explicitly sets spec.mode: Replica. |
samples/autoscaling/stormservice-pool.yaml |
Explicitly sets spec.mode: Pooled. |
docs/source/designs/aibrix-stormservice.rst |
Documents spec.mode defaulting behavior and status.mode. |
config/crd/orchestration/orchestration.aibrix.ai_stormservices.yaml |
Regenerated CRD schema including spec.mode and status.mode. |
dist/chart/crds/orchestration.aibrix.ai_stormservices.yaml |
Regenerated Helm CRD copy including spec.mode and status.mode. |
pkg/client/applyconfiguration/orchestration/v1alpha1/stormservicespec.go |
Regenerated applyconfig to include spec.mode. |
pkg/client/applyconfiguration/orchestration/v1alpha1/stormservicestatus.go |
Regenerated applyconfig to include status.mode. |
Files not reviewed (2)
- pkg/client/applyconfiguration/orchestration/v1alpha1/stormservicespec.go: Generated file
- pkg/client/applyconfiguration/orchestration/v1alpha1/stormservicestatus.go: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // The deployment mode selects the RoleSet topology the controller builds, so | ||
| // switching it on a live StormService would force a disruptive teardown and | ||
| // rebuild. Treat the resolved mode as immutable and require recreation instead. | ||
| // Comparing ResolvedMode rather than spec.Mode keeps objects created before the | ||
| // mode field existed (stored spec.mode is empty) from being rejected on updates. |
| // Mode is the resolved deployment mode the controller is operating the StormService in. | ||
| // +optional | ||
| Mode StormServiceMode `json:"mode,omitempty"` | ||
|
|
|
|
||
| // Mode is the resolved deployment mode the controller is operating the StormService in. | ||
| // +optional | ||
| Mode StormServiceMode `json:"mode,omitempty"` |
There was a problem hiding this comment.
I think we should drop status.mode from this change.
Once spec.mode exists, status.mode mostly duplicates spec.mode/ResolvedMode and creates an extra consistency contract. Since the controller still selects the execution path from
spec.updateStrategy.type in this PR, reporting status.mode as "the mode the controller is operating in" can be misleading. Keeping only spec.mode makes the API source of truth
clearer and avoids status/spec drift.
For observability, kubectl get -o yaml will already show spec.mode for newly defaulted objects. Legacy objects can still be interpreted through ResolvedMode() internally until they
are migrated.
There was a problem hiding this comment.
Dropped status.mode. Agreed it duplicates spec.mode without the controller acting on it, and ResolvedMode() covers legacy objects internally.
| // rebuild. Treat the resolved mode as immutable and require recreation instead. | ||
| // Comparing ResolvedMode rather than spec.Mode keeps objects created before the | ||
| // mode field existed (stored spec.mode is empty) from being rejected on updates. | ||
| if oldStormService.Spec.ResolvedMode() != stormService.Spec.ResolvedMode() { |
There was a problem hiding this comment.
This breaks compatibility for existing StormService objects.
For a pre-existing object without spec.mode, scaling from replicas: 1 to replicas: 3 used to be a valid operation. With this PR, ValidateUpdate rejects it as a resolved mode change.
There is also a second compatibility trap: because the mutating webhook runs on update, an old replicas: 1 object can get spec.mode defaulted to Pooled during an unrelated update, after which a later scale-up to replicas > 1 is rejected by the Pooled/replicas validation.
There was a problem hiding this comment.
Reverted the immutability check. Also dropped the spec.mode defaulting, since the second trap comes from that on its own: once Default() stamps Pooled on a replicas: 1 object, the Pooled/replicas rule blocks the later scale-up whether or not the immutability check is there. spec.mode is now user-declared only, so objects that don't set it behave exactly as before on create and update.
afb5eed to
0066fbd
Compare
| if err := validateStormServiceMode(stormService); err != nil { | ||
| return nil, err | ||
| } |
There was a problem hiding this comment.
I found one API-boundary question that may need attention here. @Jeffwan could you also take a look and confirm whether this is something we need to cover?
validateStormServiceMode() covers normal StormService create/update, but does it also cover updates through the /scale subresource?
StormService exposes /scale with specpath=.spec.replicas, so clients like kubectl scale, HPA-style controllers, or external autoscalers can update replicas via stormservices/ scale. If that admission request carries an autoscaling/v1.Scale object instead of a full StormService, this helper may not run unless the webhook is explicitly registered for and handles the scale subresource.
This was not an invariant before spec.mode existed, because replicas > 1 simply inferred Replica mode. With this PR, explicit mode: Pooled introduces a new API invariant: spec.replicas must stay <= 1. Could we either verify that the current webhook catches /scale updates, or add coverage for that path so explicit mode: Pooled cannot be scaled above 1 through the scale API?
There was a problem hiding this comment.
Reasonable concern. I kind of forget the webhook behavior but I doubt we checked the scale resource earlier. this would be some improvement we can do later.
There was a problem hiding this comment.
Agreed, leaving it out of this PR. Nothing here changes the scale path, so stormservices/scale behaves as it did before spec.mode. I can open a separate issue for CEL enforcement on StormServiceSpec if needed.
| @@ -205,11 +209,30 @@ func (r *StormServiceCustomDefaulter) ValidateCreate(ctx context.Context, obj ru | |||
| } | |||
|
|
|||
| // ValidateUpdate implements webhook.Validator so a webhook will be registered for the type | |||
There was a problem hiding this comment.
please also add case in test/integration/webhook
There was a problem hiding this comment.
Added in test/integration/webhook/stormservice_webhook_test.go: explicit Pooled with replicas: 2 rejected, explicit Pooled with one replica accepted, undeclared mode with replicas: 3 accepted, and a scale-up update on an explicit Pooled object rejected.
googs1025
left a comment
There was a problem hiding this comment.
only left two comments
|
@googs1025 do you have changes requested? Assign to you to review and approve. |
|
@V-3604 Could you please take another look at the latest comments on this PR and confirm whether anything else needs to be updated? |
Signed-off-by: Varshith <[email protected]>
Signed-off-by: Varshith <[email protected]>
Signed-off-by: Varshith <[email protected]>
0066fbd to
ced8213
Compare
|
@V-3604 are you still working on this? 😄 |
Signed-off-by: Varshith <[email protected]>
|
@googs1025 I'm sorry abut the delay. Thanks for keeping the branch rebased. |
googs1025
left a comment
There was a problem hiding this comment.
This PR introduces the explicit mode field and preserves backward compatibility. Controller/autoscaler adoption and scale-subresource enforcement are follow-ups.
…odAutoscaler Follow-ups to vllm-project#2450 outlined in vllm-project#2449: - The StormService controller now derives the rollout path from a declared spec.mode (Replica -> RollingUpdate path, Pooled -> InPlaceUpdate path) through EffectiveUpdateStrategyType. When spec.mode is unset the legacy updateStrategy.type selection is kept so existing manifests behave as before. - The webhook rejects a declared mode: Replica combined with a declared updateStrategy.type: InPlaceUpdate. The reverse combination (Pooled with RollingUpdate) is not rejected because the CRD defaults spec.updateStrategy.type to RollingUpdate whenever the updateStrategy block is present, making a user-written RollingUpdate indistinguishable from the default; the controller resolves it in favor of the declared mode and logs the override. - PodAutoscaler role-level scaling reads StormService.spec.mode as the source of truth. The autoscaling.aibrix.ai/storm-service-mode annotation is deprecated and only honored when the target StormService does not declare spec.mode. Samples and docs updated accordingly. Signed-off-by: Rishabh Sinha <[email protected]> Co-Authored-By: Claude Fable 5 <[email protected]>
Pull Request Description
StormService has no field that records its deployment mode. The controller drives behavior from
spec.updateStrategy.type(RollingUpdatefor the replica path,InPlaceUpdatefor the pooled path insync.go), and the autoscaler recovers the mode from theautoscaling.aibrix.ai/storm-service-modeannotation on thePodAutoscaler(workload_scale.go). The design doc defines the canonical rule (replicas > 1is replica mode,replicas == 1is pooled mode), but nothing on the resource encodes it, soreplicas: 1is ambiguous and role-level autoscaling needs a separate annotation to recover the intent.This adds an explicit
Modefield (ReplicaorPooled) toStormServiceSpecand keeps it optional for backward compatibility:StormServiceSpec.ResolvedMode()returnsspec.modewhen set, otherwise infers it fromspec.replicasusing the documented rule.mode: Pooledwithspec.replicas > 1on create and update, since pooled mode runs a single RoleSet and scales roles throughspec.template.spec.roles[].replicas. Only an explicitly declaredspec.modeis checked.spec.modeis not defaulted. Recording an inferred mode on an object that never declared one would pin it: a pre-existingreplicas: 1StormService would getPooledwritten during an unrelated update and then be blocked from scaling up. Objects that leavespec.modeempty keep the inferred behavior on both create and update.The field is advisory in this change: it does not alter the controller update-path selection, which still keys off
spec.updateStrategy.type. Moving the autoscaler to readspec.mode, with the annotation kept as a temporary fallback, is a focused follow-up so this stays reviewable. The design doc and thesamples/autoscalingmanifests are updated to declarespec.modeexplicitly.Generated CRDs and applyconfiguration were regenerated with the pinned
controller-genv0.16.1 andapplyconfiguration-genv0.31.8.Related Issues
Resolves: #2449
Important: Before submitting, please complete the description above and review the checklist below.
Contribution Guidelines (Expand for Details)
We appreciate your contribution to aibrix! To ensure a smooth review process and maintain high code quality, please adhere to the following guidelines:
Pull Request Title Format
Your PR title should start with one of these prefixes to indicate the nature of the change:
[Bug]: Corrections to existing functionality[CI]: Changes to build process or CI pipeline[Docs]: Updates or additions to documentation[API]: Modifications to aibrix's API or interface[CLI]: Changes or additions to the Command Line Interface[Misc]: For changes not covered above (use sparingly)Note: For changes spanning multiple categories, use multiple prefixes in order of importance.
Submission Checklist
By submitting this PR, you confirm that you've read these guidelines and your changes align with the project's contribution standards.