From f811efc3b50db8245bf2faaf97fd290181d6951a Mon Sep 17 00:00:00 2001 From: "Dr. Stefan Schimanski" Date: Tue, 13 Oct 2026 13:45:40 +0200 Subject: [PATCH 1/6] operator/dgdr: refine v1beta2 API contracts Signed-off-by: Dr. Stefan Schimanski --- deploy/helm/charts/platform/README.md | 2 +- .../operator/templates/deployment.yaml | 2 +- .../platform/components/operator/values.yaml | 5 +- ...namespace_restriction_deployment_test.yaml | 6 +- deploy/helm/charts/platform/values.yaml | 5 +- .../dynamographdeploymentcandidate_types.go | 14 ---- .../dynamographdeploymentrequest_types.go | 13 +--- .../v1beta2/dynamographdeploymentrun_types.go | 10 +-- .../api/v1beta2/zz_generated.deepcopy.go | 26 ++------ deploy/operator/cmd/crd-apply/main.go | 56 ++++------------ deploy/operator/cmd/crd-apply/main_test.go | 57 ++--------------- ...a.com_dynamographdeploymentcandidates.yaml | 64 ------------------- ...dia.com_dynamographdeploymentrequests.yaml | 25 +++----- .../nvidia.com_dynamographdeploymentruns.yaml | 37 ++++------- .../kubernetes/installation/install-dynamo.md | 8 +-- .../additional-resources/api-reference-k8s.md | 14 ++-- .../kubernetes-api/full-api-reference.mdx | 25 ++------ 17 files changed, 78 insertions(+), 291 deletions(-) diff --git a/deploy/helm/charts/platform/README.md b/deploy/helm/charts/platform/README.md index ceb398d93716..d419f9ce4f53 100644 --- a/deploy/helm/charts/platform/README.md +++ b/deploy/helm/charts/platform/README.md @@ -343,7 +343,7 @@ Kubernetes: `>=1.30.0-0` | global.snapshot.install | bool | `false` | Whether this chart should install the bundled Snapshot subchart (github.com/ai-dynamo/snapshot): its operator, node agent, and CRDs. NOTE: For production environments, it is recommended to install Snapshot separately. | | dynamo-operator.enabled | bool | `true` | Whether to enable the Dynamo Kubernetes operator deployment | | dynamo-operator.upgradeCRD | bool | `true` | Whether the cluster-wide operator applies CRDs from its image through the crd-apply init container. When false, the chart installs no CRDs; apply them separately before starting a cluster-wide operator. Namespace-restricted installations must set this to false and use the CRDs managed by the cluster-wide operator. | -| dynamo-operator.featureGates.DGDRV1Beta2 | bool | `false` | EXPERIMENTAL, DEVELOPMENT CLUSTERS ONLY: Install the unfinished DGDR v1beta2 API schemas. Run and Candidate objects are persisted in etcd; incompatible schema changes may make them unreadable or block future CRD upgrades. The operator does not reconcile v1beta2 resources. | +| dynamo-operator.dgdrV1Beta2.enabled | bool | `false` | EXPERIMENTAL, DEVELOPMENT CLUSTERS ONLY: Install the unfinished DGDR v1beta2 API schemas. Run and Candidate objects are persisted in etcd; incompatible schema changes may make them unreadable or block future CRD upgrades. The operator does not reconcile v1beta2 resources. | | dynamo-operator.natsAddr | string | `""` | NATS server address for operator communication. When empty, the operator uses bundled NATS only if global.nats.install=true; otherwise NATS is not configured. Format: `nats://hostname:4222` | | dynamo-operator.etcdAddr | string | `""` | etcd server address for an external etcd instance. Only needed when using external etcd without the bundled subchart. Format: `http://hostname:2379` or `https://hostname:2379` | | dynamo-operator.modelExpressURL | string | `""` | URL for the Model Express server if not deployed by this helm chart. This is ignored if Model Express server is installed by this helm chart (global.model-express.enabled is true). | diff --git a/deploy/helm/charts/platform/components/operator/templates/deployment.yaml b/deploy/helm/charts/platform/components/operator/templates/deployment.yaml index 609bf58fd6bd..e48f5aa81aa0 100644 --- a/deploy/helm/charts/platform/components/operator/templates/deployment.yaml +++ b/deploy/helm/charts/platform/components/operator/templates/deployment.yaml @@ -75,9 +75,9 @@ spec: - "--crds-dir=/opt/dynamo-operator/crds/" - "--version={{ .Chart.AppVersion }}" - "--lpx-enabled={{ .Values.lpx.enabled }}" + - "--dgdr-v1beta2-enabled={{ .Values.dgdrV1Beta2.enabled }}" - "--conversion-webhook-service-name={{ include "dynamo-operator.fullname" . }}-webhook-service" - "--conversion-webhook-service-namespace={{ .Release.Namespace }}" - - "--feature-gates=DGDRV1Beta2={{ .Values.featureGates.DGDRV1Beta2 }}" {{- end }} containers: - args: diff --git a/deploy/helm/charts/platform/components/operator/values.yaml b/deploy/helm/charts/platform/components/operator/values.yaml index ffdd5e2f3673..3c12986dd222 100644 --- a/deploy/helm/charts/platform/components/operator/values.yaml +++ b/deploy/helm/charts/platform/components/operator/values.yaml @@ -30,8 +30,7 @@ lpx: # -- Configure the LPU model registry used by the LPX integration. modelRegistryURL: "" -# Experimental operator features. Disabled gates do not change existing stable APIs. -featureGates: +dgdrV1Beta2: # -- EXPERIMENTAL, DEVELOPMENT CLUSTERS ONLY: Install the unfinished DGDR v1beta2 # API schemas. DynamoGraphDeploymentRun and DynamoGraphDeploymentCandidate objects # created through these schemas are persisted in etcd. Incompatible schema changes @@ -39,7 +38,7 @@ featureGates: # CRD init container omits those resources and removes v1beta2 from # DynamoGraphDeploymentRequest before installation. The operator does not reconcile # v1beta2 resources. - DGDRV1Beta2: false + enabled: false # Environment variables to pass to operator Deployment. env: [] diff --git a/deploy/helm/charts/platform/tests/namespace_restriction_deployment_test.yaml b/deploy/helm/charts/platform/tests/namespace_restriction_deployment_test.yaml index a455b51249f1..41789e477c6b 100644 --- a/deploy/helm/charts/platform/tests/namespace_restriction_deployment_test.yaml +++ b/deploy/helm/charts/platform/tests/namespace_restriction_deployment_test.yaml @@ -17,7 +17,7 @@ tests: value: Deployment - contains: path: spec.template.spec.initContainers[0].args - content: --feature-gates=DGDRV1Beta2=false + content: --dgdr-v1beta2-enabled=false documentSelector: path: kind value: Deployment @@ -25,11 +25,11 @@ tests: - it: enables experimental DGDR v1beta2 CRD installation template: charts/dynamo-operator/templates/deployment.yaml set: - dynamo-operator.featureGates.DGDRV1Beta2: true + dynamo-operator.dgdrV1Beta2.enabled: true asserts: - contains: path: spec.template.spec.initContainers[0].args - content: --feature-gates=DGDRV1Beta2=true + content: --dgdr-v1beta2-enabled=true documentSelector: path: kind value: Deployment diff --git a/deploy/helm/charts/platform/values.yaml b/deploy/helm/charts/platform/values.yaml index 490a194ef2f0..cc2f9d15f8cb 100644 --- a/deploy/helm/charts/platform/values.yaml +++ b/deploy/helm/charts/platform/values.yaml @@ -76,13 +76,12 @@ dynamo-operator: # the cluster-wide operator. upgradeCRD: true - # Experimental operator features. Disabled gates do not change existing stable APIs. - featureGates: + dgdrV1Beta2: # -- EXPERIMENTAL, DEVELOPMENT CLUSTERS ONLY: Install the unfinished DGDR v1beta2 # API schemas. Run and Candidate objects are persisted in etcd; incompatible # schema changes may make them unreadable or block future CRD upgrades. The # operator does not reconcile v1beta2 resources. - DGDRV1Beta2: false + enabled: false # Environment variables to pass to operator Deployment. env: [] diff --git a/deploy/operator/api/v1beta2/dynamographdeploymentcandidate_types.go b/deploy/operator/api/v1beta2/dynamographdeploymentcandidate_types.go index 51a611cdaa46..9dd1fe007845 100644 --- a/deploy/operator/api/v1beta2/dynamographdeploymentcandidate_types.go +++ b/deploy/operator/api/v1beta2/dynamographdeploymentcandidate_types.go @@ -23,12 +23,6 @@ import ( "k8s.io/apimachinery/pkg/runtime" ) -const ( - // DynamoGraphDeploymentCandidateConditionEvaluated reports whether AISimulate - // successfully evaluated the candidate. - DynamoGraphDeploymentCandidateConditionEvaluated = "Evaluated" -) - // DynamoGraphDeploymentCandidateStatus describes evaluation, never deployment health. type DynamoGraphDeploymentCandidateStatus struct { // Metrics are the resolved evaluation metrics for this point. @@ -36,13 +30,6 @@ type DynamoGraphDeploymentCandidateStatus struct { // +kubebuilder:pruning:PreserveUnknownFields // +kubebuilder:validation:Type=object Metrics *runtime.RawExtension `json:"metrics,omitempty"` - - // Conditions includes the Evaluated condition, whose observedGeneration - // identifies the candidate spec generation represented by metrics. - // +optional - // +listType=map - // +listMapKey=type - Conditions []metav1.Condition `json:"conditions,omitempty"` } // DynamoGraphDeploymentCandidateSpec is an immutable evaluated point: the @@ -60,7 +47,6 @@ type DynamoGraphDeploymentCandidateSpec struct { // +kubebuilder:subresource:status // +kubebuilder:resource:shortName=dgdc // +kubebuilder:validation:XValidation:rule="!has(oldSelf.spec) || self.spec == oldSelf.spec",message="spec is immutable" -// +kubebuilder:printcolumn:name="Evaluated",type=string,JSONPath=`.status.conditions[?(@.type=="Evaluated")].status` // +kubebuilder:printcolumn:name="Backend",type=string,JSONPath=`.spec.backendFramework` // +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` diff --git a/deploy/operator/api/v1beta2/dynamographdeploymentrequest_types.go b/deploy/operator/api/v1beta2/dynamographdeploymentrequest_types.go index 4a76ab6b1f26..869c6728d799 100644 --- a/deploy/operator/api/v1beta2/dynamographdeploymentrequest_types.go +++ b/deploy/operator/api/v1beta2/dynamographdeploymentrequest_types.go @@ -67,7 +67,6 @@ type KVLoadRatio []float64 // StaticWorkloadSpec defines one of AISimulate's synthetic workload shapes. // +kubebuilder:validation:XValidation:rule="(has(self.requestRate) ? 1 : 0) + (has(self.concurrency) ? 1 : 0) + (has(self.kvLoadRatio) ? 1 : 0) <= 1",message="at most one of requestRate, concurrency, or kvLoadRatio may be specified" -// +kubebuilder:validation:XValidation:rule="!(has(self.requestCount) && has(self.numRequestRatio))",message="requestCount and numRequestRatio are mutually exclusive" type StaticWorkloadSpec struct { // ISL is the input sequence length in tokens. // +optional @@ -79,12 +78,6 @@ type StaticWorkloadSpec struct { // +kubebuilder:validation:Minimum=1 OSL *int32 `json:"osl,omitempty"` - // RequestCount is the absolute number of requests evaluated. When both - // request-count controls are omitted, the execution underlay supplies its default. - // +optional - // +kubebuilder:validation:Minimum=1 - RequestCount *int64 `json:"requestCount,omitempty"` - // NumRequestRatio sets request count relative to the selected load. // +optional // +kubebuilder:validation:ExclusiveMinimum=true @@ -128,7 +121,7 @@ const ( ) // ObjectiveMetric is a metric optimized by AISimulate. -// +kubebuilder:validation:Enum=Throughput;ThroughputPerGPU;ThroughputPerUser;TTFT;E2ELatency;Goodput;GoodputPerGPU +// +kubebuilder:validation:Enum=Throughput;ThroughputPerGpu;ThroughputPerUser;TTFT;E2ELatency;Goodput;GoodputPerGpu type ObjectiveMetric string // ObjectiveSLASpec defines per-request latency bounds used to calculate goodput. @@ -156,8 +149,8 @@ type ObjectiveSLASpec struct { // ObjectiveSpec defines scalar optimization or a multi-objective Pareto search. // +kubebuilder:validation:XValidation:rule="(self.mode == 'Optimize' && has(self.metric) && !has(self.metrics)) || (self.mode == 'Pareto' && !has(self.metric) && has(self.metrics))",message="Optimize requires metric; Pareto requires metrics" -// +kubebuilder:validation:XValidation:rule="!(has(self.metric) && self.metric in ['Goodput', 'GoodputPerGPU']) || (has(self.sla) && (has(self.sla.ttftMs) || has(self.sla.itlMs) || has(self.sla.e2eMs)))",message="Goodput and GoodputPerGPU require at least one SLA bound" -// +kubebuilder:validation:XValidation:rule="!(has(self.metrics) && self.metrics.exists(m, m in ['Goodput', 'GoodputPerGPU'])) || (has(self.sla) && (has(self.sla.ttftMs) || has(self.sla.itlMs) || has(self.sla.e2eMs)))",message="Pareto metrics containing Goodput or GoodputPerGPU require at least one SLA bound" +// +kubebuilder:validation:XValidation:rule="!(has(self.metric) && self.metric in ['Goodput', 'GoodputPerGpu']) || (has(self.sla) && (has(self.sla.ttftMs) || has(self.sla.itlMs) || has(self.sla.e2eMs)))",message="Goodput and GoodputPerGpu require at least one SLA bound" +// +kubebuilder:validation:XValidation:rule="!(has(self.metrics) && self.metrics.exists(m, m in ['Goodput', 'GoodputPerGpu'])) || (has(self.sla) && (has(self.sla.ttftMs) || has(self.sla.itlMs) || has(self.sla.e2eMs)))",message="Pareto metrics containing Goodput or GoodputPerGpu require at least one SLA bound" type ObjectiveSpec struct { // Mode selects scalar optimization or a Pareto search. // +optional diff --git a/deploy/operator/api/v1beta2/dynamographdeploymentrun_types.go b/deploy/operator/api/v1beta2/dynamographdeploymentrun_types.go index 23efcd3b24d2..6e6e856a626a 100644 --- a/deploy/operator/api/v1beta2/dynamographdeploymentrun_types.go +++ b/deploy/operator/api/v1beta2/dynamographdeploymentrun_types.go @@ -57,10 +57,10 @@ type RoundProgress struct { Total int32 `json:"total"` } -// BranchProgress reports progress for one independently optimized backend and topology branch. +// BranchProgress reports progress for one AISimulate deployment-mode branch. type BranchProgress struct { - // Name is the stable branch identifier chosen by the executor. - Name string `json:"name"` + // DeploymentMode identifies the AISimulate search-space deployment mode. + DeploymentMode string `json:"deploymentMode"` // Rounds reports optimizer progress for this branch. Rounds RoundProgress `json:"rounds"` @@ -101,10 +101,10 @@ type CandidateProgress struct { // DGDRRunProgress contains branch-aware optimizer and evaluation outcome counters. type DGDRRunProgress struct { - // Branches reports each independently optimized backend and topology branch. + // Branches reports independently optimized AISimulate deployment modes. // +optional // +listType=map - // +listMapKey=name + // +listMapKey=deploymentMode Branches []BranchProgress `json:"branches,omitempty"` // Evaluations reports unique candidate outcomes. diff --git a/deploy/operator/api/v1beta2/zz_generated.deepcopy.go b/deploy/operator/api/v1beta2/zz_generated.deepcopy.go index af79d81c2028..a4ad582d9ea9 100644 --- a/deploy/operator/api/v1beta2/zz_generated.deepcopy.go +++ b/deploy/operator/api/v1beta2/zz_generated.deepcopy.go @@ -38,8 +38,8 @@ limitations under the License. package v1beta2 import ( - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" ) @@ -208,13 +208,6 @@ func (in *DynamoGraphDeploymentCandidateStatus) DeepCopyInto(out *DynamoGraphDep *out = new(runtime.RawExtension) (*in).DeepCopyInto(*out) } - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]v1.Condition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DynamoGraphDeploymentCandidateStatus. @@ -337,17 +330,17 @@ func (in *DynamoGraphDeploymentRequestStatus) DeepCopyInto(out *DynamoGraphDeplo *out = *in if in.ActiveRunRef != nil { in, out := &in.ActiveRunRef, &out.ActiveRunRef - *out = new(corev1.LocalObjectReference) + *out = new(v1.LocalObjectReference) **out = **in } if in.RecentRunRefs != nil { in, out := &in.RecentRunRefs, &out.RecentRunRefs - *out = make([]corev1.LocalObjectReference, len(*in)) + *out = make([]v1.LocalObjectReference, len(*in)) copy(*out, *in) } if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions - *out = make([]v1.Condition, len(*in)) + *out = make([]metav1.Condition, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -438,7 +431,7 @@ func (in *DynamoGraphDeploymentRunStatus) DeepCopyInto(out *DynamoGraphDeploymen } if in.CandidateRefs != nil { in, out := &in.CandidateRefs, &out.CandidateRefs - *out = make([]corev1.LocalObjectReference, len(*in)) + *out = make([]v1.LocalObjectReference, len(*in)) copy(*out, *in) } if in.StartTime != nil { @@ -455,7 +448,7 @@ func (in *DynamoGraphDeploymentRunStatus) DeepCopyInto(out *DynamoGraphDeploymen } if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions - *out = make([]v1.Condition, len(*in)) + *out = make([]metav1.Condition, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -670,11 +663,6 @@ func (in *StaticWorkloadSpec) DeepCopyInto(out *StaticWorkloadSpec) { *out = new(int32) **out = **in } - if in.RequestCount != nil { - in, out := &in.RequestCount, &out.RequestCount - *out = new(int64) - **out = **in - } if in.NumRequestRatio != nil { in, out := &in.NumRequestRatio, &out.NumRequestRatio *out = new(float64) diff --git a/deploy/operator/cmd/crd-apply/main.go b/deploy/operator/cmd/crd-apply/main.go index 9ac5d0f5a3a8..5c1f6705ebf9 100644 --- a/deploy/operator/cmd/crd-apply/main.go +++ b/deploy/operator/cmd/crd-apply/main.go @@ -26,9 +26,10 @@ import ( ) const ( - fieldManager = "dynamo-crd-apply" - versionAnnotation = "dynamo.nvidia.com/operator-version" - dgdrV1Beta2Gate = "DGDRV1Beta2" + fieldManager = "dynamo-crd-apply" + versionAnnotation = "dynamo.nvidia.com/operator-version" + dgdrV1Beta2Flag = "dgdr-v1beta2-enabled" + dgdrV1Beta2Version = "v1beta2" dgdrCRDName = "dynamographdeploymentrequests.nvidia.com" dgdrRunCRDName = "dynamographdeploymentruns.nvidia.com" @@ -39,6 +40,7 @@ func main() { crdsDir := flag.String("crds-dir", "/opt/dynamo-operator/crds/", "Directory containing CRD YAML files") version := flag.String("version", "", "Operator version to stamp on CRDs") lpxEnabled := flag.Bool("lpx-enabled", false, "Install the experimental LPXGraphDeployment CRD") + dgdrV1Beta2Enabled := flag.Bool(dgdrV1Beta2Flag, false, "Install the experimental DGDR v1beta2 API schemas") conversionWebhookServiceName := flag.String( "conversion-webhook-service-name", "", @@ -49,27 +51,16 @@ func main() { "", "Service namespace for CRD conversion webhooks", ) - featureGates := flag.String( - "feature-gates", - "", - "Comma-separated feature gates in Name=true|false form", - ) flag.Parse() - gates, err := parseFeatureGates(*featureGates) - if err != nil { - fmt.Fprintf(os.Stderr, "invalid feature gates: %v\n", err) - os.Exit(1) - } - ctrl.SetLogger(zap.New(zap.UseDevMode(true))) log := ctrl.Log.WithName("crd-apply") - if gates[dgdrV1Beta2Gate] { + if *dgdrV1Beta2Enabled { log.Info( "WARNING: enabled experimental DGDR v1beta2 API schemas; use only on development clusters. "+ "DynamoGraphDeploymentRun and DynamoGraphDeploymentCandidate objects are persisted in etcd, "+ "and incompatible schema changes may block future CRD upgrades", - "featureGate", dgdrV1Beta2Gate, + "flag", dgdrV1Beta2Flag, ) } @@ -114,8 +105,8 @@ func main() { if crd.Name == "lpxgraphdeployments.nvidia.com" && !*lpxEnabled { continue } - if !gates[dgdrV1Beta2Gate] && !configureDGDRV1Beta2CRD(crd) { - log.Info("Skipped CRD disabled by feature gate", "crd", crd.Name, "featureGate", dgdrV1Beta2Gate) + if !*dgdrV1Beta2Enabled && !configureDGDRV1Beta2CRD(crd) { + log.Info("Skipped disabled experimental CRD", "crd", crd.Name, "flag", dgdrV1Beta2Flag) continue } @@ -168,32 +159,7 @@ func main() { log.Info("CRD apply complete", "applied", applied) } -func parseFeatureGates(value string) (map[string]bool, error) { - gates := map[string]bool{dgdrV1Beta2Gate: false} - if value == "" { - return gates, nil - } - for _, item := range strings.Split(value, ",") { - name, rawValue, found := strings.Cut(item, "=") - if !found || name == "" { - return nil, fmt.Errorf("%q must use Name=true|false format", item) - } - if _, known := gates[name]; !known { - return nil, fmt.Errorf("unknown feature gate %q", name) - } - switch rawValue { - case "true": - gates[name] = true - case "false": - gates[name] = false - default: - return nil, fmt.Errorf("feature gate %q must be true or false", name) - } - } - return gates, nil -} - -// configureDGDRV1Beta2CRD removes experimental API discovery when the gate is disabled. +// configureDGDRV1Beta2CRD removes experimental API discovery when the flag is disabled. // Existing standalone CRDs are skipped, not deleted, to avoid destructive upgrades. func configureDGDRV1Beta2CRD(crd *apiextensionsv1.CustomResourceDefinition) bool { switch crd.Name { @@ -203,7 +169,7 @@ func configureDGDRV1Beta2CRD(crd *apiextensionsv1.CustomResourceDefinition) bool crd.Spec.Versions = slices.DeleteFunc( crd.Spec.Versions, func(version apiextensionsv1.CustomResourceDefinitionVersion) bool { - return version.Name == "v1beta2" + return version.Name == dgdrV1Beta2Version }, ) } diff --git a/deploy/operator/cmd/crd-apply/main_test.go b/deploy/operator/cmd/crd-apply/main_test.go index 2ce10271c93d..2a0e644a59a8 100644 --- a/deploy/operator/cmd/crd-apply/main_test.go +++ b/deploy/operator/cmd/crd-apply/main_test.go @@ -188,40 +188,6 @@ func TestCRDApplyInstallsGeneratedSchemas(t *testing.T) { } } -func TestParseFeatureGates(t *testing.T) { - tests := []struct { - name string - value string - enabled bool - wantErr bool - }{ - {name: "default disabled"}, - {name: "explicitly enabled", value: "DGDRV1Beta2=true", enabled: true}, - {name: "explicitly disabled", value: "DGDRV1Beta2=false"}, - {name: "unknown gate", value: "Unknown=true", wantErr: true}, - {name: "invalid value", value: "DGDRV1Beta2=yes", wantErr: true}, - {name: "missing value", value: "DGDRV1Beta2", wantErr: true}, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - gates, err := parseFeatureGates(tt.value) - if tt.wantErr { - if err == nil { - t.Fatal("parseFeatureGates() succeeded, want error") - } - return - } - if err != nil { - t.Fatalf("parseFeatureGates() error = %v", err) - } - if got := gates[dgdrV1Beta2Gate]; got != tt.enabled { - t.Fatalf("%s = %v, want %v", dgdrV1Beta2Gate, got, tt.enabled) - } - }) - } -} - func TestConfigureGeneratedDGDRV1Beta2CRDs(t *testing.T) { tests := []struct { file string @@ -389,14 +355,6 @@ func TestGeneratedDGDRV1Beta2RequestSchema(t *testing.T) { mutate func(map[string]interface{}) wantErr bool }{ - { - name: "request count", - mutate: func(object map[string]interface{}) { - static := requestStaticWorkload(object) - delete(static, "numRequestRatio") - static["requestCount"] = int64(100) - }, - }, { name: "ratio below one", mutate: func(object map[string]interface{}) { @@ -433,7 +391,7 @@ func TestGeneratedDGDRV1Beta2RequestSchema(t *testing.T) { objective := requestObjective(object) objective["mode"] = "Pareto" delete(objective, "metric") - objective["metrics"] = []interface{}{"ThroughputPerGPU", "TTFT"} + objective["metrics"] = []interface{}{"ThroughputPerGpu", "TTFT"} }, }, { @@ -447,14 +405,7 @@ func TestGeneratedDGDRV1Beta2RequestSchema(t *testing.T) { wantErr: true, }, { - name: "both request count controls", - mutate: func(object map[string]interface{}) { - requestStaticWorkload(object)["requestCount"] = int64(100) - }, - wantErr: true, - }, - { - name: "omitted request count uses underlay default", + name: "omitted request ratio uses underlay default", mutate: func(object map[string]interface{}) { static := requestStaticWorkload(object) delete(static, "numRequestRatio") @@ -544,7 +495,7 @@ func TestGeneratedDGDRV1Beta2ResultSchemas(t *testing.T) { require.Contains(t, spec.Required, "parameters") require.Contains(t, spec.Properties, "parameters") require.Contains(t, status.Properties, "metrics") - require.Contains(t, status.Properties, "conditions") + require.NotContains(t, status.Properties, "conditions") require.NotContains(t, status.Properties, "rank") require.NotContains(t, status.Properties, "experimental") }, @@ -600,7 +551,7 @@ func validDGDRV1Beta2Request() map[string]interface{} { }, "objective": map[string]interface{}{ "mode": "Optimize", - "metric": "ThroughputPerGPU", + "metric": "ThroughputPerGpu", "sla": map[string]interface{}{}, }, "recommendation": map[string]interface{}{ diff --git a/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentcandidates.yaml b/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentcandidates.yaml index afdad5a3139a..6fafcaee0059 100644 --- a/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentcandidates.yaml +++ b/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentcandidates.yaml @@ -21,9 +21,6 @@ spec: scope: Namespaced versions: - additionalPrinterColumns: - - jsonPath: .status.conditions[?(@.type=="Evaluated")].status - name: Evaluated - type: string - jsonPath: .spec.backendFramework name: Backend type: string @@ -17519,67 +17516,6 @@ spec: status: description: DynamoGraphDeploymentCandidateStatus describes evaluation, never deployment health. properties: - conditions: - description: |- - Conditions includes the Evaluated condition, whose observedGeneration - identifies the candidate spec generation represented by metrics. - items: - description: Condition contains details for one aspect of the current state of this API Resource. - properties: - lastTransitionTime: - description: |- - lastTransitionTime is the last time the condition transitioned from one status to another. - This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. - format: date-time - type: string - message: - description: |- - message is a human readable message indicating details about the transition. - This may be an empty string. - maxLength: 32768 - type: string - observedGeneration: - description: |- - observedGeneration represents the .metadata.generation that the condition was set based upon. - For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date - with respect to the current state of the instance. - format: int64 - minimum: 0 - type: integer - reason: - description: |- - reason contains a programmatic identifier indicating the reason for the condition's last transition. - Producers of specific condition types may define expected values and meanings for this field, - and whether the values are considered a guaranteed API. - The value should be a CamelCase string. - This field may not be empty. - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - type: string - status: - description: status of the condition, one of True, False, Unknown. - enum: - - "True" - - "False" - - Unknown - type: string - type: - description: type of condition in CamelCase or in foo.example.com/CamelCase. - maxLength: 316 - pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ - type: string - required: - - lastTransitionTime - - message - - reason - - status - - type - type: object - type: array - x-kubernetes-list-map-keys: - - type - x-kubernetes-list-type: map metrics: description: Metrics are the resolved evaluation metrics for this point. type: object diff --git a/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentrequests.yaml b/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentrequests.yaml index dae24b02f0e8..e6c06f88a21c 100644 --- a/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentrequests.yaml +++ b/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentrequests.yaml @@ -9621,12 +9621,12 @@ spec: description: Metric is the scalar target when mode is Optimize. enum: - Throughput - - ThroughputPerGPU + - ThroughputPerGpu - ThroughputPerUser - TTFT - E2ELatency - Goodput - - GoodputPerGPU + - GoodputPerGpu type: string metrics: description: Metrics lists two or more distinct scalar targets when mode is Pareto. @@ -9634,12 +9634,12 @@ spec: description: ObjectiveMetric is a metric optimized by AISimulate. enum: - Throughput - - ThroughputPerGPU + - ThroughputPerGpu - ThroughputPerUser - TTFT - E2ELatency - Goodput - - GoodputPerGPU + - GoodputPerGpu type: string minItems: 2 type: array @@ -9680,10 +9680,10 @@ spec: x-kubernetes-validations: - message: Optimize requires metric; Pareto requires metrics rule: (self.mode == 'Optimize' && has(self.metric) && !has(self.metrics)) || (self.mode == 'Pareto' && !has(self.metric) && has(self.metrics)) - - message: Goodput and GoodputPerGPU require at least one SLA bound - rule: '!(has(self.metric) && self.metric in [''Goodput'', ''GoodputPerGPU'']) || (has(self.sla) && (has(self.sla.ttftMs) || has(self.sla.itlMs) || has(self.sla.e2eMs)))' - - message: Pareto metrics containing Goodput or GoodputPerGPU require at least one SLA bound - rule: '!(has(self.metrics) && self.metrics.exists(m, m in [''Goodput'', ''GoodputPerGPU''])) || (has(self.sla) && (has(self.sla.ttftMs) || has(self.sla.itlMs) || has(self.sla.e2eMs)))' + - message: Goodput and GoodputPerGpu require at least one SLA bound + rule: '!(has(self.metric) && self.metric in [''Goodput'', ''GoodputPerGpu'']) || (has(self.sla) && (has(self.sla.ttftMs) || has(self.sla.itlMs) || has(self.sla.e2eMs)))' + - message: Pareto metrics containing Goodput or GoodputPerGpu require at least one SLA bound + rule: '!(has(self.metrics) && self.metrics.exists(m, m in [''Goodput'', ''GoodputPerGpu''])) || (has(self.sla) && (has(self.sla.ttftMs) || has(self.sla.itlMs) || has(self.sla.e2eMs)))' recommendation: default: {} description: Recommendation controls bounded projection into DGDC resources. @@ -9746,13 +9746,6 @@ spec: format: int32 minimum: 1 type: integer - requestCount: - description: |- - RequestCount is the absolute number of requests evaluated. When both - request-count controls are omitted, the execution underlay supplies its default. - format: int64 - minimum: 1 - type: integer requestRate: description: RequestRate is a fixed open-loop arrival rate in requests per second. exclusiveMinimum: true @@ -9762,8 +9755,6 @@ spec: x-kubernetes-validations: - message: at most one of requestRate, concurrency, or kvLoadRatio may be specified rule: '(has(self.requestRate) ? 1 : 0) + (has(self.concurrency) ? 1 : 0) + (has(self.kvLoadRatio) ? 1 : 0) <= 1' - - message: requestCount and numRequestRatio are mutually exclusive - rule: '!(has(self.requestCount) && has(self.numRequestRatio))' type: object required: - model diff --git a/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentruns.yaml b/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentruns.yaml index f9cf13fca418..c7855331e0fb 100644 --- a/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentruns.yaml +++ b/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentruns.yaml @@ -134,12 +134,12 @@ spec: description: Metric is the scalar target when mode is Optimize. enum: - Throughput - - ThroughputPerGPU + - ThroughputPerGpu - ThroughputPerUser - TTFT - E2ELatency - Goodput - - GoodputPerGPU + - GoodputPerGpu type: string metrics: description: Metrics lists two or more distinct scalar targets when mode is Pareto. @@ -147,12 +147,12 @@ spec: description: ObjectiveMetric is a metric optimized by AISimulate. enum: - Throughput - - ThroughputPerGPU + - ThroughputPerGpu - ThroughputPerUser - TTFT - E2ELatency - Goodput - - GoodputPerGPU + - GoodputPerGpu type: string minItems: 2 type: array @@ -193,10 +193,10 @@ spec: x-kubernetes-validations: - message: Optimize requires metric; Pareto requires metrics rule: (self.mode == 'Optimize' && has(self.metric) && !has(self.metrics)) || (self.mode == 'Pareto' && !has(self.metric) && has(self.metrics)) - - message: Goodput and GoodputPerGPU require at least one SLA bound - rule: '!(has(self.metric) && self.metric in [''Goodput'', ''GoodputPerGPU'']) || (has(self.sla) && (has(self.sla.ttftMs) || has(self.sla.itlMs) || has(self.sla.e2eMs)))' - - message: Pareto metrics containing Goodput or GoodputPerGPU require at least one SLA bound - rule: '!(has(self.metrics) && self.metrics.exists(m, m in [''Goodput'', ''GoodputPerGPU''])) || (has(self.sla) && (has(self.sla.ttftMs) || has(self.sla.itlMs) || has(self.sla.e2eMs)))' + - message: Goodput and GoodputPerGpu require at least one SLA bound + rule: '!(has(self.metric) && self.metric in [''Goodput'', ''GoodputPerGpu'']) || (has(self.sla) && (has(self.sla.ttftMs) || has(self.sla.itlMs) || has(self.sla.e2eMs)))' + - message: Pareto metrics containing Goodput or GoodputPerGpu require at least one SLA bound + rule: '!(has(self.metrics) && self.metrics.exists(m, m in [''Goodput'', ''GoodputPerGpu''])) || (has(self.sla) && (has(self.sla.ttftMs) || has(self.sla.itlMs) || has(self.sla.e2eMs)))' recommendation: default: {} description: Recommendation controls bounded projection into DGDC resources. @@ -259,13 +259,6 @@ spec: format: int32 minimum: 1 type: integer - requestCount: - description: |- - RequestCount is the absolute number of requests evaluated. When both - request-count controls are omitted, the execution underlay supplies its default. - format: int64 - minimum: 1 - type: integer requestRate: description: RequestRate is a fixed open-loop arrival rate in requests per second. exclusiveMinimum: true @@ -275,8 +268,6 @@ spec: x-kubernetes-validations: - message: at most one of requestRate, concurrency, or kvLoadRatio may be specified rule: '(has(self.requestRate) ? 1 : 0) + (has(self.concurrency) ? 1 : 0) + (has(self.kvLoadRatio) ? 1 : 0) <= 1' - - message: requestCount and numRequestRatio are mutually exclusive - rule: '!(has(self.requestCount) && has(self.numRequestRatio))' type: object required: - model @@ -398,12 +389,12 @@ spec: description: Progress contains branch-aware optimizer and evaluation outcome counters. properties: branches: - description: Branches reports each independently optimized backend and topology branch. + description: Branches reports independently optimized AISimulate deployment modes. items: - description: BranchProgress reports progress for one independently optimized backend and topology branch. + description: BranchProgress reports progress for one AISimulate deployment-mode branch. properties: - name: - description: Name is the stable branch identifier chosen by the executor. + deploymentMode: + description: DeploymentMode identifies the AISimulate search-space deployment mode. type: string rounds: description: Rounds reports optimizer progress for this branch. @@ -421,12 +412,12 @@ spec: - total type: object required: - - name + - deploymentMode - rounds type: object type: array x-kubernetes-list-map-keys: - - name + - deploymentMode x-kubernetes-list-type: map candidates: description: Candidates reports bounded Kubernetes publication. diff --git a/docs/fern/pages/kubernetes/installation/install-dynamo.md b/docs/fern/pages/kubernetes/installation/install-dynamo.md index 32a84e2ea7bd..fef9af6dd328 100644 --- a/docs/fern/pages/kubernetes/installation/install-dynamo.md +++ b/docs/fern/pages/kubernetes/installation/install-dynamo.md @@ -154,17 +154,17 @@ helm install dynamo-platform dynamo-platform-$RELEASE_VERSION.tgz \ > [!WARNING] > **Experimental. Development clusters only.** The unfinished DGDR v1beta2 schemas are disabled by > default. To install them for API development, add -> `--set "dynamo-operator.featureGates.DGDRV1Beta2=true"` to the Helm command. -> The gate adds the v1beta2 `DynamoGraphDeploymentRequest` schema and installs the +> `--set "dynamo-operator.dgdrV1Beta2.enabled=true"` to the Helm command. +> The flag adds the v1beta2 `DynamoGraphDeploymentRequest` schema and installs the > `DynamoGraphDeploymentRun` and `DynamoGraphDeploymentCandidate` Custom Resource Definitions > (CRDs). It does not enable v1beta2 reconciliation, so the operator does not process resources > created with these schemas. > > Kubernetes persists Run and Candidate objects in etcd. Because the schemas are not finalized, > later schema changes can make stored objects unreadable or prevent a CRD upgrade. Do not enable -> this gate on production or shared clusters. +> this API on production or shared clusters. > -> Disabling the gate on a later Helm upgrade stops updating the experimental schemas but does not +> Disabling the flag on a later Helm upgrade stops updating the experimental schemas but does not > delete CRDs that were previously installed. Remove those CRDs manually only after confirming > that they contain no resources. diff --git a/docs/fern/pages/reference/kubernetes-api/additional-resources/api-reference-k8s.md b/docs/fern/pages/reference/kubernetes-api/additional-resources/api-reference-k8s.md index 5e0d6a69a21b..f38d7ecb22a1 100644 --- a/docs/fern/pages/reference/kubernetes-api/additional-resources/api-reference-k8s.md +++ b/docs/fern/pages/reference/kubernetes-api/additional-resources/api-reference-k8s.md @@ -3149,7 +3149,7 @@ _Appears in:_ -BranchProgress reports progress for one independently optimized backend and topology branch. +BranchProgress reports progress for one AISimulate deployment-mode branch. @@ -3158,7 +3158,7 @@ _Appears in:_ | Field | Description | Default | Validation | | --- | --- | --- | --- | -| `name` _string_ | Name is the stable branch identifier chosen by the executor. | | | +| `deploymentMode` _string_ | DeploymentMode identifies the AISimulate search-space deployment mode. | | | | `rounds` _[RoundProgress](#roundprogress)_ | Rounds reports optimizer progress for this branch. | | | @@ -3212,7 +3212,7 @@ _Appears in:_ | Field | Description | Default | Validation | | --- | --- | --- | --- | -| `branches` _[BranchProgress](#branchprogress) array_ | Branches reports each independently optimized backend and topology branch. | | Optional: \{\}
| +| `branches` _[BranchProgress](#branchprogress) array_ | Branches reports independently optimized AISimulate deployment modes. | | Optional: \{\}
| | `evaluations` _[EvaluationProgress](#evaluationprogress)_ | Evaluations reports unique candidate outcomes. | | Optional: \{\}
| | `candidates` _[CandidateProgress](#candidateprogress)_ | Candidates reports bounded Kubernetes publication. | | Optional: \{\}
| @@ -3277,7 +3277,6 @@ _Appears in:_ | Field | Description | Default | Validation | | --- | --- | --- | --- | | `metrics` _[RawExtension](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#rawextension-runtime-pkg)_ | Metrics are the resolved evaluation metrics for this point. | | Type: object
Optional: \{\}
| -| `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#condition-v1-meta) array_ | Conditions includes the Evaluated condition, whose observedGeneration
identifies the candidate spec generation represented by metrics. | | Optional: \{\}
| #### DynamoGraphDeploymentRequest @@ -3480,7 +3479,7 @@ _Underlying type:_ _string_ ObjectiveMetric is a metric optimized by AISimulate. _Validation:_ -- Enum: [Throughput ThroughputPerGPU ThroughputPerUser TTFT E2ELatency Goodput GoodputPerGPU] +- Enum: [Throughput ThroughputPerGpu ThroughputPerUser TTFT E2ELatency Goodput GoodputPerGpu] _Appears in:_ - [ObjectiveSpec](#objectivespec) @@ -3538,8 +3537,8 @@ _Appears in:_ | Field | Description | Default | Validation | | --- | --- | --- | --- | | `mode` _[ObjectiveMode](#objectivemode)_ | Mode selects scalar optimization or a Pareto search. | Optimize | Enum: [Optimize Pareto]
Optional: \{\}
| -| `metric` _[ObjectiveMetric](#objectivemetric)_ | Metric is the scalar target when mode is Optimize. | | Enum: [Throughput ThroughputPerGPU ThroughputPerUser TTFT E2ELatency Goodput GoodputPerGPU]
Optional: \{\}
| -| `metrics` _[ObjectiveMetric](#objectivemetric) array_ | Metrics lists two or more distinct scalar targets when mode is Pareto. | | Enum: [Throughput ThroughputPerGPU ThroughputPerUser TTFT E2ELatency Goodput GoodputPerGPU]
MinItems: 2
Optional: \{\}
| +| `metric` _[ObjectiveMetric](#objectivemetric)_ | Metric is the scalar target when mode is Optimize. | | Enum: [Throughput ThroughputPerGpu ThroughputPerUser TTFT E2ELatency Goodput GoodputPerGpu]
Optional: \{\}
| +| `metrics` _[ObjectiveMetric](#objectivemetric) array_ | Metrics lists two or more distinct scalar targets when mode is Pareto. | | Enum: [Throughput ThroughputPerGpu ThroughputPerUser TTFT E2ELatency Goodput GoodputPerGpu]
MinItems: 2
Optional: \{\}
| | `sla` _[ObjectiveSLASpec](#objectiveslaspec)_ | SLA defines per-request latency bounds used to calculate goodput. | \{ itlMs:30 ttftMs:2000 \} | Optional: \{\}
| @@ -3608,7 +3607,6 @@ _Appears in:_ | --- | --- | --- | --- | | `isl` _integer_ | ISL is the input sequence length in tokens. | | Minimum: 1
Optional: \{\}
| | `osl` _integer_ | OSL is the output sequence length in tokens. | | Minimum: 1
Optional: \{\}
| -| `requestCount` _integer_ | RequestCount is the absolute number of requests evaluated. When both
request-count controls are omitted, the execution underlay supplies its default. | | Minimum: 1
Optional: \{\}
| | `numRequestRatio` _float_ | NumRequestRatio sets request count relative to the selected load. | | ExclusiveMinimum: true
Minimum: 0
Optional: \{\}
| | `requestRate` _float_ | RequestRate is a fixed open-loop arrival rate in requests per second. | | ExclusiveMinimum: true
Minimum: 0
Optional: \{\}
| | `concurrency` _integer_ | Concurrency is a fixed closed-loop in-flight request cap. | | Minimum: 1
Optional: \{\}
| diff --git a/docs/fern/pages/reference/kubernetes-api/full-api-reference.mdx b/docs/fern/pages/reference/kubernetes-api/full-api-reference.mdx index 39ecb9c028e5..b65b02c78d11 100644 --- a/docs/fern/pages/reference/kubernetes-api/full-api-reference.mdx +++ b/docs/fern/pages/reference/kubernetes-api/full-api-reference.mdx @@ -4315,14 +4315,14 @@ Backend identifies an inference backend searched by AISimulate and used by gener -BranchProgress reports progress for one independently optimized backend and topology branch. +BranchProgress reports progress for one AISimulate deployment-mode branch. **Kind:** `type` **Appears in:** [DGDRRunProgress](#dgdrrunprogress) - -Name is the stable branch identifier chosen by the executor. + +DeploymentMode identifies the AISimulate search-space deployment mode. @@ -4372,7 +4372,7 @@ DGDRRunProgress contains branch-aware optimizer and evaluation outcome counters. **Appears in:** [DynamoGraphDeploymentRunStatus](#dynamographdeploymentrunstatus) -Branches reports each independently optimized backend and topology branch. +Branches reports independently optimized AISimulate deployment modes. See [BranchProgress](#branchprogress). **Validation:** Optional: \{\} @@ -4501,12 +4501,6 @@ Metrics are the resolved evaluation metrics for this point. See [RawExtension](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#rawextension-runtime-pkg). **Validation:** Type: object Optional: \{\} - - -Conditions includes the Evaluated condition, whose observedGeneration identifies the candidate spec generation represented by metrics. -See [Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#condition-v1-meta). -**Validation:** Optional: \{\} - @@ -4798,7 +4792,7 @@ ObjectiveMetric is a metric optimized by AISimulate. **Kind:** `type` **Underlying type:** `string` -**Validation:** Enum: [Throughput ThroughputPerGPU ThroughputPerUser TTFT E2ELatency Goodput GoodputPerGPU] +**Validation:** Enum: [Throughput ThroughputPerGpu ThroughputPerUser TTFT E2ELatency Goodput GoodputPerGpu] **Appears in:** [ObjectiveSpec](#objectivespec) @@ -4857,13 +4851,13 @@ See [ObjectiveMode](#objectivemode). Metric is the scalar target when mode is Optimize. See [ObjectiveMetric](#objectivemetric). -**Validation:** Enum: [Throughput ThroughputPerGPU ThroughputPerUser TTFT E2ELatency Goodput GoodputPerGPU] Optional: \{\} +**Validation:** Enum: [Throughput ThroughputPerGpu ThroughputPerUser TTFT E2ELatency Goodput GoodputPerGpu] Optional: \{\} Metrics lists two or more distinct scalar targets when mode is Pareto. See [ObjectiveMetric](#objectivemetric). -**Validation:** Enum: [Throughput ThroughputPerGPU ThroughputPerUser TTFT E2ELatency Goodput GoodputPerGPU] MinItems: 2 Optional: \{\} +**Validation:** Enum: [Throughput ThroughputPerGpu ThroughputPerUser TTFT E2ELatency Goodput GoodputPerGpu] MinItems: 2 Optional: \{\} @@ -4937,11 +4931,6 @@ OSL is the output sequence length in tokens. **Validation:** Minimum: 1 Optional: \{\} - -RequestCount is the absolute number of requests evaluated. When both request-count controls are omitted, the execution underlay supplies its default. -**Validation:** Minimum: 1 Optional: \{\} - - NumRequestRatio sets request count relative to the selected load. **Validation:** ExclusiveMinimum: true Minimum: 0 Optional: \{\} From 007772925ce1a5298b4329541436c721b95b7efa Mon Sep 17 00:00:00 2001 From: "Dr. Stefan Schimanski" Date: Tue, 13 Oct 2026 13:57:56 +0200 Subject: [PATCH 2/6] fixup! operator/dgdr: refine v1beta2 API contracts Signed-off-by: Dr. Stefan Schimanski --- .../dynamographdeploymentrequest_types.go | 6 +++--- deploy/operator/cmd/crd-apply/main_test.go | 4 ++-- ...nvidia.com_dynamographdeploymentrequests.yaml | 16 ++++++++-------- .../nvidia.com_dynamographdeploymentruns.yaml | 16 ++++++++-------- .../additional-resources/api-reference-k8s.md | 6 +++--- .../kubernetes-api/full-api-reference.mdx | 6 +++--- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/deploy/operator/api/v1beta2/dynamographdeploymentrequest_types.go b/deploy/operator/api/v1beta2/dynamographdeploymentrequest_types.go index 869c6728d799..82fd5506eed0 100644 --- a/deploy/operator/api/v1beta2/dynamographdeploymentrequest_types.go +++ b/deploy/operator/api/v1beta2/dynamographdeploymentrequest_types.go @@ -121,7 +121,7 @@ const ( ) // ObjectiveMetric is a metric optimized by AISimulate. -// +kubebuilder:validation:Enum=Throughput;ThroughputPerGpu;ThroughputPerUser;TTFT;E2ELatency;Goodput;GoodputPerGpu +// +kubebuilder:validation:Enum=Throughput;ThroughputPerGPU;ThroughputPerUser;TTFT;E2ELatency;Goodput;GoodputPerGPU type ObjectiveMetric string // ObjectiveSLASpec defines per-request latency bounds used to calculate goodput. @@ -149,8 +149,8 @@ type ObjectiveSLASpec struct { // ObjectiveSpec defines scalar optimization or a multi-objective Pareto search. // +kubebuilder:validation:XValidation:rule="(self.mode == 'Optimize' && has(self.metric) && !has(self.metrics)) || (self.mode == 'Pareto' && !has(self.metric) && has(self.metrics))",message="Optimize requires metric; Pareto requires metrics" -// +kubebuilder:validation:XValidation:rule="!(has(self.metric) && self.metric in ['Goodput', 'GoodputPerGpu']) || (has(self.sla) && (has(self.sla.ttftMs) || has(self.sla.itlMs) || has(self.sla.e2eMs)))",message="Goodput and GoodputPerGpu require at least one SLA bound" -// +kubebuilder:validation:XValidation:rule="!(has(self.metrics) && self.metrics.exists(m, m in ['Goodput', 'GoodputPerGpu'])) || (has(self.sla) && (has(self.sla.ttftMs) || has(self.sla.itlMs) || has(self.sla.e2eMs)))",message="Pareto metrics containing Goodput or GoodputPerGpu require at least one SLA bound" +// +kubebuilder:validation:XValidation:rule="!(has(self.metric) && self.metric in ['Goodput', 'GoodputPerGPU']) || (has(self.sla) && (has(self.sla.ttftMs) || has(self.sla.itlMs) || has(self.sla.e2eMs)))",message="Goodput and GoodputPerGPU require at least one SLA bound" +// +kubebuilder:validation:XValidation:rule="!(has(self.metrics) && self.metrics.exists(m, m in ['Goodput', 'GoodputPerGPU'])) || (has(self.sla) && (has(self.sla.ttftMs) || has(self.sla.itlMs) || has(self.sla.e2eMs)))",message="Pareto metrics containing Goodput or GoodputPerGPU require at least one SLA bound" type ObjectiveSpec struct { // Mode selects scalar optimization or a Pareto search. // +optional diff --git a/deploy/operator/cmd/crd-apply/main_test.go b/deploy/operator/cmd/crd-apply/main_test.go index 2a0e644a59a8..da04c37ad9d9 100644 --- a/deploy/operator/cmd/crd-apply/main_test.go +++ b/deploy/operator/cmd/crd-apply/main_test.go @@ -391,7 +391,7 @@ func TestGeneratedDGDRV1Beta2RequestSchema(t *testing.T) { objective := requestObjective(object) objective["mode"] = "Pareto" delete(objective, "metric") - objective["metrics"] = []interface{}{"ThroughputPerGpu", "TTFT"} + objective["metrics"] = []interface{}{"ThroughputPerGPU", "TTFT"} }, }, { @@ -551,7 +551,7 @@ func validDGDRV1Beta2Request() map[string]interface{} { }, "objective": map[string]interface{}{ "mode": "Optimize", - "metric": "ThroughputPerGpu", + "metric": "ThroughputPerGPU", "sla": map[string]interface{}{}, }, "recommendation": map[string]interface{}{ diff --git a/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentrequests.yaml b/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentrequests.yaml index e6c06f88a21c..4e156b19195c 100644 --- a/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentrequests.yaml +++ b/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentrequests.yaml @@ -9621,12 +9621,12 @@ spec: description: Metric is the scalar target when mode is Optimize. enum: - Throughput - - ThroughputPerGpu + - ThroughputPerGPU - ThroughputPerUser - TTFT - E2ELatency - Goodput - - GoodputPerGpu + - GoodputPerGPU type: string metrics: description: Metrics lists two or more distinct scalar targets when mode is Pareto. @@ -9634,12 +9634,12 @@ spec: description: ObjectiveMetric is a metric optimized by AISimulate. enum: - Throughput - - ThroughputPerGpu + - ThroughputPerGPU - ThroughputPerUser - TTFT - E2ELatency - Goodput - - GoodputPerGpu + - GoodputPerGPU type: string minItems: 2 type: array @@ -9680,10 +9680,10 @@ spec: x-kubernetes-validations: - message: Optimize requires metric; Pareto requires metrics rule: (self.mode == 'Optimize' && has(self.metric) && !has(self.metrics)) || (self.mode == 'Pareto' && !has(self.metric) && has(self.metrics)) - - message: Goodput and GoodputPerGpu require at least one SLA bound - rule: '!(has(self.metric) && self.metric in [''Goodput'', ''GoodputPerGpu'']) || (has(self.sla) && (has(self.sla.ttftMs) || has(self.sla.itlMs) || has(self.sla.e2eMs)))' - - message: Pareto metrics containing Goodput or GoodputPerGpu require at least one SLA bound - rule: '!(has(self.metrics) && self.metrics.exists(m, m in [''Goodput'', ''GoodputPerGpu''])) || (has(self.sla) && (has(self.sla.ttftMs) || has(self.sla.itlMs) || has(self.sla.e2eMs)))' + - message: Goodput and GoodputPerGPU require at least one SLA bound + rule: '!(has(self.metric) && self.metric in [''Goodput'', ''GoodputPerGPU'']) || (has(self.sla) && (has(self.sla.ttftMs) || has(self.sla.itlMs) || has(self.sla.e2eMs)))' + - message: Pareto metrics containing Goodput or GoodputPerGPU require at least one SLA bound + rule: '!(has(self.metrics) && self.metrics.exists(m, m in [''Goodput'', ''GoodputPerGPU''])) || (has(self.sla) && (has(self.sla.ttftMs) || has(self.sla.itlMs) || has(self.sla.e2eMs)))' recommendation: default: {} description: Recommendation controls bounded projection into DGDC resources. diff --git a/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentruns.yaml b/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentruns.yaml index c7855331e0fb..072d03d6832f 100644 --- a/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentruns.yaml +++ b/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentruns.yaml @@ -134,12 +134,12 @@ spec: description: Metric is the scalar target when mode is Optimize. enum: - Throughput - - ThroughputPerGpu + - ThroughputPerGPU - ThroughputPerUser - TTFT - E2ELatency - Goodput - - GoodputPerGpu + - GoodputPerGPU type: string metrics: description: Metrics lists two or more distinct scalar targets when mode is Pareto. @@ -147,12 +147,12 @@ spec: description: ObjectiveMetric is a metric optimized by AISimulate. enum: - Throughput - - ThroughputPerGpu + - ThroughputPerGPU - ThroughputPerUser - TTFT - E2ELatency - Goodput - - GoodputPerGpu + - GoodputPerGPU type: string minItems: 2 type: array @@ -193,10 +193,10 @@ spec: x-kubernetes-validations: - message: Optimize requires metric; Pareto requires metrics rule: (self.mode == 'Optimize' && has(self.metric) && !has(self.metrics)) || (self.mode == 'Pareto' && !has(self.metric) && has(self.metrics)) - - message: Goodput and GoodputPerGpu require at least one SLA bound - rule: '!(has(self.metric) && self.metric in [''Goodput'', ''GoodputPerGpu'']) || (has(self.sla) && (has(self.sla.ttftMs) || has(self.sla.itlMs) || has(self.sla.e2eMs)))' - - message: Pareto metrics containing Goodput or GoodputPerGpu require at least one SLA bound - rule: '!(has(self.metrics) && self.metrics.exists(m, m in [''Goodput'', ''GoodputPerGpu''])) || (has(self.sla) && (has(self.sla.ttftMs) || has(self.sla.itlMs) || has(self.sla.e2eMs)))' + - message: Goodput and GoodputPerGPU require at least one SLA bound + rule: '!(has(self.metric) && self.metric in [''Goodput'', ''GoodputPerGPU'']) || (has(self.sla) && (has(self.sla.ttftMs) || has(self.sla.itlMs) || has(self.sla.e2eMs)))' + - message: Pareto metrics containing Goodput or GoodputPerGPU require at least one SLA bound + rule: '!(has(self.metrics) && self.metrics.exists(m, m in [''Goodput'', ''GoodputPerGPU''])) || (has(self.sla) && (has(self.sla.ttftMs) || has(self.sla.itlMs) || has(self.sla.e2eMs)))' recommendation: default: {} description: Recommendation controls bounded projection into DGDC resources. diff --git a/docs/fern/pages/reference/kubernetes-api/additional-resources/api-reference-k8s.md b/docs/fern/pages/reference/kubernetes-api/additional-resources/api-reference-k8s.md index f38d7ecb22a1..1f05f2f11a27 100644 --- a/docs/fern/pages/reference/kubernetes-api/additional-resources/api-reference-k8s.md +++ b/docs/fern/pages/reference/kubernetes-api/additional-resources/api-reference-k8s.md @@ -3479,7 +3479,7 @@ _Underlying type:_ _string_ ObjectiveMetric is a metric optimized by AISimulate. _Validation:_ -- Enum: [Throughput ThroughputPerGpu ThroughputPerUser TTFT E2ELatency Goodput GoodputPerGpu] +- Enum: [Throughput ThroughputPerGPU ThroughputPerUser TTFT E2ELatency Goodput GoodputPerGPU] _Appears in:_ - [ObjectiveSpec](#objectivespec) @@ -3537,8 +3537,8 @@ _Appears in:_ | Field | Description | Default | Validation | | --- | --- | --- | --- | | `mode` _[ObjectiveMode](#objectivemode)_ | Mode selects scalar optimization or a Pareto search. | Optimize | Enum: [Optimize Pareto]
Optional: \{\}
| -| `metric` _[ObjectiveMetric](#objectivemetric)_ | Metric is the scalar target when mode is Optimize. | | Enum: [Throughput ThroughputPerGpu ThroughputPerUser TTFT E2ELatency Goodput GoodputPerGpu]
Optional: \{\}
| -| `metrics` _[ObjectiveMetric](#objectivemetric) array_ | Metrics lists two or more distinct scalar targets when mode is Pareto. | | Enum: [Throughput ThroughputPerGpu ThroughputPerUser TTFT E2ELatency Goodput GoodputPerGpu]
MinItems: 2
Optional: \{\}
| +| `metric` _[ObjectiveMetric](#objectivemetric)_ | Metric is the scalar target when mode is Optimize. | | Enum: [Throughput ThroughputPerGPU ThroughputPerUser TTFT E2ELatency Goodput GoodputPerGPU]
Optional: \{\}
| +| `metrics` _[ObjectiveMetric](#objectivemetric) array_ | Metrics lists two or more distinct scalar targets when mode is Pareto. | | Enum: [Throughput ThroughputPerGPU ThroughputPerUser TTFT E2ELatency Goodput GoodputPerGPU]
MinItems: 2
Optional: \{\}
| | `sla` _[ObjectiveSLASpec](#objectiveslaspec)_ | SLA defines per-request latency bounds used to calculate goodput. | \{ itlMs:30 ttftMs:2000 \} | Optional: \{\}
| diff --git a/docs/fern/pages/reference/kubernetes-api/full-api-reference.mdx b/docs/fern/pages/reference/kubernetes-api/full-api-reference.mdx index b65b02c78d11..e661612ff421 100644 --- a/docs/fern/pages/reference/kubernetes-api/full-api-reference.mdx +++ b/docs/fern/pages/reference/kubernetes-api/full-api-reference.mdx @@ -4792,7 +4792,7 @@ ObjectiveMetric is a metric optimized by AISimulate. **Kind:** `type` **Underlying type:** `string` -**Validation:** Enum: [Throughput ThroughputPerGpu ThroughputPerUser TTFT E2ELatency Goodput GoodputPerGpu] +**Validation:** Enum: [Throughput ThroughputPerGPU ThroughputPerUser TTFT E2ELatency Goodput GoodputPerGPU] **Appears in:** [ObjectiveSpec](#objectivespec) @@ -4851,13 +4851,13 @@ See [ObjectiveMode](#objectivemode). Metric is the scalar target when mode is Optimize. See [ObjectiveMetric](#objectivemetric). -**Validation:** Enum: [Throughput ThroughputPerGpu ThroughputPerUser TTFT E2ELatency Goodput GoodputPerGpu] Optional: \{\} +**Validation:** Enum: [Throughput ThroughputPerGPU ThroughputPerUser TTFT E2ELatency Goodput GoodputPerGPU] Optional: \{\} Metrics lists two or more distinct scalar targets when mode is Pareto. See [ObjectiveMetric](#objectivemetric). -**Validation:** Enum: [Throughput ThroughputPerGpu ThroughputPerUser TTFT E2ELatency Goodput GoodputPerGpu] MinItems: 2 Optional: \{\} +**Validation:** Enum: [Throughput ThroughputPerGPU ThroughputPerUser TTFT E2ELatency Goodput GoodputPerGPU] MinItems: 2 Optional: \{\} From 94bcb09bc84afe547e736d043d33d7711efcc2a0 Mon Sep 17 00:00:00 2001 From: "Dr. Stefan Schimanski" Date: Tue, 13 Oct 2026 14:04:59 +0200 Subject: [PATCH 3/6] fixup! operator/dgdr: refine v1beta2 API contracts Signed-off-by: Dr. Stefan Schimanski --- .../api/v1beta2/dynamographdeploymentrun_types.go | 10 +++++----- .../bases/nvidia.com_dynamographdeploymentruns.yaml | 12 ++++++------ .../additional-resources/api-reference-k8s.md | 6 +++--- .../reference/kubernetes-api/full-api-reference.mdx | 8 ++++---- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/deploy/operator/api/v1beta2/dynamographdeploymentrun_types.go b/deploy/operator/api/v1beta2/dynamographdeploymentrun_types.go index 6e6e856a626a..0301b934b27c 100644 --- a/deploy/operator/api/v1beta2/dynamographdeploymentrun_types.go +++ b/deploy/operator/api/v1beta2/dynamographdeploymentrun_types.go @@ -57,10 +57,10 @@ type RoundProgress struct { Total int32 `json:"total"` } -// BranchProgress reports progress for one AISimulate deployment-mode branch. +// BranchProgress reports progress for one independently optimized AISimulate branch. type BranchProgress struct { - // DeploymentMode identifies the AISimulate search-space deployment mode. - DeploymentMode string `json:"deploymentMode"` + // Name is the executor-defined stable branch identifier. + Name string `json:"name"` // Rounds reports optimizer progress for this branch. Rounds RoundProgress `json:"rounds"` @@ -101,10 +101,10 @@ type CandidateProgress struct { // DGDRRunProgress contains branch-aware optimizer and evaluation outcome counters. type DGDRRunProgress struct { - // Branches reports independently optimized AISimulate deployment modes. + // Branches reports independently optimized AISimulate branches. // +optional // +listType=map - // +listMapKey=deploymentMode + // +listMapKey=name Branches []BranchProgress `json:"branches,omitempty"` // Evaluations reports unique candidate outcomes. diff --git a/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentruns.yaml b/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentruns.yaml index 072d03d6832f..118d699fa58b 100644 --- a/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentruns.yaml +++ b/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentruns.yaml @@ -389,12 +389,12 @@ spec: description: Progress contains branch-aware optimizer and evaluation outcome counters. properties: branches: - description: Branches reports independently optimized AISimulate deployment modes. + description: Branches reports independently optimized AISimulate branches. items: - description: BranchProgress reports progress for one AISimulate deployment-mode branch. + description: BranchProgress reports progress for one independently optimized AISimulate branch. properties: - deploymentMode: - description: DeploymentMode identifies the AISimulate search-space deployment mode. + name: + description: Name is the executor-defined stable branch identifier. type: string rounds: description: Rounds reports optimizer progress for this branch. @@ -412,12 +412,12 @@ spec: - total type: object required: - - deploymentMode + - name - rounds type: object type: array x-kubernetes-list-map-keys: - - deploymentMode + - name x-kubernetes-list-type: map candidates: description: Candidates reports bounded Kubernetes publication. diff --git a/docs/fern/pages/reference/kubernetes-api/additional-resources/api-reference-k8s.md b/docs/fern/pages/reference/kubernetes-api/additional-resources/api-reference-k8s.md index 1f05f2f11a27..add3edb8ee5e 100644 --- a/docs/fern/pages/reference/kubernetes-api/additional-resources/api-reference-k8s.md +++ b/docs/fern/pages/reference/kubernetes-api/additional-resources/api-reference-k8s.md @@ -3149,7 +3149,7 @@ _Appears in:_ -BranchProgress reports progress for one AISimulate deployment-mode branch. +BranchProgress reports progress for one independently optimized AISimulate branch. @@ -3158,7 +3158,7 @@ _Appears in:_ | Field | Description | Default | Validation | | --- | --- | --- | --- | -| `deploymentMode` _string_ | DeploymentMode identifies the AISimulate search-space deployment mode. | | | +| `name` _string_ | Name is the executor-defined stable branch identifier. | | | | `rounds` _[RoundProgress](#roundprogress)_ | Rounds reports optimizer progress for this branch. | | | @@ -3212,7 +3212,7 @@ _Appears in:_ | Field | Description | Default | Validation | | --- | --- | --- | --- | -| `branches` _[BranchProgress](#branchprogress) array_ | Branches reports independently optimized AISimulate deployment modes. | | Optional: \{\}
| +| `branches` _[BranchProgress](#branchprogress) array_ | Branches reports independently optimized AISimulate branches. | | Optional: \{\}
| | `evaluations` _[EvaluationProgress](#evaluationprogress)_ | Evaluations reports unique candidate outcomes. | | Optional: \{\}
| | `candidates` _[CandidateProgress](#candidateprogress)_ | Candidates reports bounded Kubernetes publication. | | Optional: \{\}
| diff --git a/docs/fern/pages/reference/kubernetes-api/full-api-reference.mdx b/docs/fern/pages/reference/kubernetes-api/full-api-reference.mdx index e661612ff421..ec9f40c7e512 100644 --- a/docs/fern/pages/reference/kubernetes-api/full-api-reference.mdx +++ b/docs/fern/pages/reference/kubernetes-api/full-api-reference.mdx @@ -4315,14 +4315,14 @@ Backend identifies an inference backend searched by AISimulate and used by gener -BranchProgress reports progress for one AISimulate deployment-mode branch. +BranchProgress reports progress for one independently optimized AISimulate branch. **Kind:** `type` **Appears in:** [DGDRRunProgress](#dgdrrunprogress) - -DeploymentMode identifies the AISimulate search-space deployment mode. + +Name is the executor-defined stable branch identifier. @@ -4372,7 +4372,7 @@ DGDRRunProgress contains branch-aware optimizer and evaluation outcome counters. **Appears in:** [DynamoGraphDeploymentRunStatus](#dynamographdeploymentrunstatus) -Branches reports independently optimized AISimulate deployment modes. +Branches reports independently optimized AISimulate branches. See [BranchProgress](#branchprogress). **Validation:** Optional: \{\} From c586db0472d3309575bc9032c2a3f4e421871d28 Mon Sep 17 00:00:00 2001 From: "Dr. Stefan Schimanski" Date: Tue, 13 Oct 2026 14:16:59 +0200 Subject: [PATCH 4/6] fixup! operator/dgdr: refine v1beta2 API contracts Signed-off-by: Dr. Stefan Schimanski --- .../dynamographdeploymentrequest_types.go | 19 +++++++--- .../api/v1beta2/zz_generated.deepcopy.go | 18 ++++++++-- deploy/operator/cmd/crd-apply/main_test.go | 5 ++- ...dia.com_dynamographdeploymentrequests.yaml | 35 ++++++++++++------- .../nvidia.com_dynamographdeploymentruns.yaml | 35 ++++++++++++------- .../additional-resources/api-reference-k8s.md | 12 +++---- .../kubernetes-api/full-api-reference.mdx | 19 +++++----- 7 files changed, 95 insertions(+), 48 deletions(-) diff --git a/deploy/operator/api/v1beta2/dynamographdeploymentrequest_types.go b/deploy/operator/api/v1beta2/dynamographdeploymentrequest_types.go index 82fd5506eed0..f311c64c3422 100644 --- a/deploy/operator/api/v1beta2/dynamographdeploymentrequest_types.go +++ b/deploy/operator/api/v1beta2/dynamographdeploymentrequest_types.go @@ -43,18 +43,24 @@ const ( // GPUHardwareSpec describes accelerator identity and the maximum allocation per candidate. type GPUHardwareSpec struct { // SKU identifies the accelerator using the AISimulate hardware catalog name. + // When omitted, admission discovers the accelerator from the cluster. + // +optional // +kubebuilder:validation:MinLength=1 - SKU string `json:"sku"` + SKU *string `json:"sku,omitempty"` // Budget is the maximum total number of GPUs one candidate may use. + // When omitted, admission derives the available GPU budget from the cluster. + // +optional // +kubebuilder:validation:Minimum=1 - Budget int32 `json:"budget"` + Budget *int32 `json:"budget,omitempty"` } // HardwareSpec bounds the accelerator configurations evaluated by the search. type HardwareSpec struct { // GPU describes accelerator identity and the maximum allocation per candidate. - GPU GPUHardwareSpec `json:"gpu"` + // Omitted fields are resolved independently by admission. + // +optional + GPU *GPUHardwareSpec `json:"gpu,omitempty"` } // KVLoadRatio is either a pinned load ratio or a minimum/maximum range. @@ -148,7 +154,7 @@ type ObjectiveSLASpec struct { } // ObjectiveSpec defines scalar optimization or a multi-objective Pareto search. -// +kubebuilder:validation:XValidation:rule="(self.mode == 'Optimize' && has(self.metric) && !has(self.metrics)) || (self.mode == 'Pareto' && !has(self.metric) && has(self.metrics))",message="Optimize requires metric; Pareto requires metrics" +// +kubebuilder:validation:XValidation:rule="(self.mode == 'Optimize' && !has(self.metrics)) || (self.mode == 'Pareto' && !has(self.metric) && has(self.metrics))",message="Optimize accepts only metric; Pareto requires metrics" // +kubebuilder:validation:XValidation:rule="!(has(self.metric) && self.metric in ['Goodput', 'GoodputPerGPU']) || (has(self.sla) && (has(self.sla.ttftMs) || has(self.sla.itlMs) || has(self.sla.e2eMs)))",message="Goodput and GoodputPerGPU require at least one SLA bound" // +kubebuilder:validation:XValidation:rule="!(has(self.metrics) && self.metrics.exists(m, m in ['Goodput', 'GoodputPerGPU'])) || (has(self.sla) && (has(self.sla.ttftMs) || has(self.sla.itlMs) || has(self.sla.e2eMs)))",message="Pareto metrics containing Goodput or GoodputPerGPU require at least one SLA bound" type ObjectiveSpec struct { @@ -158,6 +164,7 @@ type ObjectiveSpec struct { Mode ObjectiveMode `json:"mode,omitempty"` // Metric is the scalar target when mode is Optimize. + // When omitted in Optimize mode, admission defaults it to ThroughputPerGPU. // +optional Metric *ObjectiveMetric `json:"metric,omitempty"` @@ -219,6 +226,7 @@ type DynamoGraphDeploymentRequestSpec struct { Backends []Backend `json:"backends,omitempty"` // Hardware bounds the accelerator configurations evaluated by the search. + // Admission discovers any omitted hardware values from the cluster. // +optional Hardware *HardwareSpec `json:"hardware,omitempty"` @@ -228,7 +236,10 @@ type DynamoGraphDeploymentRequestSpec struct { Workload *WorkloadSpec `json:"workload,omitempty"` // Objective defines scalar optimization or a multi-objective Pareto search. + // When omitted, the schema supplies the default Optimize mode and SLA; + // admission supplies the conditional scalar metric. // +optional + // +kubebuilder:default={} Objective *ObjectiveSpec `json:"objective,omitempty"` // AISimulate selects the execution artifact and supplies native AISimulate input. diff --git a/deploy/operator/api/v1beta2/zz_generated.deepcopy.go b/deploy/operator/api/v1beta2/zz_generated.deepcopy.go index a4ad582d9ea9..5c2dfcd20fb7 100644 --- a/deploy/operator/api/v1beta2/zz_generated.deepcopy.go +++ b/deploy/operator/api/v1beta2/zz_generated.deepcopy.go @@ -291,7 +291,7 @@ func (in *DynamoGraphDeploymentRequestSpec) DeepCopyInto(out *DynamoGraphDeploym if in.Hardware != nil { in, out := &in.Hardware, &out.Hardware *out = new(HardwareSpec) - **out = **in + (*in).DeepCopyInto(*out) } if in.Workload != nil { in, out := &in.Workload, &out.Workload @@ -483,6 +483,16 @@ func (in *EvaluationProgress) DeepCopy() *EvaluationProgress { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GPUHardwareSpec) DeepCopyInto(out *GPUHardwareSpec) { *out = *in + if in.SKU != nil { + in, out := &in.SKU, &out.SKU + *out = new(string) + **out = **in + } + if in.Budget != nil { + in, out := &in.Budget, &out.Budget + *out = new(int32) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GPUHardwareSpec. @@ -498,7 +508,11 @@ func (in *GPUHardwareSpec) DeepCopy() *GPUHardwareSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HardwareSpec) DeepCopyInto(out *HardwareSpec) { *out = *in - out.GPU = in.GPU + if in.GPU != nil { + in, out := &in.GPU, &out.GPU + *out = new(GPUHardwareSpec) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HardwareSpec. diff --git a/deploy/operator/cmd/crd-apply/main_test.go b/deploy/operator/cmd/crd-apply/main_test.go index da04c37ad9d9..0c4353a5597b 100644 --- a/deploy/operator/cmd/crd-apply/main_test.go +++ b/deploy/operator/cmd/crd-apply/main_test.go @@ -310,9 +310,12 @@ func TestGeneratedDGDRV1Beta2RequestSchema(t *testing.T) { spec := object["spec"].(map[string]interface{}) require.NotContains(t, spec, "hardware") - require.NotContains(t, spec, "objective") require.NotContains(t, spec, "aisimulate") require.Equal(t, []interface{}{"vllm", "sglang", "trtllm"}, spec["backends"]) + require.Equal(t, "Optimize", spec["objective"].(map[string]interface{})["mode"]) + require.NotContains(t, spec["objective"].(map[string]interface{}), "metric") + require.EqualValues(t, 2000, spec["objective"].(map[string]interface{})["sla"].(map[string]interface{})["ttftMs"]) + require.EqualValues(t, 30, spec["objective"].(map[string]interface{})["sla"].(map[string]interface{})["itlMs"]) require.EqualValues(t, 1, spec["recommendation"].(map[string]interface{})["maxCandidates"]) requireDefaultOptionAWorkload(t, spec) }) diff --git a/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentrequests.yaml b/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentrequests.yaml index 4e156b19195c..5d205cffb804 100644 --- a/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentrequests.yaml +++ b/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentrequests.yaml @@ -9583,26 +9583,29 @@ spec: minItems: 1 type: array hardware: - description: Hardware bounds the accelerator configurations evaluated by the search. + description: |- + Hardware bounds the accelerator configurations evaluated by the search. + Admission discovers any omitted hardware values from the cluster. properties: gpu: - description: GPU describes accelerator identity and the maximum allocation per candidate. + description: |- + GPU describes accelerator identity and the maximum allocation per candidate. + Omitted fields are resolved independently by admission. properties: budget: - description: Budget is the maximum total number of GPUs one candidate may use. + description: |- + Budget is the maximum total number of GPUs one candidate may use. + When omitted, admission derives the available GPU budget from the cluster. format: int32 minimum: 1 type: integer sku: - description: SKU identifies the accelerator using the AISimulate hardware catalog name. + description: |- + SKU identifies the accelerator using the AISimulate hardware catalog name. + When omitted, admission discovers the accelerator from the cluster. minLength: 1 type: string - required: - - budget - - sku type: object - required: - - gpu type: object model: description: Model identifies the model whose deployment configurations are evaluated. @@ -9615,10 +9618,16 @@ spec: - name type: object objective: - description: Objective defines scalar optimization or a multi-objective Pareto search. + default: {} + description: |- + Objective defines scalar optimization or a multi-objective Pareto search. + When omitted, the schema supplies the default Optimize mode and SLA; + admission supplies the conditional scalar metric. properties: metric: - description: Metric is the scalar target when mode is Optimize. + description: |- + Metric is the scalar target when mode is Optimize. + When omitted in Optimize mode, admission defaults it to ThroughputPerGPU. enum: - Throughput - ThroughputPerGPU @@ -9678,8 +9687,8 @@ spec: rule: '!has(self.e2eMs) || (!has(self.ttftMs) && !has(self.itlMs))' type: object x-kubernetes-validations: - - message: Optimize requires metric; Pareto requires metrics - rule: (self.mode == 'Optimize' && has(self.metric) && !has(self.metrics)) || (self.mode == 'Pareto' && !has(self.metric) && has(self.metrics)) + - message: Optimize accepts only metric; Pareto requires metrics + rule: (self.mode == 'Optimize' && !has(self.metrics)) || (self.mode == 'Pareto' && !has(self.metric) && has(self.metrics)) - message: Goodput and GoodputPerGPU require at least one SLA bound rule: '!(has(self.metric) && self.metric in [''Goodput'', ''GoodputPerGPU'']) || (has(self.sla) && (has(self.sla.ttftMs) || has(self.sla.itlMs) || has(self.sla.e2eMs)))' - message: Pareto metrics containing Goodput or GoodputPerGPU require at least one SLA bound diff --git a/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentruns.yaml b/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentruns.yaml index 118d699fa58b..d14927e81849 100644 --- a/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentruns.yaml +++ b/deploy/operator/config/crd/bases/nvidia.com_dynamographdeploymentruns.yaml @@ -96,26 +96,29 @@ spec: minItems: 1 type: array hardware: - description: Hardware bounds the accelerator configurations evaluated by the search. + description: |- + Hardware bounds the accelerator configurations evaluated by the search. + Admission discovers any omitted hardware values from the cluster. properties: gpu: - description: GPU describes accelerator identity and the maximum allocation per candidate. + description: |- + GPU describes accelerator identity and the maximum allocation per candidate. + Omitted fields are resolved independently by admission. properties: budget: - description: Budget is the maximum total number of GPUs one candidate may use. + description: |- + Budget is the maximum total number of GPUs one candidate may use. + When omitted, admission derives the available GPU budget from the cluster. format: int32 minimum: 1 type: integer sku: - description: SKU identifies the accelerator using the AISimulate hardware catalog name. + description: |- + SKU identifies the accelerator using the AISimulate hardware catalog name. + When omitted, admission discovers the accelerator from the cluster. minLength: 1 type: string - required: - - budget - - sku type: object - required: - - gpu type: object model: description: Model identifies the model whose deployment configurations are evaluated. @@ -128,10 +131,16 @@ spec: - name type: object objective: - description: Objective defines scalar optimization or a multi-objective Pareto search. + default: {} + description: |- + Objective defines scalar optimization or a multi-objective Pareto search. + When omitted, the schema supplies the default Optimize mode and SLA; + admission supplies the conditional scalar metric. properties: metric: - description: Metric is the scalar target when mode is Optimize. + description: |- + Metric is the scalar target when mode is Optimize. + When omitted in Optimize mode, admission defaults it to ThroughputPerGPU. enum: - Throughput - ThroughputPerGPU @@ -191,8 +200,8 @@ spec: rule: '!has(self.e2eMs) || (!has(self.ttftMs) && !has(self.itlMs))' type: object x-kubernetes-validations: - - message: Optimize requires metric; Pareto requires metrics - rule: (self.mode == 'Optimize' && has(self.metric) && !has(self.metrics)) || (self.mode == 'Pareto' && !has(self.metric) && has(self.metrics)) + - message: Optimize accepts only metric; Pareto requires metrics + rule: (self.mode == 'Optimize' && !has(self.metrics)) || (self.mode == 'Pareto' && !has(self.metric) && has(self.metrics)) - message: Goodput and GoodputPerGPU require at least one SLA bound rule: '!(has(self.metric) && self.metric in [''Goodput'', ''GoodputPerGPU'']) || (has(self.sla) && (has(self.sla.ttftMs) || has(self.sla.itlMs) || has(self.sla.e2eMs)))' - message: Pareto metrics containing Goodput or GoodputPerGPU require at least one SLA bound diff --git a/docs/fern/pages/reference/kubernetes-api/additional-resources/api-reference-k8s.md b/docs/fern/pages/reference/kubernetes-api/additional-resources/api-reference-k8s.md index add3edb8ee5e..dba2a8393252 100644 --- a/docs/fern/pages/reference/kubernetes-api/additional-resources/api-reference-k8s.md +++ b/docs/fern/pages/reference/kubernetes-api/additional-resources/api-reference-k8s.md @@ -3313,9 +3313,9 @@ _Appears in:_ | --- | --- | --- | --- | | `model` _[ModelSpec](#modelspec)_ | Model identifies the model whose deployment configurations are evaluated. | | | | `backends` _[Backend](#backend) array_ | Backends lists one or more inference backends searched by AISimulate and used by generated candidates. | [vllm sglang trtllm] | Enum: [vllm sglang trtllm]
MinItems: 1
Optional: \{\}
| -| `hardware` _[HardwareSpec](#hardwarespec)_ | Hardware bounds the accelerator configurations evaluated by the search. | | Optional: \{\}
| +| `hardware` _[HardwareSpec](#hardwarespec)_ | Hardware bounds the accelerator configurations evaluated by the search.
Admission discovers any omitted hardware values from the cluster. | | Optional: \{\}
| | `workload` _[WorkloadSpec](#workloadspec)_ | Workload defines the synthetic traffic model used for every candidate evaluation. | \{ \} | Optional: \{\}
| -| `objective` _[ObjectiveSpec](#objectivespec)_ | Objective defines scalar optimization or a multi-objective Pareto search. | | Optional: \{\}
| +| `objective` _[ObjectiveSpec](#objectivespec)_ | Objective defines scalar optimization or a multi-objective Pareto search.
When omitted, the schema supplies the default Optimize mode and SLA;
admission supplies the conditional scalar metric. | \{ \} | Optional: \{\}
| | `aisimulate` _[AISimulateSpec](#aisimulatespec)_ | AISimulate selects the execution artifact and supplies native AISimulate input. | | Optional: \{\}
| | `recommendation` _[RecommendationSpec](#recommendationspec)_ | Recommendation controls bounded projection into DGDC resources. | \{ \} | Optional: \{\}
| @@ -3418,8 +3418,8 @@ _Appears in:_ | Field | Description | Default | Validation | | --- | --- | --- | --- | -| `sku` _string_ | SKU identifies the accelerator using the AISimulate hardware catalog name. | | MinLength: 1
| -| `budget` _integer_ | Budget is the maximum total number of GPUs one candidate may use. | | Minimum: 1
| +| `sku` _string_ | SKU identifies the accelerator using the AISimulate hardware catalog name.
When omitted, admission discovers the accelerator from the cluster. | | MinLength: 1
Optional: \{\}
| +| `budget` _integer_ | Budget is the maximum total number of GPUs one candidate may use.
When omitted, admission derives the available GPU budget from the cluster. | | Minimum: 1
Optional: \{\}
| #### HardwareSpec @@ -3435,7 +3435,7 @@ _Appears in:_ | Field | Description | Default | Validation | | --- | --- | --- | --- | -| `gpu` _[GPUHardwareSpec](#gpuhardwarespec)_ | GPU describes accelerator identity and the maximum allocation per candidate. | | | +| `gpu` _[GPUHardwareSpec](#gpuhardwarespec)_ | GPU describes accelerator identity and the maximum allocation per candidate.
Omitted fields are resolved independently by admission. | | Optional: \{\}
| #### KVLoadRatio @@ -3537,7 +3537,7 @@ _Appears in:_ | Field | Description | Default | Validation | | --- | --- | --- | --- | | `mode` _[ObjectiveMode](#objectivemode)_ | Mode selects scalar optimization or a Pareto search. | Optimize | Enum: [Optimize Pareto]
Optional: \{\}
| -| `metric` _[ObjectiveMetric](#objectivemetric)_ | Metric is the scalar target when mode is Optimize. | | Enum: [Throughput ThroughputPerGPU ThroughputPerUser TTFT E2ELatency Goodput GoodputPerGPU]
Optional: \{\}
| +| `metric` _[ObjectiveMetric](#objectivemetric)_ | Metric is the scalar target when mode is Optimize.
When omitted in Optimize mode, admission defaults it to ThroughputPerGPU. | | Enum: [Throughput ThroughputPerGPU ThroughputPerUser TTFT E2ELatency Goodput GoodputPerGPU]
Optional: \{\}
| | `metrics` _[ObjectiveMetric](#objectivemetric) array_ | Metrics lists two or more distinct scalar targets when mode is Pareto. | | Enum: [Throughput ThroughputPerGPU ThroughputPerUser TTFT E2ELatency Goodput GoodputPerGPU]
MinItems: 2
Optional: \{\}
| | `sla` _[ObjectiveSLASpec](#objectiveslaspec)_ | SLA defines per-request latency bounds used to calculate goodput. | \{ itlMs:30 ttftMs:2000 \} | Optional: \{\}
| diff --git a/docs/fern/pages/reference/kubernetes-api/full-api-reference.mdx b/docs/fern/pages/reference/kubernetes-api/full-api-reference.mdx index ec9f40c7e512..ab9c93411f94 100644 --- a/docs/fern/pages/reference/kubernetes-api/full-api-reference.mdx +++ b/docs/fern/pages/reference/kubernetes-api/full-api-reference.mdx @@ -4550,7 +4550,7 @@ See [Backend](#backend).
-Hardware bounds the accelerator configurations evaluated by the search. +Hardware bounds the accelerator configurations evaluated by the search. Admission discovers any omitted hardware values from the cluster. See [HardwareSpec](#v1beta2-hardwarespec). **Validation:** Optional: \{\} @@ -4561,8 +4561,8 @@ See [WorkloadSpec](#v1beta2-workloadspec). **Validation:** Optional: \{\}
- -Objective defines scalar optimization or a multi-objective Pareto search. + +Objective defines scalar optimization or a multi-objective Pareto search. When omitted, the schema supplies the default Optimize mode and SLA; admission supplies the conditional scalar metric. See [ObjectiveSpec](#objectivespec). **Validation:** Optional: \{\} @@ -4739,13 +4739,13 @@ GPUHardwareSpec describes accelerator identity and the maximum allocation per ca **Appears in:** [HardwareSpec](#v1beta2-hardwarespec) -SKU identifies the accelerator using the AISimulate hardware catalog name. -**Validation:** MinLength: 1 +SKU identifies the accelerator using the AISimulate hardware catalog name. When omitted, admission discovers the accelerator from the cluster. +**Validation:** MinLength: 1 Optional: \{\} -Budget is the maximum total number of GPUs one candidate may use. -**Validation:** Minimum: 1 +Budget is the maximum total number of GPUs one candidate may use. When omitted, admission derives the available GPU budget from the cluster. +**Validation:** Minimum: 1 Optional: \{\}
@@ -4757,8 +4757,9 @@ HardwareSpec bounds the accelerator configurations evaluated by the search. **Appears in:** [DynamoGraphDeploymentRequestSpec](#v1beta2-dynamographdeploymentrequestspec) -GPU describes accelerator identity and the maximum allocation per candidate. +GPU describes accelerator identity and the maximum allocation per candidate. Omitted fields are resolved independently by admission. See [GPUHardwareSpec](#gpuhardwarespec). +**Validation:** Optional: \{\} @@ -4849,7 +4850,7 @@ See [ObjectiveMode](#objectivemode).
-Metric is the scalar target when mode is Optimize. +Metric is the scalar target when mode is Optimize. When omitted in Optimize mode, admission defaults it to ThroughputPerGPU. See [ObjectiveMetric](#objectivemetric). **Validation:** Enum: [Throughput ThroughputPerGPU ThroughputPerUser TTFT E2ELatency Goodput GoodputPerGPU] Optional: \{\} From 8512c079b6bb9299cfe20e68af470208e3811beb Mon Sep 17 00:00:00 2001 From: "Dr. Stefan Schimanski" Date: Tue, 13 Oct 2026 14:29:34 +0200 Subject: [PATCH 5/6] fixup! operator/dgdr: refine v1beta2 API contracts Signed-off-by: Dr. Stefan Schimanski --- deploy/operator/cmd/crd-apply/main_test.go | 461 --------------------- 1 file changed, 461 deletions(-) diff --git a/deploy/operator/cmd/crd-apply/main_test.go b/deploy/operator/cmd/crd-apply/main_test.go index 0c4353a5597b..e02ec96c58bb 100644 --- a/deploy/operator/cmd/crd-apply/main_test.go +++ b/deploy/operator/cmd/crd-apply/main_test.go @@ -13,22 +13,14 @@ import ( "testing" "github.com/stretchr/testify/require" - "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" - structuralschema "k8s.io/apiextensions-apiserver/pkg/apiserver/schema" - structuraldefaulting "k8s.io/apiextensions-apiserver/pkg/apiserver/schema/defaulting" - "k8s.io/apiextensions-apiserver/pkg/apiserver/schema/listtype" - apiextensionsvalidation "k8s.io/apiextensions-apiserver/pkg/apiserver/validation" apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" - apitest "k8s.io/apiextensions-apiserver/pkg/test" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/validation/field" "k8s.io/client-go/tools/clientcmd" clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/utils/ptr" "sigs.k8s.io/controller-runtime/pkg/envtest" - "sigs.k8s.io/yaml" ) func TestCRDApplyInstallsGeneratedSchemas(t *testing.T) { @@ -187,456 +179,3 @@ func TestCRDApplyInstallsGeneratedSchemas(t *testing.T) { } } } - -func TestConfigureGeneratedDGDRV1Beta2CRDs(t *testing.T) { - tests := []struct { - file string - wantApply bool - }{ - {file: "../../config/crd/bases/nvidia.com_dynamographdeploymentrequests.yaml", wantApply: true}, - {file: "../../config/crd/bases/nvidia.com_dynamographdeploymentruns.yaml"}, - {file: "../../config/crd/bases/nvidia.com_dynamographdeploymentcandidates.yaml"}, - } - - for _, tt := range tests { - t.Run(tt.file, func(t *testing.T) { - data, err := os.ReadFile(tt.file) - if err != nil { - t.Fatalf("read generated CRD: %v", err) - } - crd := &apiextensionsv1.CustomResourceDefinition{} - if err := yaml.Unmarshal(data, crd); err != nil { - t.Fatalf("decode generated CRD: %v", err) - } - - if got := configureDGDRV1Beta2CRD(crd); got != tt.wantApply { - t.Fatalf("configureDGDRV1Beta2CRD() = %v, want %v", got, tt.wantApply) - } - if crd.Name == dgdrCRDName { - for _, version := range crd.Spec.Versions { - if version.Name == "v1beta2" { - t.Fatal("generated request CRD still contains v1beta2") - } - } - } - }) - } -} - -func TestGeneratedDGDRV1Beta2RequestSchema(t *testing.T) { - const crdPath = "../../config/crd/bases/nvidia.com_dynamographdeploymentrequests.yaml" - - data, err := os.ReadFile(crdPath) - require.NoError(t, err) - crd := &apiextensionsv1.CustomResourceDefinition{} - require.NoError(t, yaml.Unmarshal(data, crd)) - - var version *apiextensionsv1.CustomResourceDefinitionVersion - for index := range crd.Spec.Versions { - if crd.Spec.Versions[index].Name == "v1beta2" { - version = &crd.Spec.Versions[index] - break - } - } - require.NotNil(t, version) - - specSchema := version.Schema.OpenAPIV3Schema.Properties["spec"] - require.Equal(t, []string{"model"}, specSchema.Required) - for _, removed := range []string{"modelRef", "search", "image", "rerun", "overrides"} { - require.NotContains(t, specSchema.Properties, removed) - } - require.NotContains(t, specSchema.Properties["model"].Properties, "revision") - require.NotContains(t, specSchema.Properties["workload"].Properties, "trace") - - var internalSchema apiextensions.JSONSchemaProps - require.NoError(t, apiextensionsv1.Convert_v1_JSONSchemaProps_To_apiextensions_JSONSchemaProps( - version.Schema.OpenAPIV3Schema, - &internalSchema, - nil, - )) - schemaValidator, _, err := apiextensionsvalidation.NewSchemaValidator(&internalSchema) - require.NoError(t, err) - structural, err := structuralschema.NewStructural(&internalSchema) - require.NoError(t, err) - celValidator := apitest.VersionValidatorsFromFile(t, crdPath)["v1beta2"] - require.NotNil(t, celValidator) - - validate := func(t *testing.T, object map[string]interface{}) []string { - t.Helper() - var messages []string - for _, validationErr := range apiextensionsvalidation.ValidateCustomResource(nil, object, schemaValidator) { - messages = append(messages, validationErr.Error()) - } - for _, validationErr := range celValidator(object, nil) { - messages = append(messages, validationErr.Error()) - } - for _, validationErr := range listtype.ValidateListSetsAndMaps(field.NewPath(""), structural, object) { - messages = append(messages, validationErr.Error()) - } - return messages - } - - t.Run("defaults", func(t *testing.T) { - object := validDGDRV1Beta2Request() - spec := object["spec"].(map[string]interface{}) - delete(spec, "backends") - delete(spec["objective"].(map[string]interface{}), "mode") - delete(spec["objective"].(map[string]interface{}), "sla") - delete(spec, "recommendation") - - structuraldefaulting.Default(object, structural) - - require.Equal(t, []interface{}{"vllm", "sglang", "trtllm"}, spec["backends"]) - require.Equal(t, "Optimize", spec["objective"].(map[string]interface{})["mode"]) - require.EqualValues(t, 2000, spec["objective"].(map[string]interface{})["sla"].(map[string]interface{})["ttftMs"]) - require.EqualValues(t, 30, spec["objective"].(map[string]interface{})["sla"].(map[string]interface{})["itlMs"]) - require.EqualValues(t, 1, spec["recommendation"].(map[string]interface{})["maxCandidates"]) - - optOut := validDGDRV1Beta2Request() - optOutSLA := requestObjective(optOut)["sla"].(map[string]interface{}) - structuraldefaulting.Default(optOut, structural) - require.Empty(t, optOutSLA) - }) - - t.Run("model only", func(t *testing.T) { - object := map[string]interface{}{ - "apiVersion": "nvidia.com/v1beta2", - "kind": "DynamoGraphDeploymentRequest", - "metadata": map[string]interface{}{"name": "model-only"}, - "spec": map[string]interface{}{"model": map[string]interface{}{"name": "test/model"}}, - } - structuraldefaulting.Default(object, structural) - require.Empty(t, validate(t, object)) - - spec := object["spec"].(map[string]interface{}) - require.NotContains(t, spec, "hardware") - require.NotContains(t, spec, "aisimulate") - require.Equal(t, []interface{}{"vllm", "sglang", "trtllm"}, spec["backends"]) - require.Equal(t, "Optimize", spec["objective"].(map[string]interface{})["mode"]) - require.NotContains(t, spec["objective"].(map[string]interface{}), "metric") - require.EqualValues(t, 2000, spec["objective"].(map[string]interface{})["sla"].(map[string]interface{})["ttftMs"]) - require.EqualValues(t, 30, spec["objective"].(map[string]interface{})["sla"].(map[string]interface{})["itlMs"]) - require.EqualValues(t, 1, spec["recommendation"].(map[string]interface{})["maxCandidates"]) - requireDefaultOptionAWorkload(t, spec) - }) - - t.Run("empty workload placeholder", func(t *testing.T) { - object := map[string]interface{}{ - "apiVersion": "nvidia.com/v1beta2", - "kind": "DynamoGraphDeploymentRequest", - "metadata": map[string]interface{}{"name": "defaultable-workload"}, - "spec": map[string]interface{}{ - "model": map[string]interface{}{"name": "test/model"}, - "workload": map[string]interface{}{}, - }, - } - structuraldefaulting.Default(object, structural) - require.Empty(t, validate(t, object)) - requireDefaultOptionAWorkload(t, object["spec"].(map[string]interface{})) - }) - - t.Run("explicit empty static opts out", func(t *testing.T) { - object := map[string]interface{}{ - "apiVersion": "nvidia.com/v1beta2", - "kind": "DynamoGraphDeploymentRequest", - "metadata": map[string]interface{}{"name": "native-workload"}, - "spec": map[string]interface{}{ - "model": map[string]interface{}{"name": "test/model"}, - "workload": map[string]interface{}{ - "static": map[string]interface{}{}, - }, - }, - } - static := requestStaticWorkload(object) - structuraldefaulting.Default(object, structural) - require.Empty(t, validate(t, object)) - require.Empty(t, static) - }) - - tests := []struct { - name string - mutate func(map[string]interface{}) - wantErr bool - }{ - { - name: "ratio below one", - mutate: func(object map[string]interface{}) { - requestStaticWorkload(object)["numRequestRatio"] = 0.5 - }, - }, - { - name: "ttft only SLA", - mutate: func(object map[string]interface{}) { - requestObjective(object)["sla"] = map[string]interface{}{"ttftMs": 100.0} - }, - }, - { - name: "itl only SLA", - mutate: func(object map[string]interface{}) { - requestObjective(object)["sla"] = map[string]interface{}{"itlMs": 10.0} - }, - }, - { - name: "e2e only SLA", - mutate: func(object map[string]interface{}) { - requestObjective(object)["sla"] = map[string]interface{}{"e2eMs": 100.0} - }, - }, - { - name: "empty SLA opt out", - mutate: func(object map[string]interface{}) { - requestObjective(object)["sla"] = map[string]interface{}{} - }, - }, - { - name: "pareto metrics", - mutate: func(object map[string]interface{}) { - objective := requestObjective(object) - objective["mode"] = "Pareto" - delete(objective, "metric") - objective["metrics"] = []interface{}{"ThroughputPerGPU", "TTFT"} - }, - }, - { - name: "duplicate pareto metrics", - mutate: func(object map[string]interface{}) { - objective := requestObjective(object) - objective["mode"] = "Pareto" - delete(objective, "metric") - objective["metrics"] = []interface{}{"TTFT", "TTFT"} - }, - wantErr: true, - }, - { - name: "omitted request ratio uses underlay default", - mutate: func(object map[string]interface{}) { - static := requestStaticWorkload(object) - delete(static, "numRequestRatio") - }, - }, - { - name: "KV load ratio below range", - mutate: func(object map[string]interface{}) { - static := requestStaticWorkload(object) - delete(static, "concurrency") - static["kvLoadRatio"] = []interface{}{-0.1} - }, - wantErr: true, - }, - { - name: "KV load ratio above range", - mutate: func(object map[string]interface{}) { - static := requestStaticWorkload(object) - delete(static, "concurrency") - static["kvLoadRatio"] = []interface{}{1.1} - }, - wantErr: true, - }, - { - name: "zero request ratio", - mutate: func(object map[string]interface{}) { - requestStaticWorkload(object)["numRequestRatio"] = 0.0 - }, - wantErr: true, - }, - { - name: "mixed e2e and token SLA", - mutate: func(object map[string]interface{}) { - requestObjective(object)["sla"] = map[string]interface{}{"e2eMs": 100.0, "ttftMs": 50.0} - }, - wantErr: true, - }, - { - name: "goodput without SLA", - mutate: func(object map[string]interface{}) { - objective := requestObjective(object) - objective["metric"] = "Goodput" - objective["sla"] = map[string]interface{}{} - }, - wantErr: true, - }, - { - name: "legacy metric casing", - mutate: func(object map[string]interface{}) { - requestObjective(object)["metric"] = "throughputPerGpu" - }, - wantErr: true, - }, - { - name: "recommendation limit", - mutate: func(object map[string]interface{}) { - object["spec"].(map[string]interface{})["recommendation"] = map[string]interface{}{"maxCandidates": int64(101)} - }, - wantErr: true, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - object := validDGDRV1Beta2Request() - tt.mutate(object) - messages := validate(t, object) - if tt.wantErr { - require.NotEmpty(t, messages) - return - } - require.Empty(t, messages) - }) - } -} - -func TestGeneratedDGDRV1Beta2ResultSchemas(t *testing.T) { - tests := []struct { - path string - check func(*testing.T, apiextensionsv1.JSONSchemaProps) - }{ - { - path: "../../config/crd/bases/nvidia.com_dynamographdeploymentcandidates.yaml", - check: func(t *testing.T, root apiextensionsv1.JSONSchemaProps) { - spec := root.Properties["spec"] - status := root.Properties["status"] - require.Contains(t, spec.Required, "parameters") - require.Contains(t, spec.Properties, "parameters") - require.Contains(t, status.Properties, "metrics") - require.NotContains(t, status.Properties, "conditions") - require.NotContains(t, status.Properties, "rank") - require.NotContains(t, status.Properties, "experimental") - }, - }, - { - path: "../../config/crd/bases/nvidia.com_dynamographdeploymentruns.yaml", - check: func(t *testing.T, root apiextensionsv1.JSONSchemaProps) { - status := root.Properties["status"] - require.Contains(t, status.Properties, "candidateRefs") - require.NotContains(t, status.Properties, "provenance") - }, - }, - } - - for _, tt := range tests { - t.Run(filepath.Base(tt.path), func(t *testing.T) { - data, err := os.ReadFile(tt.path) - require.NoError(t, err) - crd := &apiextensionsv1.CustomResourceDefinition{} - require.NoError(t, yaml.Unmarshal(data, crd)) - require.Len(t, crd.Spec.Versions, 1) - require.Equal(t, "v1beta2", crd.Spec.Versions[0].Name) - tt.check(t, *crd.Spec.Versions[0].Schema.OpenAPIV3Schema) - }) - } -} - -func validDGDRV1Beta2Request() map[string]interface{} { - return map[string]interface{}{ - "apiVersion": "nvidia.com/v1beta2", - "kind": "DynamoGraphDeploymentRequest", - "metadata": map[string]interface{}{ - "name": "schema-test", - }, - "spec": map[string]interface{}{ - "model": map[string]interface{}{"name": "test/model"}, - "backends": []interface{}{ - "vllm", - }, - "hardware": map[string]interface{}{ - "gpu": map[string]interface{}{ - "sku": "h100", - "budget": int64(8), - }, - }, - "workload": map[string]interface{}{ - "static": map[string]interface{}{ - "isl": int64(1024), - "osl": int64(128), - "numRequestRatio": 1.0, - "concurrency": int64(1), - }, - }, - "objective": map[string]interface{}{ - "mode": "Optimize", - "metric": "ThroughputPerGPU", - "sla": map[string]interface{}{}, - }, - "recommendation": map[string]interface{}{ - "maxCandidates": int64(1), - }, - }, - } -} - -func requestObjective(object map[string]interface{}) map[string]interface{} { - return object["spec"].(map[string]interface{})["objective"].(map[string]interface{}) -} - -func requestStaticWorkload(object map[string]interface{}) map[string]interface{} { - return object["spec"].(map[string]interface{})["workload"].(map[string]interface{})["static"].(map[string]interface{}) -} - -func requireDefaultOptionAWorkload(t *testing.T, spec map[string]interface{}) { - t.Helper() - static := spec["workload"].(map[string]interface{})["static"].(map[string]interface{}) - require.EqualValues(t, 4000, static["isl"]) - require.EqualValues(t, 1000, static["osl"]) - ratio := static["kvLoadRatio"].([]interface{}) - require.Len(t, ratio, 2) - require.EqualValues(t, 0, ratio[0]) - require.EqualValues(t, 1, ratio[1]) -} - -func TestConfigureDGDRV1Beta2CRD(t *testing.T) { - tests := []struct { - name string - crdName string - wantApply bool - wantVersions []string - }{ - { - name: "request retains stable versions", - crdName: dgdrCRDName, - wantApply: true, - wantVersions: []string{"v1alpha1", "v1beta1"}, - }, - { - name: "run is skipped", - crdName: dgdrRunCRDName, - wantVersions: []string{"v1alpha1", "v1beta1", "v1beta2"}, - }, - { - name: "candidate is skipped", - crdName: dgdrCandidateCRD, - wantVersions: []string{"v1alpha1", "v1beta1", "v1beta2"}, - }, - { - name: "unrelated CRD is unchanged", - crdName: "dynamographdeployments.nvidia.com", - wantApply: true, - wantVersions: []string{"v1alpha1", "v1beta1", "v1beta2"}, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - crd := &apiextensionsv1.CustomResourceDefinition{} - crd.Name = tt.crdName - for _, version := range []string{"v1alpha1", "v1beta1", "v1beta2"} { - crd.Spec.Versions = append(crd.Spec.Versions, apiextensionsv1.CustomResourceDefinitionVersion{Name: version}) - } - - if got := configureDGDRV1Beta2CRD(crd); got != tt.wantApply { - t.Fatalf("configureDGDRV1Beta2CRD() = %v, want %v", got, tt.wantApply) - } - var versions []string - for _, version := range crd.Spec.Versions { - versions = append(versions, version.Name) - } - if len(versions) != len(tt.wantVersions) { - t.Fatalf("versions = %v, want %v", versions, tt.wantVersions) - } - for i := range versions { - if versions[i] != tt.wantVersions[i] { - t.Fatalf("versions = %v, want %v", versions, tt.wantVersions) - } - } - }) - } -} From 88e6e3efe66719a1725d19ec7d2c498a22bbb2c6 Mon Sep 17 00:00:00 2001 From: "Dr. Stefan Schimanski" Date: Tue, 13 Oct 2026 14:31:34 +0200 Subject: [PATCH 6/6] fixup! operator/dgdr: refine v1beta2 API contracts Signed-off-by: Dr. Stefan Schimanski --- deploy/operator/docs/fix-api-anchors.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/deploy/operator/docs/fix-api-anchors.py b/deploy/operator/docs/fix-api-anchors.py index 75b882cb603b..41b6dc2ed2ca 100644 --- a/deploy/operator/docs/fix-api-anchors.py +++ b/deploy/operator/docs/fix-api-anchors.py @@ -99,6 +99,10 @@ def project_standalone_dcd_schema(markdown: str) -> str: sys.exit(0) alpha_part = content[:idx] + +# Keep the v1beta1 heading rewrite inside that package. The generated reference +# now contains later API packages with the same Go type names, and renaming their +# headings would recreate ambiguous or missing cross-version anchors. next_package_idx = content.find("\n## ", idx + len(marker)) if next_package_idx == -1: beta_part = content[idx:] @@ -128,6 +132,9 @@ def project_standalone_dcd_schema(markdown: str) -> str: content = alpha_part + beta_part + remaining_packages content = project_standalone_dcd_schema(content) + +# RunSpec aliases RequestSpec, so crd-ref-docs generates a link for the alias +# but no corresponding type section. Point the link at the emitted shared schema. content = content.replace( "[DynamoGraphDeploymentRunSpec](#dynamographdeploymentrunspec)", "[DynamoGraphDeploymentRequestSpec](#dynamographdeploymentrequestspec)",