Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@ func TestDynamoComponentDeploymentReconciler_generateLeaderWorkerSet(t *testing.
},
},
MainContainer: &corev1.Container{
Image: "test-image:latest",
Image: "test-image:1.5.0",
Command: []string{
"some",
"dynamo",
Expand Down Expand Up @@ -1333,14 +1333,14 @@ func TestDynamoComponentDeploymentReconciler_generateLeaderWorkerSet(t *testing.
},
{
Name: commonconsts.MainContainerName,
Image: "test-image:latest",
Image: "test-image:1.5.0",
Command: []string{"/bin/sh", "-c"},
Args: []string{"ray start --head --port=6379 && some dynamo command --tensor-parallel-size 4 --pipeline-parallel-size 1 --distributed-executor-backend ray"},
Env: []corev1.EnvVar{
{Name: commonconsts.DynamoComponentEnvVar, Value: commonconsts.ComponentTypeWorker},
{Name: commonconsts.DynamoDiscoveryBackendEnvVar, Value: "kubernetes"},
{Name: "DYN_FORWARDPASS_METRIC_PORT", Value: "20380"},
{Name: "DYN_HEALTH_CHECK_ENABLED", Value: "false"},
{Name: "DYN_HEALTH_CHECK_ENABLED", Value: "true"},
{Name: commonconsts.DynamoNamespaceEnvVar, Value: "default-test-lws-deploy"},
{Name: "DYN_PARENT_DGD_K8S_NAME", Value: "test-lws-deploy"},
{Name: "DYN_PARENT_DGD_K8S_NAMESPACE", Value: "default"},
Expand Down Expand Up @@ -1403,7 +1403,7 @@ func TestDynamoComponentDeploymentReconciler_generateLeaderWorkerSet(t *testing.
TimeoutSeconds: 4,
PeriodSeconds: 5,
SuccessThreshold: 0,
FailureThreshold: 1,
FailureThreshold: 3,
},
ReadinessProbe: &corev1.Probe{
ProbeHandler: corev1.ProbeHandler{
Expand Down Expand Up @@ -1474,14 +1474,14 @@ func TestDynamoComponentDeploymentReconciler_generateLeaderWorkerSet(t *testing.
},
{
Name: commonconsts.MainContainerName,
Image: "test-image:latest",
Image: "test-image:1.5.0",
Command: []string{"/bin/sh", "-c"},
Args: []string{"ray start --address=$(LWS_LEADER_ADDRESS):6379 --block"},
Env: []corev1.EnvVar{
{Name: commonconsts.DynamoComponentEnvVar, Value: commonconsts.ComponentTypeWorker},
{Name: commonconsts.DynamoDiscoveryBackendEnvVar, Value: "kubernetes"},
{Name: "DYN_FORWARDPASS_METRIC_PORT", Value: "20380"},
{Name: "DYN_HEALTH_CHECK_ENABLED", Value: "false"},
{Name: "DYN_HEALTH_CHECK_ENABLED", Value: "true"},
{Name: commonconsts.DynamoNamespaceEnvVar, Value: "default-test-lws-deploy"},
{Name: "DYN_PARENT_DGD_K8S_NAME", Value: "test-lws-deploy"},
{Name: "DYN_PARENT_DGD_K8S_NAMESPACE", Value: "default"},
Expand Down
14 changes: 7 additions & 7 deletions deploy/operator/internal/controller/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func TestLegacyWorkerIdentityUpgradeDoesNotTriggerRollout(t *testing.T) {
ExtraPodSpec: &v1alpha1.ExtraPodSpec{
MainContainer: &corev1.Container{
Name: commonconsts.MainContainerName,
Image: "test-image:latest",
Image: "test-image:1.4.0",
Command: []string{"python3"},
Args: []string{"-m", "dynamo.vllm"},
Resources: corev1.ResourceRequirements{
Expand Down Expand Up @@ -144,7 +144,7 @@ spec:
sizeLimit: 8Gi
containers:
- name: main
image: test-image:latest
image: test-image:1.4.0
command:
- python3
args:
Expand Down Expand Up @@ -295,7 +295,7 @@ spec:
ExtraPodSpec: &v1alpha1.ExtraPodSpec{
MainContainer: &corev1.Container{
Name: commonconsts.MainContainerName,
Image: "test-image:latest",
Image: "test-image:1.4.0",
Command: []string{"python3"},
Args: []string{"-m", "dynamo.vllm"},
Resources: corev1.ResourceRequirements{
Expand Down Expand Up @@ -339,7 +339,7 @@ spec:
sizeLimit: 8Gi
containers:
- name: main
image: test-image:latest
image: test-image:1.4.0
command:
- python3
args:
Expand Down Expand Up @@ -446,7 +446,7 @@ spec:
sizeLimit: 8Gi
containers:
- name: main
image: test-image:latest
image: test-image:1.4.0
command:
- python3
args:
Expand Down Expand Up @@ -868,8 +868,8 @@ spec:
oldPodLabels := tt.childPodLabels(t, oldChild)
newPodLabels := tt.childPodLabels(t, newChild)

t.Log("compare old and new child specs; a change here would trigger a rollout")
Comment thread
xianlubird marked this conversation as resolved.
Resolved
require.Equal(t, specHash(t, oldChild), specHash(t, newChild), "upgrade should not change the child spec hash")
t.Log("compare old and new child specs; an operator-only upgrade must not trigger a rollout")
require.Equal(t, specHash(t, oldChild), specHash(t, newChild), "upgrade should preserve the child spec hash for a pinned older runtime")

t.Log("assert worker pod labels keep the legacy worker identity")
for site, subComponentType := range tt.expectedWorkerSites {
Expand Down
2 changes: 2 additions & 0 deletions deploy/operator/internal/dynamo/component_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/ai-dynamo/dynamo/deploy/operator/api/v1beta1"
commonconsts "github.com/ai-dynamo/dynamo/deploy/operator/internal/consts"
controller_common "github.com/ai-dynamo/dynamo/deploy/operator/internal/controller_common"
"github.com/ai-dynamo/dynamo/deploy/operator/internal/runtimeversion"
corev1 "k8s.io/api/core/v1"
"k8s.io/utils/ptr"
)
Expand Down Expand Up @@ -67,6 +68,7 @@ type ComponentContext struct {
Discovery DiscoveryContext
EPPConfig *v1beta1.EPPConfig
WorkerHashSuffix string
RuntimeVersion *runtimeversion.Version
}

func (b *BaseComponentDefaults) GetBaseContainer(context ComponentContext) (corev1.Container, error) {
Expand Down
11 changes: 9 additions & 2 deletions deploy/operator/internal/dynamo/component_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ package dynamo

import (
"fmt"
"strconv"

"github.com/ai-dynamo/dynamo/deploy/operator/api/v1beta1"
commonconsts "github.com/ai-dynamo/dynamo/deploy/operator/internal/consts"
runtimefeatures "github.com/ai-dynamo/dynamo/deploy/operator/internal/features/runtime"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/intstr"
)
Expand All @@ -25,6 +27,11 @@ func NewWorkerDefaults() *WorkerDefaults {

func (w *WorkerDefaults) GetBaseContainer(context ComponentContext) (corev1.Container, error) {
container := w.getCommonContainer(context)
canaryHealthChecksEnabled := runtimefeatures.CanaryHealthChecks.Enabled(context.RuntimeVersion)
livenessFailureThreshold := int32(1)
if canaryHealthChecksEnabled {
Comment thread
xianlubird marked this conversation as resolved.
Resolved
livenessFailureThreshold = 3
}

// Add system port
container.Ports = []corev1.ContainerPort{
Expand All @@ -49,7 +56,7 @@ func (w *WorkerDefaults) GetBaseContainer(context ComponentContext) (corev1.Cont
},
PeriodSeconds: 5,
TimeoutSeconds: 4, // TimeoutSeconds should be < PeriodSeconds
FailureThreshold: 1, // Note this default FailureThreshold is 3, with 1 a single failure will restart Pod
FailureThreshold: livenessFailureThreshold,
}

// ReadinessProbe in Dynamo worker context doesn't determine that the worker is ready to receive traffic
Expand Down Expand Up @@ -94,7 +101,7 @@ func (w *WorkerDefaults) GetBaseContainer(context ComponentContext) (corev1.Cont
},
{
Name: "DYN_HEALTH_CHECK_ENABLED",
Value: "false",
Value: strconv.FormatBool(canaryHealthChecksEnabled),
},
Comment thread
xianlubird marked this conversation as resolved.
Resolved
{
Name: "NIXL_TELEMETRY_ENABLE",
Expand Down
65 changes: 65 additions & 0 deletions deploy/operator/internal/dynamo/component_worker_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/

package dynamo

import (
"testing"

"github.com/ai-dynamo/dynamo/deploy/operator/internal/runtimeversion"
"github.com/stretchr/testify/require"
)

func TestWorkerDefaultsCanaryHealthCheckVersionGate(t *testing.T) {
tests := []struct {
name string
runtimeVersion *runtimeversion.Version
wantEnabled string
wantLivenessFailureCount int32
}{
{
name: "unknown legacy runtime",
wantEnabled: "false",
wantLivenessFailureCount: 1,
},
{
name: "older runtime",
runtimeVersion: &runtimeversion.Version{Major: 1, Minor: 4, Patch: 9},
wantEnabled: "false",
wantLivenessFailureCount: 1,
},
{
name: "minimum supported runtime",
runtimeVersion: &runtimeversion.Version{Major: 1, Minor: 5, Patch: 0},
wantEnabled: "true",
wantLivenessFailureCount: 3,
},
{
name: "newer runtime",
runtimeVersion: &runtimeversion.Version{Major: 2, Minor: 0, Patch: 0},
wantEnabled: "true",
wantLivenessFailureCount: 3,
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
container, err := NewWorkerDefaults().GetBaseContainer(ComponentContext{
RuntimeVersion: tt.runtimeVersion,
})
require.NoError(t, err)
require.NotNil(t, container.LivenessProbe)
require.Equal(t, tt.wantLivenessFailureCount, container.LivenessProbe.FailureThreshold)

for _, env := range container.Env {
if env.Name == "DYN_HEALTH_CHECK_ENABLED" {
require.Equal(t, tt.wantEnabled, env.Value)
return
}
}
t.Fatal("DYN_HEALTH_CHECK_ENABLED was not rendered")
})
}
}
11 changes: 11 additions & 0 deletions deploy/operator/internal/dynamo/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
"github.com/ai-dynamo/dynamo/deploy/operator/internal/dra"
"github.com/ai-dynamo/dynamo/deploy/operator/internal/features"
gms "github.com/ai-dynamo/dynamo/deploy/operator/internal/gms"
"github.com/ai-dynamo/dynamo/deploy/operator/internal/runtimeversion"
grovev1alpha1 "github.com/ai-dynamo/grove/operator/api/core/v1alpha1"
"github.com/imdario/mergo"
"google.golang.org/protobuf/types/known/wrapperspb"
Expand Down Expand Up @@ -1953,6 +1954,15 @@ func generateComponentContext(component *v1beta1.DynamoComponentDeploymentShared
workerHashSuffix = workerHash
}

var image string
if main := GetMainContainer(component); main != nil {
image = main.Image
}
var resolvedRuntimeVersion *runtimeversion.Version
if version, err := runtimeversion.Resolve(image, component.RuntimeVersionOverride); err == nil {
resolvedRuntimeVersion = &version
Comment thread
xianlubird marked this conversation as resolved.
Resolved
}

componentContext := ComponentContext{
numberOfNodes: numberOfNodes,
ComponentType: string(component.ComponentType),
Expand All @@ -1962,6 +1972,7 @@ func generateComponentContext(component *v1beta1.DynamoComponentDeploymentShared
DynamoNamespace: dynamoNamespace,
EPPConfig: component.EPPConfig,
WorkerHashSuffix: workerHashSuffix,
RuntimeVersion: resolvedRuntimeVersion,
}
return componentContext
}
Expand Down
Loading
Loading