Skip to content

Commit fd0f936

Browse files
authored
feat: support to deploy oblogservice and oceanbase.ai (#933)
1 parent 99e87b0 commit fd0f936

95 files changed

Lines changed: 34912 additions & 22405 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.gitignore‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,14 @@ vendor/
2828
cover.out
2929
testbin/*
3030
custom_scripts/*
31+
build/ss/
32+
build/scripts/observer-prestart-wrapper.sh
3133
insert_license.py
3234
deploy/*secret*
3335

36+
# Local OceanBase AI test manifests
37+
/example/oceanbase-ai/
38+
3439

3540
# Kubernetes Generated files - skip generated files, except for vendored files
3641
# !vendor/**/zz_generated.*

‎api/types/deepcopy.go‎

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,3 +285,162 @@ func (in *OBServerTemplate) DeepCopy() *OBServerTemplate {
285285
in.DeepCopyInto(out)
286286
return out
287287
}
288+
289+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
290+
func (in *LogServiceTemplate) DeepCopyInto(out *LogServiceTemplate) {
291+
*out = *in
292+
in.Resource.DeepCopyInto(&out.Resource)
293+
if in.Storage != nil {
294+
in, out := &in.Storage, &out.Storage
295+
*out = (*in).DeepCopy()
296+
}
297+
}
298+
299+
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LogServiceTemplate.
300+
func (in *LogServiceTemplate) DeepCopy() *LogServiceTemplate {
301+
if in == nil {
302+
return nil
303+
}
304+
out := new(LogServiceTemplate)
305+
in.DeepCopyInto(out)
306+
return out
307+
}
308+
309+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
310+
func (in *LogServiceZoneTopology) DeepCopyInto(out *LogServiceZoneTopology) {
311+
*out = *in
312+
if in.Resource != nil {
313+
in, out := &in.Resource, &out.Resource
314+
*out = new(ResourceSpec)
315+
(*in).DeepCopyInto(*out)
316+
}
317+
if in.NodeSelector != nil {
318+
in, out := &in.NodeSelector, &out.NodeSelector
319+
*out = make(map[string]string, len(*in))
320+
for key, val := range *in {
321+
(*out)[key] = val
322+
}
323+
}
324+
if in.Affinity != nil {
325+
in, out := &in.Affinity, &out.Affinity
326+
*out = new(corev1.Affinity)
327+
(*in).DeepCopyInto(*out)
328+
}
329+
if in.Tolerations != nil {
330+
in, out := &in.Tolerations, &out.Tolerations
331+
*out = make([]corev1.Toleration, len(*in))
332+
for i := range *in {
333+
(*in)[i].DeepCopyInto(&(*out)[i])
334+
}
335+
}
336+
}
337+
338+
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LogServiceZoneTopology.
339+
func (in *LogServiceZoneTopology) DeepCopy() *LogServiceZoneTopology {
340+
if in == nil {
341+
return nil
342+
}
343+
out := new(LogServiceZoneTopology)
344+
in.DeepCopyInto(out)
345+
return out
346+
}
347+
348+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
349+
func (in *LogServiceStorageSpec) DeepCopyInto(out *LogServiceStorageSpec) {
350+
*out = *in
351+
if in.StoreStorage != nil {
352+
in, out := &in.StoreStorage, &out.StoreStorage
353+
*out = new(StorageSpec)
354+
(*in).DeepCopyInto(*out)
355+
}
356+
if in.LogStorage != nil {
357+
in, out := &in.LogStorage, &out.LogStorage
358+
*out = new(StorageSpec)
359+
(*in).DeepCopyInto(*out)
360+
}
361+
}
362+
363+
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LogServiceStorageSpec.
364+
func (in *LogServiceStorageSpec) DeepCopy() *LogServiceStorageSpec {
365+
if in == nil {
366+
return nil
367+
}
368+
out := new(LogServiceStorageSpec)
369+
in.DeepCopyInto(out)
370+
return out
371+
}
372+
373+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
374+
func (in *ObjectStoreConfig) DeepCopyInto(out *ObjectStoreConfig) {
375+
*out = *in
376+
}
377+
378+
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectStoreConfig.
379+
func (in *ObjectStoreConfig) DeepCopy() *ObjectStoreConfig {
380+
if in == nil {
381+
return nil
382+
}
383+
out := new(ObjectStoreConfig)
384+
in.DeepCopyInto(out)
385+
return out
386+
}
387+
388+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
389+
func (in *LogServiceZoneReplicaStatus) DeepCopyInto(out *LogServiceZoneReplicaStatus) {
390+
*out = *in
391+
}
392+
393+
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LogServiceZoneReplicaStatus.
394+
func (in *LogServiceZoneReplicaStatus) DeepCopy() *LogServiceZoneReplicaStatus {
395+
if in == nil {
396+
return nil
397+
}
398+
out := new(LogServiceZoneReplicaStatus)
399+
in.DeepCopyInto(out)
400+
return out
401+
}
402+
403+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
404+
func (in *LogServiceNodeReplicaStatus) DeepCopyInto(out *LogServiceNodeReplicaStatus) {
405+
*out = *in
406+
}
407+
408+
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LogServiceNodeReplicaStatus.
409+
func (in *LogServiceNodeReplicaStatus) DeepCopy() *LogServiceNodeReplicaStatus {
410+
if in == nil {
411+
return nil
412+
}
413+
out := new(LogServiceNodeReplicaStatus)
414+
in.DeepCopyInto(out)
415+
return out
416+
}
417+
418+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
419+
func (in *SharedStorageSpec) DeepCopyInto(out *SharedStorageSpec) {
420+
*out = *in
421+
}
422+
423+
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SharedStorageSpec.
424+
func (in *SharedStorageSpec) DeepCopy() *SharedStorageSpec {
425+
if in == nil {
426+
return nil
427+
}
428+
out := new(SharedStorageSpec)
429+
in.DeepCopyInto(out)
430+
return out
431+
}
432+
433+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
434+
func (in *LogServiceReference) DeepCopyInto(out *LogServiceReference) {
435+
*out = *in
436+
}
437+
438+
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LogServiceReference.
439+
func (in *LogServiceReference) DeepCopy() *LogServiceReference {
440+
if in == nil {
441+
return nil
442+
}
443+
out := new(LogServiceReference)
444+
in.DeepCopyInto(out)
445+
return out
446+
}

‎api/types/logservice.go‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
Copyright (c) 2023 OceanBase
3+
ob-operator is licensed under Mulan PSL v2.
4+
You can use this software according to the terms and conditions of the Mulan PSL v2.
5+
You may obtain a copy of Mulan PSL v2 at:
6+
http://license.coscl.org.cn/MulanPSL2
7+
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+
See the Mulan PSL v2 for more details.
11+
*/
12+
13+
package types
14+
15+
import corev1 "k8s.io/api/core/v1"
16+
17+
type LogServiceTemplate struct {
18+
Image string `json:"image"`
19+
Resource ResourceSpec `json:"resource"`
20+
Storage *LogServiceStorageSpec `json:"storage"`
21+
}
22+
23+
type LogServiceZoneTopology struct {
24+
Zone string `json:"zone"`
25+
Replica int `json:"replica"`
26+
Resource *ResourceSpec `json:"resource,omitempty"`
27+
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
28+
Affinity *corev1.Affinity `json:"affinity,omitempty"`
29+
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
30+
RpcPort int32 `json:"rpcPort,omitempty"`
31+
HttpPort int32 `json:"httpPort,omitempty"`
32+
}
33+
34+
type ObjectStoreConfig struct {
35+
BucketURL string `json:"bucketURL"`
36+
SecretRef corev1.LocalObjectReference `json:"secretRef"`
37+
}
38+
39+
type LogServiceStorageSpec struct {
40+
StoreStorage *StorageSpec `json:"storeStorage"`
41+
LogStorage *StorageSpec `json:"logStorage"`
42+
}
43+
44+
type LogServiceZoneReplicaStatus struct {
45+
Zone string `json:"zone"`
46+
Status string `json:"status"`
47+
}
48+
49+
type LogServiceNodeReplicaStatus struct {
50+
NodeName string `json:"nodeName"`
51+
Status string `json:"status"`
52+
}

‎api/types/oceanbase_storage.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ package types
1414

1515
type OceanbaseStorageSpec struct {
1616
DataStorage *StorageSpec `json:"dataStorage"`
17-
RedoLogStorage *StorageSpec `json:"redoLogStorage"`
17+
RedoLogStorage *StorageSpec `json:"redoLogStorage,omitempty"`
1818
LogStorage *StorageSpec `json:"logStorage"`
1919
}

‎api/types/shared_storage.go‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
Copyright (c) 2023 OceanBase
3+
ob-operator is licensed under Mulan PSL v2.
4+
You can use this software according to the terms and conditions of the Mulan PSL v2.
5+
You may obtain a copy of Mulan PSL v2 at:
6+
http://license.coscl.org.cn/MulanPSL2
7+
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+
See the Mulan PSL v2 for more details.
11+
*/
12+
13+
package types
14+
15+
import corev1 "k8s.io/api/core/v1"
16+
17+
type SharedStorageSpec struct {
18+
BucketURL string `json:"bucketURL"`
19+
SecretRef corev1.LocalObjectReference `json:"secretRef"`
20+
MaxIOPS string `json:"maxIOPS,omitempty"`
21+
MaxBandwidth string `json:"maxBandwidth,omitempty"`
22+
}
23+
24+
type LogServiceReference struct {
25+
Name string `json:"name"`
26+
}

‎api/v1alpha1/obcluster_types.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ type OBClusterSpec struct {
4444
ServiceAccount string `json:"serviceAccount,omitempty"`
4545
//+kubebuilder:default=htap
4646
Scenario string `json:"scenario,omitempty"`
47+
48+
//+kubebuilder:default=normal
49+
//+kubebuilder:validation:Enum=normal;shared_storage
50+
DeploymentMode string `json:"deploymentMode,omitempty"`
51+
SharedStorageInfo *apitypes.SharedStorageSpec `json:"sharedStorageInfo,omitempty"`
52+
LogServiceRef *apitypes.LogServiceReference `json:"logServiceRef,omitempty"`
4753
}
4854

4955
// OBClusterStatus defines the observed state of OBCluster

0 commit comments

Comments
 (0)