Skip to content

Commit

Permalink
RayService: Omits Min and Max replicas from hash calculation (#2172)
Browse files Browse the repository at this point in the history
  • Loading branch information
kpitzen committed May 29, 2024
1 parent b5ec507 commit aeb8b03
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ray-operator/controllers/ray/rayservice_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,8 @@ func generateHashWithoutReplicasAndWorkersToDelete(rayClusterSpec rayv1.RayClust
updatedRayClusterSpec := rayClusterSpec.DeepCopy()
for i := 0; i < len(updatedRayClusterSpec.WorkerGroupSpecs); i++ {
updatedRayClusterSpec.WorkerGroupSpecs[i].Replicas = nil
updatedRayClusterSpec.WorkerGroupSpecs[i].MaxReplicas = nil
updatedRayClusterSpec.WorkerGroupSpecs[i].MinReplicas = nil
updatedRayClusterSpec.WorkerGroupSpecs[i].ScaleStrategy.WorkersToDelete = nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func TestGetClusterAction(t *testing.T) {
Replicas: pointer.Int32(2),
MinReplicas: pointer.Int32(1),
MaxReplicas: pointer.Int32(4),
GroupName: "worker-group-1",
},
},
}
Expand All @@ -85,7 +86,7 @@ func TestGetClusterAction(t *testing.T) {

// Test Case 3: Different WorkerGroupSpecs should lead to RolloutNew.
clusterSpec3 := clusterSpec1.DeepCopy()
clusterSpec3.WorkerGroupSpecs[0].MinReplicas = pointer.Int32(5)
clusterSpec3.WorkerGroupSpecs[0].GroupName = "worker-group-2"
action, err = getClusterAction(clusterSpec1, *clusterSpec3)
assert.Nil(t, err)
assert.Equal(t, RolloutNew, action)
Expand Down Expand Up @@ -145,7 +146,7 @@ func TestGetClusterAction(t *testing.T) {

// Test Case 9: Changing an existing WorkerGroupSpec outside of Replicas/WorkersToDelete *and* adding a new WorkerGroupSpec should lead to RolloutNew.
clusterSpec9 := clusterSpec1.DeepCopy()
clusterSpec9.WorkerGroupSpecs[0].MaxReplicas = pointer.Int32(5)
clusterSpec9.WorkerGroupSpecs[0].GroupName = "worker-group-3"
clusterSpec9.WorkerGroupSpecs = append(clusterSpec9.WorkerGroupSpecs, rayv1.WorkerGroupSpec{
Replicas: pointer.Int32(2),
MinReplicas: pointer.Int32(1),
Expand Down

0 comments on commit aeb8b03

Please sign in to comment.