Skip to content

Commit

Permalink
fix: improve frontend and configmap for greptimedb (#4855)
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnh2 authored and ldming committed Nov 21, 2023
1 parent 503b1c1 commit 084abfe
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 56 deletions.
2 changes: 1 addition & 1 deletion greptimedb-cluster/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ description: A greptimedb cluster Helm chart for KubeBlocks.

type: application

version: 0.1.0-beta.0
version: 0.1.0-beta.1

appVersion: "0.3.2"
2 changes: 1 addition & 1 deletion greptimedb/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: greptimedb
description: GreptimeDB Cluster Helm Chart for KubeBlocks.

# This is the chart version
version: 0.1.0-beta.0
version: 0.1.0-beta.1

# This is the version number of greptimedb
appVersion: "0.3.2"
Expand Down
127 changes: 73 additions & 54 deletions greptimedb/templates/clusterdefinition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ spec:
characterType: greptimedb
probes:
configSpecs:
- name: greptimedb-frontend
templateRef: greptimedb-frontend
volumeName: frontend-config
namespace: {{ .Release.Namespace }}
service:
ports:
- name: http
Expand All @@ -43,7 +47,25 @@ spec:
- name: GREPTIMEDB_META_SVC
valueFrom:
type: ServiceRef
- &datanodeRef
componentDefName: datanode
componentRefEnv:
- name: GREPTIMEDB_DATANODE_SVC
valueFrom:
type: ServiceRef
podSpec:
initContainers:
- name: wait-datanode
image: busybox:1.28
imagePullPolicy: {{default .Values.images.pullPolicy "IfNotPresent"}}
command:
- bin/sh
- -c
- |
until nslookup ${GREPTIMEDB_DATANODE_SVC}-headless.${KB_NAMESPACE}.svc{{ .Values.clusterDomain }}; do
# frontend requires at least one datanode is ready
echo "waiting for datanode"; sleep 2;
done;
containers:
- name: frontend
imagePullPolicy: {{default .Values.images.pullPolicy "IfNotPresent"}}
Expand All @@ -65,26 +87,16 @@ spec:
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 3
startupProbe:
failureThreshold: 15
httpGet:
path: /health
port: 4000
scheme: HTTP
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 3
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /etc/greptimedb
name: config
name: frontend-config
args:
- frontend
- start
- --metasrv-addr
- $(GREPTIMEDB_META_SVC)-headless.$(KB_NAMESPACE).svc{{ .Values.clusterDomain }}:3002
- $(GREPTIMEDB_META_SVC).$(KB_NAMESPACE).svc{{ .Values.clusterDomain }}:3002
- --http-addr
- 0.0.0.0:4000
- --grpc-addr
Expand Down Expand Up @@ -112,17 +124,17 @@ spec:
terminationGracePeriodSeconds: 10
dnsPolicy: ClusterFirst
restartPolicy: Always
volumes:
- configMap:
defaultMode: 420
name: greptimedb-frontend
name: config

- name: datanode
workloadType: Stateful
characterType: greptimedb
probes:
logConfigs:
configSpecs:
- name: greptimedb-datanode
templateRef: greptimedb-datanode
volumeName: datanode-config
namespace: {{ .Release.Namespace }}
service:
ports:
- name: http
Expand Down Expand Up @@ -155,16 +167,6 @@ spec:
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 3
startupProbe:
failureThreshold: 15
httpGet:
path: /health
port: 4000
scheme: HTTP
initialDelaySeconds: 20
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 3
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
Expand All @@ -181,13 +183,24 @@ spec:
- datanode
- start
- --metasrv-addr
- $(GREPTIMEDB_META_SVC)-headless.$(KB_NAMESPACE).svc{{ .Values.clusterDomain }}:3002
- $(GREPTIMEDB_META_SVC).$(KB_NAMESPACE).svc{{ .Values.clusterDomain }}:3002
- --http-addr
- 0.0.0.0:4000
- --config-file
- /etc/greptimedb/config.toml
dnsPolicy: ClusterFirst
initContainers:
- name: wait-meta
image: busybox:1.28
imagePullPolicy: {{default .Values.images.pullPolicy "IfNotPresent"}}
command:
- bin/sh
- -c
- |
until nslookup ${GREPTIMEDB_META_SVC}-headless.${KB_NAMESPACE}.svc{{ .Values.clusterDomain }}; do
# datanode requires at least one meta is ready
echo "waiting for meta"; sleep 2;
done;
- name: initializer
args:
- --config-path
Expand Down Expand Up @@ -217,21 +230,22 @@ spec:
- mountPath: /etc/greptimedb
name: config
- mountPath: /etc/greptimedb-init
name: init-config
name: datanode-config
serviceAccountName: greptimedb-cluster
terminationGracePeriodSeconds: 10
volumes:
- emptyDir: {}
name: config
- configMap:
defaultMode: 420
name: greptimedb-datanode
name: init-config

- name: meta
workloadType: Stateless
characterType: greptimedb
probes:
configSpecs:
- name: greptimedb-meta
templateRef: greptimedb-meta
volumeName: meta-config
namespace: {{ .Release.Namespace }}
service:
ports:
- name: grpc
Expand All @@ -248,6 +262,17 @@ spec:
valueFrom:
type: ServiceRef
podSpec:
initContainers:
- name: wait-etcd
image: busybox:1.28
imagePullPolicy: {{default .Values.images.pullPolicy "IfNotPresent"}}
command:
- bin/sh
- -c
- |
until nslookup ${GREPTIMEDB_ETCD_SVC}-headless.${KB_NAMESPACE}.svc{{ .Values.clusterDomain }}; do
echo "waiting for etcd"; sleep 2;
done;
containers:
- name: meta
imagePullPolicy: {{default .Values.images.pullPolicy "IfNotPresent"}}
Expand All @@ -269,21 +294,16 @@ spec:
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 3
startupProbe:
failureThreshold: 15
httpGet:
path: /health
port: 4000
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 3
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
ports:
- containerPort: 3002
name: grpc
- containerPort: 4000
name: http
volumeMounts:
- mountPath: /etc/greptimedb
name: config
name: meta-config
args:
- metasrv
- start
Expand All @@ -297,15 +317,14 @@ spec:
- $(GREPTIMEDB_ETCD_SVC)-headless.$(KB_NAMESPACE).svc{{ .Values.clusterDomain }}:2379
- --config-file
- /etc/greptimedb/config.toml
env:
- name: GREPTIMEDB_METASRV__DISABLE_REGION_FAILOVER
value: {{ .Values.meta.disableRegionFailover | quote}}
serviceAccountName: greptimedb-cluster
terminationGracePeriodSeconds: 10
dnsPolicy: ClusterFirst
restartPolicy: Always
volumes:
- configMap:
defaultMode: 420
name: greptimedb-meta
name: config

- name: etcd
workloadType: Consensus
characterType: etcd
Expand Down Expand Up @@ -356,13 +375,13 @@ spec:
DOMAIN=$KB_NAMESPACE".svc{{ .Values.clusterDomain }}"
i=0
while [ $i -lt $KB_REPLICA_COUNT ]; do
if [ $i -ne 0 ]; then
PEERS="$PEERS,";
fi;
host=$(eval echo \$KB_"$i"_HOSTNAME)
if [ $i -ne 0 ]; then
PEERS="$PEERS,";
fi;
host=$(eval echo \$KB_"$i"_HOSTNAME)
host=$host"."$DOMAIN
hostname=${KB_CLUSTER_COMP_NAME}-${i}
PEERS="$PEERS$hostname=http://$host:2380"
PEERS="$PEERS$hostname=http://$host:2380"
i=$(( i + 1 ))
done
MY_PEER=$KB_POD_FQDN{{ .Values.clusterDomain }}
Expand Down
5 changes: 5 additions & 0 deletions greptimedb/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ images:
etcd:
repository: docker.io/greptime/etcd
tag: v3.5.5

## @param metasrv config
##
meta:
disableRegionFailover: true

0 comments on commit 084abfe

Please sign in to comment.