Skip to content

Commit

Permalink
add dmdb addon (apecloud#276)
Browse files Browse the repository at this point in the history
  • Loading branch information
bliubiu authored Apr 5, 2024
1 parent 568d322 commit b406c05
Show file tree
Hide file tree
Showing 7 changed files with 243 additions and 0 deletions.
23 changes: 23 additions & 0 deletions addons/dmdb/.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/
25 changes: 25 additions & 0 deletions addons/dmdb/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: v2
name: dmdb
description: A Helm chart for Kubernetes

# 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: 0.8.0

# 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: "0.1.0"

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

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "dmdb.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "dmdb.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
68 changes: 68 additions & 0 deletions addons/dmdb/templates/clusterdefinition.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: ClusterDefinition
metadata:
name: dmdb
labels:
{{- include "dmdb.labels" . | nindent 4 }}
spec:
type: dmdb
connectionCredential:
username: MONITOR
password: "$(RANDOM_PASSWD)"
endpoint: "$(SVC_FQDN):$(SVC_PORT_tcp-dmdb)"
host: "$(SVC_FQDN)"
port: "$(SVC_PORT_tcp-dmdb)"
componentDefs:
- name: dmdb
workloadType: Stateful
characterType: dmdb
service:
ports:
- name: tcp-dmdb
port: 5236
targetPort: tcp-dmdb
- name: tcp-dmap
port: 4236
targetPort: tcp-dmap
volumeTypes:
- name: data
type: data
podSpec:
containers:
- name: dmdb
volumeMounts:
- mountPath: /opt/dmdata
name: data
imagePullPolicy: {{ default .Values.image.pullPolicy "IfNotPresent" }}
image: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}
ports:
- name: tcp-dmdb
containerPort: 5236
- name: tcp-dmap
containerPort: 4236
env:
- name: EXTENT_SIZE
value: "16"
- name: PAGE_SIZE
value: "8"
- name: LOG_SIZE
value: "256"
- name: CASE_SENSITIVE
value: "1"
- name: CHARSET
value: "0"
- name: LENGTH_IN_CHAR
value: "0"
- name: BLANK_PAD_MODE
value: "1"
- name: INSTANCE_BUFFER
value: "1000"
- name: DB_NAME
value: "DM"
- name: ARCH_SPACE_LIMIT
value: "20480"
- name: MONITOR_PWD
valueFrom:
secretKeyRef:
name: $(CONN_CREDENTIAL_SECRET_NAME)
key: password
20 changes: 20 additions & 0 deletions addons/dmdb/templates/clusterversion.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: ClusterVersion
metadata:
# major version of the component defined in values.yaml
name: dmdb-{{ .Values.image.tag }}
labels:
{{- include "dmdb.labels" . | nindent 4 }}
spec:
clusterDefinitionRef: dmdb
componentVersions:
- componentDefRef: dmdb
versionsContext:
containers:
- name: dmdb
image: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}
imagePullPolicy: {{ default .Values.image.pullPolicy "IfNotPresent" }}
- name: exporter
image: {{ .Values.exporter.image.registry | default "docker.io" }}/{{ .Values.exporter.image.repository }}:{{ .Values.exporter.image.tag }}
imagePullPolicy: {{ default .Values.image.pullPolicy "IfNotPresent" }}

45 changes: 45 additions & 0 deletions addons/dmdb/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Default values for dmdb.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

replicaCount: 1

image:
registry: biu.harbor.cn
repository: dm/dm8_single
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "0.3.0"

imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

service:
type: ClusterIP
port: 5236

resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi

# dataMountPath: /opt/dmdbms/data

exporter:
image:
# if the value of exporter.image.registry is not specified using `--set`, it will be set to the value of 'image.registry' by default
registry: biu.harbor.cn
repository: monitor/exporter/dmdb_exporter
tag: 0.1.0

service:
port: 9161

0 comments on commit b406c05

Please sign in to comment.