Skip to content

Commit

Permalink
pkg/models/config: Always set load balancer default value
Browse files Browse the repository at this point in the history
Signed-off-by: Din Music <din.music@din-cloud.com>
  • Loading branch information
MusicDin committed Apr 15, 2024
1 parent b439763 commit 7fa1472
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
5 changes: 1 addition & 4 deletions pkg/models/config/cluster_nodes_lb.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ func (lb *LB) SetDefaults() {
lb.Instances[i].CPU = defaults.Default(lb.Instances[i].CPU, lb.Default.CPU)
lb.Instances[i].RAM = defaults.Default(lb.Instances[i].RAM, lb.Default.RAM)
lb.Instances[i].MainDiskSize = defaults.Default(lb.Instances[i].MainDiskSize, lb.Default.MainDiskSize)

if len(lb.Instances) > 1 {
lb.Instances[i].Priority = defaults.Default(lb.Instances[i].Priority, &defaultPriority)
}
lb.Instances[i].Priority = defaults.Default(lb.Instances[i].Priority, &defaultPriority)
}
}

Expand Down
1 change: 0 additions & 1 deletion pkg/models/config/cluster_nodes_lb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ func TestLB_Defaults(t *testing.T) {
defaults.Assign(&lb2)

assert.Nil(t, lb1.VirtualRouterId, "LB VRID is set even if only one instance is configured!")
assert.Nil(t, lb1.Instances[0].Priority, "LB instance priority is set even if only one instance is configured!")
assert.Equal(t, &defaultVRID, lb2.VirtualRouterId, "Default LB VRID is not set when multiple instances are configured!")
assert.Equal(t, &defaultPriority, lb2.Instances[0].Priority, "Default LB instance priority is not set when multiple instances are configured!")
}
Expand Down

0 comments on commit 7fa1472

Please sign in to comment.