Skip to content

Commit

Permalink
update values
Browse files Browse the repository at this point in the history
  • Loading branch information
shanshanying committed Dec 7, 2023
1 parent bf61b4c commit b867f8e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 12 deletions.
10 changes: 7 additions & 3 deletions addons/oceanbase-cluster/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,17 @@ Create extra env
*/}}
{{- define "oceanbase-cluster.extra-envs" }}
{
{{- if .Values.tenant -}}
"TENANT_NAME": "{{ .Values.tenant.name | default "tenant1" }}",
"TENANT_CPU": "{{ .Values.tenant.max_cpu | default "2" }}",
"TENANT_MEMORY": "{{ print .Values.tenant.memory_size "G" | default "2G" }}",
"TENANT_DISK": "{{ print .Values.tenant.log_disk_size "G" | default "5G" }}",
{{- end -}}
"ZONE_COUNT": "{{ .Values.zoneCount | default "1" }}",
"OB_CLUSTERS_COUNT": "{{ .Values.obClusters | default "1" }}",
"TENANT_NAME": "{{ .Values.tenantName | default "tenant1" }}"
"OB_CLUSTERS_COUNT": "{{ .Values.obClusters | default "1" }}"
}
{{- end }}


{{/*
Create extra envs annotations
*/}}
Expand Down
11 changes: 7 additions & 4 deletions addons/oceanbase-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@ fullnameOverride: ""
clusterVersionOverride: "4.2.0.0-100010032023083021"

terminationPolicy: "Delete"
# cluster naem
clusterName: obcluster

# how many clusters to create with-in one ob cluster, set to 2 when creating a primary and secondary oceanbae cluster
obClusters: 2
# zone count
zoneCount: 1
# replicas, it should be larger than zoneCount
replicas: 1

tenantName: "alice"
tenant:
name: "alice"
max_cpu: 2
memory_size: 2
log_disk_size: 5

# resources
cpu: 6
Expand All @@ -31,4 +34,4 @@ storageClassName: "openebs-hostpath"

## customized default values to override kblib chart's values
extra:
podAntiAffinity: Required
podAntiAffinity: Required
14 changes: 10 additions & 4 deletions addons/oceanbase/scripts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ SVC_NAME="${KB_CLUSTER_COMP_NAME}-headless.${KB_NAMESPACE}.svc"
HOSTNAME=$(hostname)
REP_USER=${REP_USER:-rep_user}
REP_PASSWD=${REP_PASSWD:-123456}
OB_DEBUG=${OB_DEBUG:-true}

ORDINAL_INDEX=$(echo $HOSTNAME | awk -F '-' '{print $(NF)}')
ZONE_NAME="zone$((${ORDINAL_INDEX}%${ZONE_COUNT}))"
Expand Down Expand Up @@ -104,10 +105,15 @@ function prepare_dirs {

function start_observer {
echo "Start observer process as normal server..."
# if debug mode is enabled, set log level to debug
local loglevel="warn"
if [ "$OB_DEBUG" = "true" ]; then
loglevel="info"
fi
/home/admin/oceanbase/bin/observer --appname ${KB_CLUSTER_COMP_NAME} \
--cluster_id 1 --zone $ZONE_NAME --devname eth0 \
-p 2881 -P 2882 -d /home/admin/oceanbase/store/ \
-l info -o config_additional_dir=/home/admin/oceanbase/store/etc,cpu_count=6,memory_limit=10G,system_memory=1G,__min_full_resource_pool_memory=1073741824,datafile_size=40G,log_disk_size=40G,net_thread_count=2,stack_size=512K,cache_wash_threshold=1G,schema_history_expire_time=1d,enable_separate_sys_clog=false,enable_merge_by_turn=false,enable_syslog_recycle=true,enable_syslog_wf=false,max_syslog_file_count=4
-l ${loglevel} -o config_additional_dir=/home/admin/oceanbase/store/etc,cpu_count=${OB_CPU_LIMIT},memory_limit=${OB_MEM_LIMIT}M,system_memory=1G,__min_full_resource_pool_memory=1073741824,datafile_size=50G,net_thread_count=2,stack_size=512K,cache_wash_threshold=1G,schema_history_expire_time=1d,enable_separate_sys_clog=false,enable_merge_by_turn=false,enable_syslog_recycle=true,enable_syslog_wf=false,max_syslog_file_count=4
}

function clean_dirs {
Expand Down Expand Up @@ -296,7 +302,7 @@ function create_primary_secondry_tenants {
function create_primary_tenant {
tenant_name=$1
echo "create resource unit and pool for tenant ${tenant_name}"
conn_local "CREATE RESOURCE UNIT IF NOT EXISTS unit_for_${tenant_name} MAX_CPU 1, MEMORY_SIZE = '2G', LOG_DISK_SIZE = '2G';"
conn_local "CREATE RESOURCE UNIT IF NOT EXISTS unit_for_${tenant_name} MAX_CPU ${TENANT_CPU}, MEMORY_SIZE = '${TENANT_MEMORY}', LOG_DISK_SIZE = '${TENANT_DISK}';"
conn_local "CREATE RESOURCE POOL IF NOT EXISTS pool_for_${tenant_name} UNIT = 'unit_for_${tenant_name}', UNIT_NUM = 1;"

echo "create tenant ${tenant_name}"
Expand Down Expand Up @@ -389,8 +395,8 @@ function create_secondary_tenant {
sleep 10
done

echo $ip "CREATE RESOURCE UNIT IF NOT EXISTS unit_for_${secondary_tenant_name} MAX_CPU 1, MEMORY_SIZE = '2G', LOG_DISK_SIZE = '2G'"
conn_remote $ip "CREATE RESOURCE UNIT IF NOT EXISTS unit_for_${secondary_tenant_name} MAX_CPU 1, MEMORY_SIZE = '2G', LOG_DISK_SIZE = '2G'"
echo $ip "CREATE RESOURCE UNIT IF NOT EXISTS unit_for_${secondary_tenant_name}"
conn_remote $ip "CREATE RESOURCE UNIT IF NOT EXISTS unit_for_${secondary_tenant_name} MAX_CPU ${TENANT_CPU}, MEMORY_SIZE = '${TENANT_MEMORY}', LOG_DISK_SIZE = '${TENANT_DISK}';"
echo $ip "CREATE RESOURCE POOL IF NOT EXISTS pool_for_${secondary_tenant_name} UNIT = 'unit_for_${secondary_tenant_name}', UNIT_NUM = 1;"
conn_remote $ip "CREATE RESOURCE POOL IF NOT EXISTS pool_for_${secondary_tenant_name} UNIT = 'unit_for_${secondary_tenant_name}', UNIT_NUM = 1;"

Expand Down
13 changes: 12 additions & 1 deletion addons/oceanbase/templates/clusterdefinition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,15 @@ spec:
valueFrom:
secretKeyRef:
name: $(CONN_CREDENTIAL_SECRET_NAME)
key: password
key: password
- name: OB_CPU_LIMIT
valueFrom:
resourceFieldRef:
containerName: observer-container
resource: limits.cpu
- name: OB_MEM_LIMIT
valueFrom:
resourceFieldRef:
containerName: observer-container
resource: limits.memory
divisor: 1Mi

0 comments on commit b867f8e

Please sign in to comment.