Skip to content

Commit

Permalink
create a CDS cluster per model (#5916)
Browse files Browse the repository at this point in the history
  • Loading branch information
driev authored Sep 18, 2024
1 parent d28c58c commit 36f6189
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 38 deletions.
32 changes: 0 additions & 32 deletions scheduler/pkg/envoy/processor/hash.go

This file was deleted.

3 changes: 1 addition & 2 deletions scheduler/pkg/envoy/processor/incremental.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ func (p *IncrementalProcessor) setListeners() error {
// newSnapshotVersion increments the current snapshotVersion
// and returns as a string.
func (p *IncrementalProcessor) newSnapshotVersion() string {

// Reset the snapshotVersion if it ever hits max size.
if p.snapshotVersion == math.MaxInt64 {
p.snapshotVersion = 0
Expand Down Expand Up @@ -256,7 +255,7 @@ func (p *IncrementalProcessor) updateEnvoyForModelVersion(modelRouteName string,
return
}

clusterNameBase := server.Name + "_" + computeHashKeyForList(assignment)
clusterNameBase := modelVersion.GetMeta().GetName() + "_" + strconv.FormatInt(int64(modelVersion.GetVersion()), 10)
httpClusterName := clusterNameBase + "_http"
grpcClusterName := clusterNameBase + "_grpc"
p.xdsCache.AddCluster(httpClusterName, modelRouteName, modelVersion.GetModel().GetMeta().GetName(), modelVersion.GetVersion(), false)
Expand Down
8 changes: 4 additions & 4 deletions scheduler/pkg/envoy/processor/incremental_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ func TestUpdateEnvoyForModelVersion(t *testing.T) {
},
traffic: 100,
expectedRoutes: 2,
expectedClusters: 2,
expectedClusters: 4,
},
{
name: "TwoRoutesDifferentClusters",
Expand Down Expand Up @@ -593,7 +593,7 @@ func TestEnvoySettings(t *testing.T) {
createTestModel("model3", "server", 1, []int{1}, 1, []store.ModelReplicaState{store.Available}),
createTestExperiment("exp", []string{"model1", "model2"}, getStrPtr("model1"), getStrPtr("model3")),
},
numExpectedClusters: 4,
numExpectedClusters: 6,
numExpectedRoutes: 4,
experimentActive: true,
experimentExists: true,
Expand All @@ -607,7 +607,7 @@ func TestEnvoySettings(t *testing.T) {
createTestModel("model3", "server", 1, []int{1}, 1, []store.ModelReplicaState{store.Available}),
createTestPipeline("pipe", []string{"model1", "model2", "model3"}, 1),
},
numExpectedClusters: 4,
numExpectedClusters: 6,
numExpectedRoutes: 3,
numExpectedPipelines: 1,
},
Expand Down Expand Up @@ -710,7 +710,7 @@ func TestRollingUpdate(t *testing.T) {
createTestModel("model", "server", 1, []int{0}, 1, []store.ModelReplicaState{store.Available}),
createTestModel("model", "server", 2, []int{0, 1}, 2, []store.ModelReplicaState{store.Available, store.Loading}),
},
numExpectedClusters: 2,
numExpectedClusters: 4,
numExpectedRoutes: 1,
numTrafficSplits: map[string]int{"model": 2},
},
Expand Down

0 comments on commit 36f6189

Please sign in to comment.