-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Support Oceanbase Cluster (#5124)
- Loading branch information
Showing
18 changed files
with
490 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: v2 | ||
name: oceanbase-cluster | ||
description: A oceanbase cluster Helm chart for KubeBlocks. | ||
|
||
type: application | ||
|
||
version: 0.0.1-alpha1 | ||
|
||
appVersion: "4.2.0.0-100010032023083021" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* Copyright (c) 2021 OceanBase | ||
* OceanBase CE is licensed under Mulan PubL v2. | ||
* You can use this software according to the terms and conditions of the Mulan PubL v2. | ||
* You may obtain a copy of Mulan PubL v2 at: | ||
* http://license.coscl.org.cn/MulanPubL-2.0 | ||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, | ||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, | ||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. | ||
* See the Mulan PubL v2 for more details. | ||
*/ | ||
|
||
Unlimited scalable distributed database for data-intensive transactional and real-time operational analytics workloads, with ultra-fast performance that has once achieved world records in the TPC-C benchmark test. | ||
|
||
OceanBase has served over 400 customers across the globe and has been supporting all mission critical systems in Alipay. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "oceanbase.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "oceanbase.fullname" -}} | ||
{{- if .Values.fullnameOverride }} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- $name := default .Chart.Name .Values.nameOverride }} | ||
{{- if contains $name .Release.Name }} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "oceanbase.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "oceanbase.labels" -}} | ||
helm.sh/chart: {{ include "oceanbase.chart" . }} | ||
{{ include "oceanbase.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "oceanbase.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "oceanbase.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "oceanbase.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "oceanbase.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
apiVersion: apps.kubeblocks.io/v1alpha1 | ||
kind: Cluster | ||
metadata: | ||
name: {{ include "oceanbase.fullname" . }} | ||
labels: | ||
{{- include "oceanbase.labels" . | nindent 4 }} | ||
spec: | ||
clusterDefinitionRef: oceanbase | ||
clusterVersionRef: oceanbase-{{ default .Chart.AppVersion .Values.clusterVersionOverride }} | ||
terminationPolicy: {{ .Values.terminationPolicy }} | ||
componentSpecs: | ||
- name: ob-bundle | ||
componentDefRef: ob-bundle | ||
serviceAccountName: {{ .Values.clusterName }}-observer-sa | ||
replicas: {{ .Values.replicas | default 1 }} | ||
volumeClaimTemplates: | ||
{{- range $key, $val := .Values.resources.storages }} | ||
- name: {{ $key }} | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: {{ $val | quote }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
name: {{ .Values.clusterName }}-statefulset-reader | ||
namespace: {{ .Release.Namespace | quote }} | ||
labels: | ||
{{- include "oceanbase.labels" . | nindent 4 }} | ||
rules: | ||
- apiGroups: ["apps"] # "" indicates the core API group | ||
resources: ["statefulsets"] | ||
verbs: ["get", "watch", "list"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: {{ .Values.clusterName }}-read-statefulsets | ||
namespace: {{ .Release.Namespace | quote }} | ||
labels: | ||
{{- include "oceanbase.labels" . | nindent 4 }} | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ .Values.clusterName }}-observer-sa | ||
- kind: ServiceAccount | ||
name: kb-{{ .Values.clusterName }} | ||
roleRef: | ||
kind: Role | ||
name: {{ .Values.clusterName }}-statefulset-reader | ||
apiGroup: rbac.authorization.k8s.io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ .Values.clusterName }}-observer-sa | ||
namespace: {{ .Release.Namespace | quote }} | ||
labels: | ||
{{- include "oceanbase.labels" . | nindent 4 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Default values for oceanbase-cluster. | ||
# This is a YAML-formatted file. | ||
# Declare variables to be passed into your templates. | ||
|
||
|
||
nameOverride: "" | ||
fullnameOverride: "" | ||
clusterVersionOverride: "4.2.0.0-100010032023083021" | ||
|
||
terminationPolicy: "Delete" | ||
|
||
clusterName: obcluster | ||
|
||
replicas: 3 | ||
|
||
resources: | ||
cpu: 2.2 | ||
memory: 11Gi | ||
storages: | ||
data-file: 50Gi | ||
data-log: 50Gi | ||
log: 20Gi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: v2 | ||
name: oceanbase | ||
description: "Unlimited scalable distributed database for data-intensive transactional and real-time operational analytics workloads, with ultra-fast performance that has once achieved world records in the TPC-C benchmark test. OceanBase has served over 400 customers across the globe and has been supporting all mission critical systems in Alipay." | ||
|
||
type: application | ||
|
||
version: 0.0.1-alpha1 | ||
|
||
appVersion: "4.2.0.0-100010032023083021" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* Copyright (c) 2021 OceanBase | ||
* OceanBase CE is licensed under Mulan PubL v2. | ||
* You can use this software according to the terms and conditions of the Mulan PubL v2. | ||
* You may obtain a copy of Mulan PubL v2 at: | ||
* http://license.coscl.org.cn/MulanPubL-2.0 | ||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, | ||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, | ||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. | ||
* See the Mulan PubL v2 for more details. | ||
*/ | ||
|
||
Unlimited scalable distributed database for data-intensive transactional and real-time operational analytics workloads, with ultra-fast performance that has once achieved world records in the TPC-C benchmark test. | ||
|
||
OceanBase has served over 400 customers across the globe and has been supporting all mission critical systems in Alipay. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "oceanbase.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "oceanbase.fullname" -}} | ||
{{- if .Values.fullnameOverride }} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- $name := default .Chart.Name .Values.nameOverride }} | ||
{{- if contains $name .Release.Name }} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "oceanbase.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "oceanbase.labels" -}} | ||
helm.sh/chart: {{ include "oceanbase.chart" . }} | ||
{{ include "oceanbase.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "oceanbase.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "oceanbase.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "oceanbase.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "oceanbase.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
apiVersion: apps.kubeblocks.io/v1alpha1 | ||
kind: ClusterDefinition | ||
metadata: | ||
name: oceanbase | ||
labels: | ||
{{- include "oceanbase.labels" . | nindent 4 }} | ||
spec: | ||
connectionCredential: | ||
username: root | ||
password: "" | ||
endpoint: "$(SVC_FQDN):$(SVC_PORT_sql)" | ||
host: "$(SVC_FQDN)" | ||
port: "$(SVC_PORT_sql)" | ||
componentDefs: | ||
- name: ob-bundle | ||
characterType: oceanbase | ||
workloadType: Stateful | ||
service: | ||
ports: | ||
- name: sql | ||
port: 2881 | ||
targetPort: 2881 | ||
- name: rpc | ||
port: 2882 | ||
targetPort: 2882 | ||
podSpec: | ||
containers: | ||
- name: observer-container | ||
command: | ||
- bash | ||
- -c | ||
- "./scripts/entrypoint.sh" | ||
ports: | ||
- containerPort: 2881 | ||
name: sql | ||
protocol: TCP | ||
- containerPort: 2882 | ||
name: rpc | ||
protocol: TCP | ||
resources: | ||
limits: | ||
cpu: "2" | ||
memory: 10Gi | ||
requests: | ||
cpu: "2" | ||
memory: 10Gi | ||
volumeMounts: | ||
- mountPath: /home/admin/data-file | ||
name: data-file | ||
- mountPath: /home/admin/data-log | ||
name: data-log | ||
- mountPath: /home/admin/log | ||
name: log | ||
workingDir: /home/admin/oceanbase | ||
env: | ||
- name: LD_LIBRARY_PATH | ||
value: /home/admin/oceanbase/lib | ||
- name: ZONE_COUNT | ||
value: {{ .Values.zoneCount | quote }} | ||
- name: CLUSTER_NAME | ||
value: "$(KB_CLUSTER_COMP_NAME)" | ||
- name: DB_ROOT_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: $(CONN_CREDENTIAL_SECRET_NAME) | ||
key: password |
Oops, something went wrong.