Skip to content

Commit c6fae07

Browse files
support tenant parameter management (#629)
1 parent b478772 commit c6fae07

23 files changed

+432
-14
lines changed

api/types/types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,5 @@ type TenantOperationType string
3333

3434
type ClusterOperationType string
3535
type ClusterOperationStatus string
36+
37+
type ParameterScope string

api/v1alpha1/obparameter_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ type OBParameterSpec struct {
3232
// Important: Run "make" to regenerate code after modifying this file
3333
ClusterName string `json:"clusterName"`
3434
ClusterId int64 `json:"clusterId,omitempty"`
35+
TenantName string `json:"tenantName,omitempty"`
36+
TenantId int64 `json:"tenantId,omitempty"`
3537
Parameter *apitypes.Parameter `json:"parameter"`
3638
}
3739

api/v1alpha1/obtenant_types.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,11 @@ type OBTenantSpec struct {
4747
Pools []ResourcePoolSpec `json:"pools"`
4848

4949
//+kubebuilder:default=PRIMARY
50-
TenantRole apitypes.TenantRole `json:"tenantRole,omitempty"`
51-
Source *TenantSourceSpec `json:"source,omitempty"`
52-
Credentials TenantCredentials `json:"credentials,omitempty"`
53-
Scenario string `json:"scenario,omitempty"`
50+
TenantRole apitypes.TenantRole `json:"tenantRole,omitempty"`
51+
Source *TenantSourceSpec `json:"source,omitempty"`
52+
Credentials TenantCredentials `json:"credentials,omitempty"`
53+
Scenario string `json:"scenario,omitempty"`
54+
Parameters []apitypes.Parameter `json:"parameters,omitempty"`
5455
}
5556

5657
type TenantCredentials struct {
@@ -101,9 +102,10 @@ type OBTenantStatus struct {
101102
OperationContext *tasktypes.OperationContext `json:"operationContext,omitempty"`
102103
TenantRecordInfo TenantRecordInfo `json:"tenantRecordInfo,omitempty"`
103104

104-
TenantRole apitypes.TenantRole `json:"tenantRole,omitempty"`
105-
Source *TenantSourceStatus `json:"source,omitempty"`
106-
Credentials TenantCredentials `json:"credentials,omitempty"`
105+
TenantRole apitypes.TenantRole `json:"tenantRole,omitempty"`
106+
Source *TenantSourceStatus `json:"source,omitempty"`
107+
Credentials TenantCredentials `json:"credentials,omitempty"`
108+
Parameters []apitypes.Parameter `json:"parameters,omitempty"`
107109
}
108110

109111
type TenantSourceStatus struct {

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/oceanbase.oceanbase.com_obparameters.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ spec:
7373
- name
7474
- value
7575
type: object
76+
tenantId:
77+
format: int64
78+
type: integer
79+
tenantName:
80+
type: string
7681
required:
7782
- clusterName
7883
- parameter

config/crd/bases/oceanbase.oceanbase.com_obtenantbackuppolicies.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,18 @@ spec:
484484
type: boolean
485485
obcluster:
486486
type: string
487+
parameters:
488+
items:
489+
properties:
490+
name:
491+
type: string
492+
value:
493+
type: string
494+
required:
495+
- name
496+
- value
497+
type: object
498+
type: array
487499
pools:
488500
items:
489501
properties:
@@ -679,6 +691,18 @@ spec:
679691
- taskStatus
680692
- tasks
681693
type: object
694+
parameters:
695+
items:
696+
properties:
697+
name:
698+
type: string
699+
value:
700+
type: string
701+
required:
702+
- name
703+
- value
704+
type: object
705+
type: array
682706
resourcePool:
683707
items:
684708
properties:

config/crd/bases/oceanbase.oceanbase.com_obtenantoperations.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,18 @@ spec:
340340
type: boolean
341341
obcluster:
342342
type: string
343+
parameters:
344+
items:
345+
properties:
346+
name:
347+
type: string
348+
value:
349+
type: string
350+
required:
351+
- name
352+
- value
353+
type: object
354+
type: array
343355
pools:
344356
items:
345357
properties:
@@ -535,6 +547,18 @@ spec:
535547
- taskStatus
536548
- tasks
537549
type: object
550+
parameters:
551+
items:
552+
properties:
553+
name:
554+
type: string
555+
value:
556+
type: string
557+
required:
558+
- name
559+
- value
560+
type: object
561+
type: array
538562
resourcePool:
539563
items:
540564
properties:
@@ -865,6 +889,18 @@ spec:
865889
type: boolean
866890
obcluster:
867891
type: string
892+
parameters:
893+
items:
894+
properties:
895+
name:
896+
type: string
897+
value:
898+
type: string
899+
required:
900+
- name
901+
- value
902+
type: object
903+
type: array
868904
pools:
869905
items:
870906
properties:
@@ -1060,6 +1096,18 @@ spec:
10601096
- taskStatus
10611097
- tasks
10621098
type: object
1099+
parameters:
1100+
items:
1101+
properties:
1102+
name:
1103+
type: string
1104+
value:
1105+
type: string
1106+
required:
1107+
- name
1108+
- value
1109+
type: object
1110+
type: array
10631111
resourcePool:
10641112
items:
10651113
properties:

config/crd/bases/oceanbase.oceanbase.com_obtenants.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,18 @@ spec:
9191
type: boolean
9292
obcluster:
9393
type: string
94+
parameters:
95+
items:
96+
properties:
97+
name:
98+
type: string
99+
value:
100+
type: string
101+
required:
102+
- name
103+
- value
104+
type: object
105+
type: array
94106
pools:
95107
items:
96108
properties:
@@ -286,6 +298,18 @@ spec:
286298
- taskStatus
287299
- tasks
288300
type: object
301+
parameters:
302+
items:
303+
properties:
304+
name:
305+
type: string
306+
value:
307+
type: string
308+
required:
309+
- name
310+
- value
311+
type: object
312+
type: array
289313
resourcePool:
290314
items:
291315
properties:

deploy/operator.yaml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10290,6 +10290,11 @@ spec:
1029010290
- name
1029110291
- value
1029210292
type: object
10293+
tenantId:
10294+
format: int64
10295+
type: integer
10296+
tenantName:
10297+
type: string
1029310298
required:
1029410299
- clusterName
1029510300
- parameter
@@ -14052,6 +14057,18 @@ spec:
1405214057
type: boolean
1405314058
obcluster:
1405414059
type: string
14060+
parameters:
14061+
items:
14062+
properties:
14063+
name:
14064+
type: string
14065+
value:
14066+
type: string
14067+
required:
14068+
- name
14069+
- value
14070+
type: object
14071+
type: array
1405514072
pools:
1405614073
items:
1405714074
properties:
@@ -14247,6 +14264,18 @@ spec:
1424714264
- taskStatus
1424814265
- tasks
1424914266
type: object
14267+
parameters:
14268+
items:
14269+
properties:
14270+
name:
14271+
type: string
14272+
value:
14273+
type: string
14274+
required:
14275+
- name
14276+
- value
14277+
type: object
14278+
type: array
1425014279
resourcePool:
1425114280
items:
1425214281
properties:
@@ -15311,6 +15340,18 @@ spec:
1531115340
type: boolean
1531215341
obcluster:
1531315342
type: string
15343+
parameters:
15344+
items:
15345+
properties:
15346+
name:
15347+
type: string
15348+
value:
15349+
type: string
15350+
required:
15351+
- name
15352+
- value
15353+
type: object
15354+
type: array
1531415355
pools:
1531515356
items:
1531615357
properties:
@@ -15506,6 +15547,18 @@ spec:
1550615547
- taskStatus
1550715548
- tasks
1550815549
type: object
15550+
parameters:
15551+
items:
15552+
properties:
15553+
name:
15554+
type: string
15555+
value:
15556+
type: string
15557+
required:
15558+
- name
15559+
- value
15560+
type: object
15561+
type: array
1550915562
resourcePool:
1551015563
items:
1551115564
properties:
@@ -15836,6 +15889,18 @@ spec:
1583615889
type: boolean
1583715890
obcluster:
1583815891
type: string
15892+
parameters:
15893+
items:
15894+
properties:
15895+
name:
15896+
type: string
15897+
value:
15898+
type: string
15899+
required:
15900+
- name
15901+
- value
15902+
type: object
15903+
type: array
1583915904
pools:
1584015905
items:
1584115906
properties:
@@ -16031,6 +16096,18 @@ spec:
1603116096
- taskStatus
1603216097
- tasks
1603316098
type: object
16099+
parameters:
16100+
items:
16101+
properties:
16102+
name:
16103+
type: string
16104+
value:
16105+
type: string
16106+
required:
16107+
- name
16108+
- value
16109+
type: object
16110+
type: array
1603416111
resourcePool:
1603516112
items:
1603616113
properties:
@@ -16717,6 +16794,18 @@ spec:
1671716794
type: boolean
1671816795
obcluster:
1671916796
type: string
16797+
parameters:
16798+
items:
16799+
properties:
16800+
name:
16801+
type: string
16802+
value:
16803+
type: string
16804+
required:
16805+
- name
16806+
- value
16807+
type: object
16808+
type: array
1672016809
pools:
1672116810
items:
1672216811
properties:
@@ -16912,6 +17001,18 @@ spec:
1691217001
- taskStatus
1691317002
- tasks
1691417003
type: object
17004+
parameters:
17005+
items:
17006+
properties:
17007+
name:
17008+
type: string
17009+
value:
17010+
type: string
17011+
required:
17012+
- name
17013+
- value
17014+
type: object
17015+
type: array
1691517016
resourcePool:
1691617017
items:
1691717018
properties:

internal/const/oceanbase/labels.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ See the Mulan PSL v2 for more details.
1313
package oceanbase
1414

1515
const (
16+
LabelRefOBTenant = "ref-obtenant"
1617
LabelRefOBCluster = "ref-obcluster"
1718
LabelRefOBZone = "ref-obzone"
1819
LabelRefOBServer = "ref-observer"

0 commit comments

Comments
 (0)