Skip to content

Commit f554c3b

Browse files
make replica type take effect when add or modify tenant unit
1 parent df44ef9 commit f554c3b

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

internal/dashboard/business/oceanbase/obtenant_pool.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,17 @@ func CreateTenantPool(ctx context.Context, nn param.TenantPoolName, p *param.Ten
6363
maxIops = int(p.UnitConfig.MaxIops)
6464
}
6565

66+
replicaType := "Full"
67+
if p.Type != "" {
68+
replicaType = p.Type
69+
}
6670
for _, zone := range clusterCR.Spec.Topology {
6771
if zone.Zone == nn.ZoneName {
6872
tenantCR.Spec.Pools = append(tenantCR.Spec.Pools, v1alpha1.ResourcePoolSpec{
6973
Zone: nn.ZoneName,
7074
Priority: p.Priority,
7175
Type: &v1alpha1.LocalityType{
72-
Name: "Full",
76+
Name: replicaType,
7377
Replica: 1,
7478
IsActive: true,
7579
},
@@ -149,6 +153,9 @@ func PatchTenantPool(ctx context.Context, nn param.TenantPoolName, p *param.Tena
149153
for i, pool := range tenantCR.Spec.Pools {
150154
if pool.Zone == nn.ZoneName {
151155
tenantCR.Spec.Pools[i].Priority = p.Priority
156+
if p.Type != "" {
157+
tenantCR.Spec.Pools[i].Type.Name = p.Type
158+
}
152159
if tenantCR.Spec.Pools[i].UnitConfig != nil {
153160
if cpuCount, err := resource.ParseQuantity(p.UnitConfig.CPUCount); err == nil {
154161
tenantCR.Spec.Pools[i].UnitConfig.MaxCPU = cpuCount

internal/dashboard/model/param/obtenant_param.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ type PatchTenant struct {
114114
}
115115

116116
type TenantPoolSpec struct {
117-
Priority int `json:"priority"`
117+
Priority int `json:"priority"`
118+
// Enum: Full, Readonly, Columnstore
119+
Type string `json:"type,omitempty"`
118120
UnitConfig UnitConfig `json:"unitConfig"`
119121
}
120122

0 commit comments

Comments
 (0)