Unverified Commit 35c30493 authored by hhzhang16's avatar hhzhang16 Committed by GitHub
Browse files

fix: AutoApply bool --> AutoApply *bool (#6683)


Signed-off-by: default avatarHannah Zhang <hannahz@nvidia.com>
parent 626fb5dd
...@@ -253,7 +253,7 @@ class DynamoGraphDeploymentRequestSpec(BaseModel): ...@@ -253,7 +253,7 @@ class DynamoGraphDeploymentRequestSpec(BaseModel):
default="rapid", default="rapid",
description='SearchStrategy controls the profiling search depth. "rapid" performs a fast sweep; "thorough" explores more configurations.', description='SearchStrategy controls the profiling search depth. "rapid" performs a fast sweep; "thorough" explores more configurations.',
) )
autoApply: bool = Field( autoApply: Optional[bool] = Field(
default=True, default=True,
description="AutoApply indicates whether to automatically create a DynamoGraphDeployment after profiling completes. If false, the generated spec is stored in status for manual review and application.", description="AutoApply indicates whether to automatically create a DynamoGraphDeployment after profiling completes. If false, the generated spec is stored in status for manual review and application.",
) )
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
// ────────────────────────────────────────── ────────────────────────────────────── // ────────────────────────────────────────── ──────────────────────────────────────
// Spec.Model (string) Spec.Model (string) // Spec.Model (string) Spec.Model (string)
// Spec.Backend (string) Spec.Backend (BackendType) // Spec.Backend (string) Spec.Backend (BackendType)
// Spec.AutoApply (bool) Spec.AutoApply (bool) // Spec.AutoApply (bool) Spec.AutoApply (*bool)
// Spec.UseMocker (bool) Spec.Features.Mocker.Enabled (bool) // Spec.UseMocker (bool) Spec.Features.Mocker.Enabled (bool)
// Spec.ProfilingConfig.ProfilerImage Spec.Image (string) // Spec.ProfilingConfig.ProfilerImage Spec.Image (string)
// Spec.DeploymentOverrides.WorkersImage (no v1beta1 equivalent yet — TODO: overrides.dgd) // Spec.DeploymentOverrides.WorkersImage (no v1beta1 equivalent yet — TODO: overrides.dgd)
...@@ -221,7 +221,7 @@ func setAnnotation(obj *v1beta1.DynamoGraphDeploymentRequest, key, value string) ...@@ -221,7 +221,7 @@ func setAnnotation(obj *v1beta1.DynamoGraphDeploymentRequest, key, value string)
// convertDGDRSpecTo converts the v1alpha1 Spec into the v1beta1 Spec. // convertDGDRSpecTo converts the v1alpha1 Spec into the v1beta1 Spec.
func convertDGDRSpecTo(src *DynamoGraphDeploymentRequestSpec, dst *v1beta1.DynamoGraphDeploymentRequestSpec, dstObj *v1beta1.DynamoGraphDeploymentRequest) error { func convertDGDRSpecTo(src *DynamoGraphDeploymentRequestSpec, dst *v1beta1.DynamoGraphDeploymentRequestSpec, dstObj *v1beta1.DynamoGraphDeploymentRequest) error {
dst.Model = src.Model dst.Model = src.Model
dst.AutoApply = src.AutoApply dst.AutoApply = &src.AutoApply
if src.Backend != "" { if src.Backend != "" {
dst.Backend = v1beta1.BackendType(src.Backend) dst.Backend = v1beta1.BackendType(src.Backend)
...@@ -398,7 +398,11 @@ func convertDeploymentOverridesToAnnotation(src *DeploymentOverridesSpec, dstObj ...@@ -398,7 +398,11 @@ func convertDeploymentOverridesToAnnotation(src *DeploymentOverridesSpec, dstObj
// convertDGDRSpecFrom converts the v1beta1 Spec back into the v1alpha1 Spec. // convertDGDRSpecFrom converts the v1beta1 Spec back into the v1alpha1 Spec.
func convertDGDRSpecFrom(src *v1beta1.DynamoGraphDeploymentRequestSpec, dst *DynamoGraphDeploymentRequestSpec, srcObj *v1beta1.DynamoGraphDeploymentRequest) { func convertDGDRSpecFrom(src *v1beta1.DynamoGraphDeploymentRequestSpec, dst *DynamoGraphDeploymentRequestSpec, srcObj *v1beta1.DynamoGraphDeploymentRequest) {
dst.Model = src.Model dst.Model = src.Model
dst.AutoApply = src.AutoApply if src.AutoApply != nil {
dst.AutoApply = *src.AutoApply
} else {
dst.AutoApply = true // v1beta1 default
}
if src.Backend != "" { if src.Backend != "" {
dst.Backend = string(src.Backend) dst.Backend = string(src.Backend)
......
...@@ -101,6 +101,7 @@ func newV1beta1DGDR() *v1beta1.DynamoGraphDeploymentRequest { ...@@ -101,6 +101,7 @@ func newV1beta1DGDR() *v1beta1.DynamoGraphDeploymentRequest {
rawDGD, _ := json.Marshal(map[string]interface{}{"apiVersion": "nvidia.com/v1alpha1", "kind": "DynamoGraphDeployment"}) rawDGD, _ := json.Marshal(map[string]interface{}{"apiVersion": "nvidia.com/v1alpha1", "kind": "DynamoGraphDeployment"})
rawPlanner, _ := json.Marshal(map[string]interface{}{"enable_load_scaling": false}) rawPlanner, _ := json.Marshal(map[string]interface{}{"enable_load_scaling": false})
autoApplyFalse := false
return &v1beta1.DynamoGraphDeploymentRequest{ return &v1beta1.DynamoGraphDeploymentRequest{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
...@@ -110,7 +111,7 @@ func newV1beta1DGDR() *v1beta1.DynamoGraphDeploymentRequest { ...@@ -110,7 +111,7 @@ func newV1beta1DGDR() *v1beta1.DynamoGraphDeploymentRequest {
Spec: v1beta1.DynamoGraphDeploymentRequestSpec{ Spec: v1beta1.DynamoGraphDeploymentRequestSpec{
Model: "Qwen/Qwen3-32B", Model: "Qwen/Qwen3-32B",
Backend: v1beta1.BackendTypeVllm, Backend: v1beta1.BackendTypeVllm,
AutoApply: false, AutoApply: &autoApplyFalse,
Image: "nvcr.io/nvidia/dynamo:0.3.2", Image: "nvcr.io/nvidia/dynamo:0.3.2",
SLA: &v1beta1.SLASpec{ SLA: &v1beta1.SLASpec{
TTFT: &ttft, TTFT: &ttft,
...@@ -158,7 +159,7 @@ func TestConvertTo_SpecFields(t *testing.T) { ...@@ -158,7 +159,7 @@ func TestConvertTo_SpecFields(t *testing.T) {
if string(dst.Spec.Backend) != src.Spec.Backend { if string(dst.Spec.Backend) != src.Spec.Backend {
t.Errorf("Backend: got %q, want %q", dst.Spec.Backend, src.Spec.Backend) t.Errorf("Backend: got %q, want %q", dst.Spec.Backend, src.Spec.Backend)
} }
if dst.Spec.AutoApply != src.Spec.AutoApply { if dst.Spec.AutoApply == nil || *dst.Spec.AutoApply != src.Spec.AutoApply {
t.Errorf("AutoApply: got %v, want %v", dst.Spec.AutoApply, src.Spec.AutoApply) t.Errorf("AutoApply: got %v, want %v", dst.Spec.AutoApply, src.Spec.AutoApply)
} }
......
...@@ -399,7 +399,7 @@ type DynamoGraphDeploymentRequestSpec struct { ...@@ -399,7 +399,7 @@ type DynamoGraphDeploymentRequestSpec struct {
// for manual review and application. // for manual review and application.
// +optional // +optional
// +kubebuilder:default=true // +kubebuilder:default=true
AutoApply bool `json:"autoApply,omitempty"` AutoApply *bool `json:"autoApply,omitempty"`
} }
// ParetoConfig represents a single Pareto-optimal deployment configuration // ParetoConfig represents a single Pareto-optimal deployment configuration
......
...@@ -160,6 +160,11 @@ func (in *DynamoGraphDeploymentRequestSpec) DeepCopyInto(out *DynamoGraphDeploym ...@@ -160,6 +160,11 @@ func (in *DynamoGraphDeploymentRequestSpec) DeepCopyInto(out *DynamoGraphDeploym
*out = new(FeaturesSpec) *out = new(FeaturesSpec)
(*in).DeepCopyInto(*out) (*in).DeepCopyInto(*out)
} }
if in.AutoApply != nil {
in, out := &in.AutoApply, &out.AutoApply
*out = new(bool)
**out = **in
}
} }
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DynamoGraphDeploymentRequestSpec. // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DynamoGraphDeploymentRequestSpec.
......
...@@ -437,7 +437,7 @@ func (r *DynamoGraphDeploymentRequestReconciler) handleProfilingPhase(ctx contex ...@@ -437,7 +437,7 @@ func (r *DynamoGraphDeploymentRequestReconciler) handleProfilingPhase(ctx contex
} }
// If autoApply is enabled, transition to Deploying phase // If autoApply is enabled, transition to Deploying phase
if dgdr.Spec.AutoApply { if dgdr.Spec.AutoApply == nil || *dgdr.Spec.AutoApply {
logger.Info("AutoApply enabled, transitioning to Deploying phase") logger.Info("AutoApply enabled, transitioning to Deploying phase")
return r.updatePhaseWithCondition(ctx, dgdr, nvidiacomv1beta1.DGDRPhaseDeploying, nvidiacomv1beta1.ConditionTypeSpecGenerated, metav1.ConditionTrue, nvidiacomv1beta1.EventReasonSpecGenerated, MessageSpecGenerated) return r.updatePhaseWithCondition(ctx, dgdr, nvidiacomv1beta1.DGDRPhaseDeploying, nvidiacomv1beta1.ConditionTypeSpecGenerated, metav1.ConditionTrue, nvidiacomv1beta1.EventReasonSpecGenerated, MessageSpecGenerated)
} }
...@@ -460,7 +460,7 @@ func (r *DynamoGraphDeploymentRequestReconciler) handleDeployingPhase(ctx contex ...@@ -460,7 +460,7 @@ func (r *DynamoGraphDeploymentRequestReconciler) handleDeployingPhase(ctx contex
logger := log.FromContext(ctx) logger := log.FromContext(ctx)
logger.Info("Handling deploying phase", "name", dgdr.Name) logger.Info("Handling deploying phase", "name", dgdr.Name)
if !dgdr.Spec.AutoApply { if dgdr.Spec.AutoApply != nil && !*dgdr.Spec.AutoApply {
// Shouldn't be in this phase without autoApply // Shouldn't be in this phase without autoApply
logger.Info("AutoApply not enabled, transitioning to Ready") logger.Info("AutoApply not enabled, transitioning to Ready")
dgdr.Status.Phase = nvidiacomv1beta1.DGDRPhaseReady dgdr.Status.Phase = nvidiacomv1beta1.DGDRPhaseReady
......
...@@ -97,7 +97,7 @@ var _ = Describe("DynamoGraphDeploymentRequest Controller", func() { ...@@ -97,7 +97,7 @@ var _ = Describe("DynamoGraphDeploymentRequest Controller", func() {
Model: "test-model", Model: "test-model",
Backend: "vllm", Backend: "vllm",
Image: "test-profiler:latest", Image: "test-profiler:latest",
AutoApply: true, AutoApply: ptr.To(true),
Hardware: &nvidiacomv1beta1.HardwareSpec{ Hardware: &nvidiacomv1beta1.HardwareSpec{
NumGPUsPerNode: ptr.To[int32](8), NumGPUsPerNode: ptr.To[int32](8),
GPUSKU: "H100-SXM5-80GB", GPUSKU: "H100-SXM5-80GB",
...@@ -488,7 +488,7 @@ spec: ...@@ -488,7 +488,7 @@ spec:
TTFT: ptr.To(100.0), TTFT: ptr.To(100.0),
ITL: ptr.To(1500.0), ITL: ptr.To(1500.0),
}, },
AutoApply: true, AutoApply: ptr.To(true),
}, },
} }
...@@ -687,7 +687,7 @@ spec: ...@@ -687,7 +687,7 @@ spec:
TTFT: ptr.To(100.0), TTFT: ptr.To(100.0),
ITL: ptr.To(1500.0), ITL: ptr.To(1500.0),
}, },
AutoApply: true, AutoApply: ptr.To(true),
}, },
} }
...@@ -1864,7 +1864,7 @@ spec: ...@@ -1864,7 +1864,7 @@ spec:
Model: "test-model", Model: "test-model",
Backend: "vllm", Backend: "vllm",
Image: "test-profiler:latest", Image: "test-profiler:latest",
AutoApply: true, AutoApply: ptr.To(true),
Hardware: &nvidiacomv1beta1.HardwareSpec{ Hardware: &nvidiacomv1beta1.HardwareSpec{
NumGPUsPerNode: ptr.To[int32](8), NumGPUsPerNode: ptr.To[int32](8),
GPUSKU: "H100-SXM5-80GB", GPUSKU: "H100-SXM5-80GB",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment