Skip to content

Commit

Permalink
serverset: Set Zone to AUTO
Browse files Browse the repository at this point in the history
  • Loading branch information
wkahlmann-ionos committed Nov 26, 2024
1 parent 5aedd8c commit 14e2b36
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion internal/controller/serverset/server_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ func fromServerSetToServer(cr *v1alpha1.ServerSet, replicaIndex, version int) v1

// GetZoneFromIndex returns ZONE_2 for odd and ZONE_1 for even index
func GetZoneFromIndex(index int) string {
return fmt.Sprintf("ZONE_%d", index%2+1)
return fmt.Sprintf("AUTO")
// return fmt.Sprintf("ZONE_%d", index%2+1)
}

func (k *kubeServerController) Ensure(ctx context.Context, cr *v1alpha1.ServerSet, replicaIndex, version, volumeVersion int) error {
Expand Down
15 changes: 10 additions & 5 deletions internal/controller/serverset/server_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,40 @@ func TestGetZoneFromIndex(t *testing.T) {
args: args{
index: 0,
},
want: "ZONE_1",
want: "AUTO",
// want: "ZONE_1",
},
{
name: "index1ExpectedZone_2",
args: args{
index: 1,
},
want: "ZONE_2",
want: "AUTO",
// want: "ZONE_2",
},
{
name: "index2ExpectedZone_1",
args: args{
index: 2,
},
want: "ZONE_1",
want: "AUTO",
// want: "ZONE_1",
},
{
name: "index10ExpectedZone_1",
args: args{
index: 10,
},
want: "ZONE_1",
want: "AUTO",
// want: "ZONE_1",
},
{
name: "index111ExpectedZone_2",
args: args{
index: 111,
},
want: "ZONE_2",
want: "AUTO",
// want: "ZONE_2",
},
}
for _, tt := range tests {
Expand Down

0 comments on commit 14e2b36

Please sign in to comment.