Skip to content

Commit

Permalink
fix(obcluster): fixed accessing empty param list when getting min ful…
Browse files Browse the repository at this point in the history
…l resource pool
  • Loading branch information
powerfooI committed Mar 14, 2024
1 parent eb836a9 commit 800aa39
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions internal/dashboard/business/oceanbase/obcluster_usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,16 @@ func GetOBClusterEssentialParameters(ctx context.Context, nn *param.K8sObjectIde
if err != nil {
return nil, httpErr.NewInternal(err.Error())
}
minPoolMemory, err := resource.ParseQuantity(parameters[0].Value)
if err != nil {
return nil, httpErr.NewInternal(err.Error())
}
essentials := &response.OBClusterResources{
MinPoolMemory: minPoolMemory.Value(),

essentials := &response.OBClusterResources{}
if len(parameters) == 0 {
essentials.MinPoolMemory = 5 << 30 // 5 Gi
} else {
minPoolMemory, err := resource.ParseQuantity(parameters[0].Value)
if err != nil {
return nil, httpErr.NewInternal(err.Error())
}
essentials.MinPoolMemory = minPoolMemory.Value()
}
gvservers, err := manager.ListGVServers()
if err != nil {
Expand Down

0 comments on commit 800aa39

Please sign in to comment.