Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Doris Cluster Addon #183

Merged
merged 3 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions addons/doris-cluster/.helmignore
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/
24 changes: 24 additions & 0 deletions addons/doris-cluster/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: kb-doris
description: a kubeblocks' cluster for doris-2.0.3

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 2.0.3

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "2.0.3"
34 changes: 34 additions & 0 deletions addons/doris-cluster/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!--- app-name: doris-2.0.3 -->

# doris-2.0.3 By KubeBlocks

Apache Doris is an easy-to-use, high-performance and real-time analytical database based on MPP architecture, known for its extreme speed and ease of use. It only requires a sub-second response time to return query results under massive data and can support not only high-concurrent point query scenarios but also high-throughput complex analysis scenarios.

## TL;DR

```bash
$ helm repo add my-repo http://172.16.48.10:28081/chartrepo/helm-chart
$ helm install my-release my-repo/kb-doris-2.0.3
```

## Introduction

This chart bootstraps a Doris deployment on a Kubernetes cluster using the Helm package manager and KubeBlocks.

## Prerequisites
- Helm 3.2.0+
- Kubernetes 1.22.0
- PV provisioner support in the underlying infrastructure

## Installing the Chart

```bash
$ helm install my-release my-repo/kb-doris-2.0.3
```

## Uninstalling the Chart

```bash
$ helm delete my-release
```

16 changes: 16 additions & 0 deletions addons/doris-cluster/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
CHART NAME: {{ .Chart.Name }}
CHART VERSION: {{ .Chart.Version }}
APP VERSION: {{ .Chart.AppVersion }}

KubeBlocks doris server cluster definition. If you test on the machine that kubectl is on ,you can run the following command to test the doris service by connecting to the mysql client:

mysql -uroot -P9030 -hfePodServiceClusterIp

Run the following command to check the FE running status:

show frontends\g;

Run the following command to check the BE running status:

show backends\g

88 changes: 88 additions & 0 deletions addons/doris-cluster/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "kb-doris-2.0.3.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 "kb-doris-2.0.3.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 "kb-doris-2.0.3.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "kb-doris-2.0.3.labels" -}}
helm.sh/chart: {{ include "kb-doris-2.0.3.chart" . }}
{{ include "kb-doris-2.0.3.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "kb-doris-2.0.3.selectorLabels" -}}
app.kubernetes.io/name: {{ include "kb-doris-2.0.3.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "kb-doris-2.0.3.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "kb-doris-2.0.3.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/* vim: set filetype=mustache: */}}
{{/*
Kubernetes standard labels
*/}}
{{- define "common.labels.standard" -}}
app.kubernetes.io/name: {{ include "common.names.name" . }}
helm.sh/chart: {{ include "common.names.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}

{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "common.names.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "common.names.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
39 changes: 39 additions & 0 deletions addons/doris-cluster/templates/account.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apiVersion: v1
kind: ServiceAccount
metadata:
labels: {{- include "common.labels.standard" . | nindent 4 }}
name: {{ .Release.Name }}-kb-doris-sa
namespace: {{ .Release.Namespace | quote }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels: {{- include "common.labels.standard" . | nindent 4 }}
name: {{ .Release.Name }}-kb-doris-sa
namespace: {{ .Release.Namespace | quote }}
rules:
- apiGroups:
- '*'
resources:
- '*'
verbs:
- get
- watch
- list
- exec

---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels: {{- include "common.labels.standard" . | nindent 4 }}
name: {{ .Release.Name }}-kb-doris-sa
namespace: {{ .Release.Namespace | quote }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ .Release.Name }}-kb-doris-sa
subjects:
- kind: ServiceAccount
name: {{ .Release.Name }}-kb-doris-sa
namespace: {{ .Release.Namespace | quote }}
81 changes: 81 additions & 0 deletions addons/doris-cluster/templates/cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: Cluster
metadata:
labels: {{- include "common.labels.standard" . | nindent 4 }}
clusterdefinition.kubeblocks.io/name: doris
annotations: {}
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace | quote }}
spec:
affinity:
nodeLabels: {}
podAntiAffinity: Preferred
tenancy: SharedNode
topologyKeys: []
clusterDefinitionRef: doris
clusterVersionRef: doris-2.0.0
componentSpecs:
- componentDefRef: doris-fe
monitor: true
name: doris-fe
noCreatePDB: false
replicas: 3
resources:
limits: {{- toYaml .Values.componentSpecs.fe.resources | nindent 10 }}
requests: {{- toYaml .Values.componentSpecs.fe.resources | nindent 10 }}
serviceAccountName: {{ .Release.Name }}-kb-doris-sa
volumeClaimTemplates:
#- name: metadata
# spec:
# storageClassName: {{ .Values.persistence.fe.storageClass }}
# accessModes:
# {{- range .Values.persistence.fe.accessModes }}
# - {{ . | quote }}
# {{- end }}
# resources:
# requests:
# storage: {{ .Values.componentSpecs.fe.volumeClaimTemplates.data.size | quote }}
- name: data
spec:
storageClassName: {{ .Values.persistence.fe.storageClass }}
accessModes:
{{- range .Values.persistence.fe.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.componentSpecs.fe.volumeClaimTemplates.data.size | quote }}
tls: false
- componentDefRef: doris-be
monitor: true
name: doris-be
noCreatePDB: false
replicas: {{ .Values.componentSpecs.be.replicas }}
resources:
limits: {{- toYaml .Values.componentSpecs.be.resources | nindent 10 }}
requests: {{- toYaml .Values.componentSpecs.be.resources | nindent 10 }}
serviceAccountName: {{ .Release.Name }}-kb-doris-sa
volumeClaimTemplates:
- name: data
spec:
storageClassName: {{ .Values.persistence.be.storageClass }}
accessModes:
{{- range .Values.persistence.be.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.componentSpecs.be.volumeClaimTemplates.data.size | quote }}
tls: false
- componentDefRef: doris-cn
monitor: true
name: doris-cn
noCreatePDB: false
replicas: {{ .Values.componentSpecs.cn.replicas }}
resources:
limits: {{- toYaml .Values.componentSpecs.cn.resources | nindent 10 }}
requests: {{- toYaml .Values.componentSpecs.cn.resources | nindent 10 }}
serviceAccountName: {{ .Release.Name }}-kb-doris-sa
tls: false
terminationPolicy: {{ default "Delete" .Values.terminationPolicy | quote }}
tolerations: []
34 changes: 34 additions & 0 deletions addons/doris-cluster/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
componentSpecs:
fe:
resources:
cpu: "1000m"
memory: "2Gi"
volumeClaimTemplates:
data:
size: 10Gi

be:
replicas: 3
resources:
cpu: "1000m"
memory: "2Gi"
volumeClaimTemplates:
data:
size: 10Gi

cn:
replicas: 3
resources:
cpu: "1000m"
memory: "2Gi"
persistence:
fe:
storageClass: "rook-cephfs"
accessModes:
- ReadWriteOnce
be:
storageClass: "rook-cephfs"
accessModes:
- ReadWriteOnce

terminationPolicy: Delete
23 changes: 23 additions & 0 deletions addons/doris/.helmignore
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/
16 changes: 16 additions & 0 deletions addons/doris/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v2
name: doris
description: A Helm chart for Kubernetes

type: application

version: 2.0.3

appVersion: "2.0.3"
keywords:
- doris
- fe
- be
- cn
maintainers:
- name: YQ
Loading