Repository navigation
feat(operator): hash effective runtime profiles #12617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,7 @@ import ( | |
|
|
||
| "github.com/ai-dynamo/dynamo/deploy/operator/api/v1alpha1" | ||
| "github.com/ai-dynamo/dynamo/deploy/operator/api/v1beta1" | ||
| runtimefeatures "github.com/ai-dynamo/dynamo/deploy/operator/internal/features/runtime" | ||
| ) | ||
|
|
||
| const dgdWorkerHashPlaceholderValue = "worker-hash-placeholder" | ||
|
|
@@ -60,9 +61,10 @@ func ComputeDGDWorkersSpecHash(dgd *v1beta1.DynamoGraphDeployment) (string, erro | |
| } | ||
|
|
||
| type workerTemplate struct { | ||
| Labels map[string]string `json:"labels,omitempty"` | ||
| Annotations map[string]string `json:"annotations,omitempty"` | ||
| Spec v1beta1.DynamoComponentDeploymentSpec `json:"spec"` | ||
| Labels map[string]string `json:"labels,omitempty"` | ||
| Annotations map[string]string `json:"annotations,omitempty"` | ||
| RuntimeProfile *runtimefeatures.RuntimeProfile `json:"runtimeProfile,omitempty"` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs thought why it is correct to add the gates to the hash. And further, what it means when gates changes, or gates are introduced in a version, but are false (then the hash should not change?). And we need a plan for when gates become true, whether we tolerate automatic rollouts, in general or only by opt-in. |
||
| Spec v1beta1.DynamoComponentDeploymentSpec `json:"spec"` | ||
| } | ||
|
|
||
| workerDCDs := make(map[string]workerTemplate, len(dcds)) | ||
|
|
@@ -75,10 +77,15 @@ func ComputeDGDWorkersSpecHash(dgd *v1beta1.DynamoGraphDeployment) (string, erro | |
| if _, exists := workerDCDs[componentName]; exists { | ||
| return "", fmt.Errorf("duplicate generated worker DCD component name %q", componentName) | ||
| } | ||
|
|
||
| // Hash effective gate decisions alongside the generated worker template. | ||
| profile := runtimeProfileForComponent(&dcd.Spec.DynamoComponentDeploymentSharedSpec) | ||
|
|
||
| workerDCDs[componentName] = workerTemplate{ | ||
| Labels: GetDCDKubeLabels(dcd), | ||
| Annotations: GetDCDKubeAnnotations(dcd), | ||
| Spec: workerHashSpec(dcd), | ||
| Labels: GetDCDKubeLabels(dcd), | ||
| Annotations: GetDCDKubeAnnotations(dcd), | ||
| RuntimeProfile: nonEmptyRuntimeProfile(profile), | ||
| Spec: workerHashSpec(dcd), | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -101,8 +108,18 @@ func workerHashSpec(dcd *v1beta1.DynamoComponentDeployment) v1beta1.DynamoCompon | |
| spec.MinAvailable = nil | ||
| spec.ScalingAdapter = nil | ||
|
|
||
| // RuntimeVersionOverride has no rendered Pod effect yet. | ||
| // Hash the resolved rendering profile rather than this raw optional input. | ||
| spec.RuntimeVersionOverride = "" | ||
|
|
||
| return *spec | ||
| } | ||
|
|
||
| func nonEmptyRuntimeProfile(profile runtimefeatures.RuntimeProfile) *runtimefeatures.RuntimeProfile { | ||
| // Preserve the existing hash shape until at least one runtime gate is enabled. | ||
| if profile.IsEmpty() { | ||
| return nil | ||
| } | ||
|
|
||
| // Include enabled decisions in the canonical worker hash input. | ||
| return &profile | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package dynamo | ||
|
|
||
| import ( | ||
| "github.com/ai-dynamo/dynamo/deploy/operator/api/v1beta1" | ||
| runtimefeatures "github.com/ai-dynamo/dynamo/deploy/operator/internal/features/runtime" | ||
| "github.com/ai-dynamo/dynamo/deploy/operator/internal/runtimeversion" | ||
| ) | ||
|
|
||
| // runtimeProfileForComponent resolves and evaluates the component's runtime gates. | ||
| func runtimeProfileForComponent(component *v1beta1.DynamoComponentDeploymentSharedSpec) runtimefeatures.RuntimeProfile { | ||
| // Keep legacy behavior when no component inputs are available. | ||
| if component == nil { | ||
| return runtimefeatures.RuntimeProfile{} | ||
| } | ||
|
|
||
| // Read the effective main image used by runtime version resolution. | ||
| image := "" | ||
| if main := GetMainContainer(component); main != nil { | ||
| image = main.Image | ||
| } | ||
|
|
||
| // Unresolvable legacy images keep every runtime-dependent default disabled. | ||
| version, err := runtimeversion.Resolve(image, component.RuntimeVersionOverride) | ||
| if err != nil { | ||
| return runtimefeatures.RuntimeProfile{} | ||
| } | ||
|
|
||
| // Evaluate the centralized gate set for the resolved compatibility version. | ||
| return runtimefeatures.ProfileForVersion(&version) | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.