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: add GreptimeDB support #4822

Merged
merged 3 commits into from
Aug 21, 2023
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 deploy/greptimedb-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/
9 changes: 9 additions & 0 deletions deploy/greptimedb-cluster/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v2
name: greptimedb-cluster
description: A greptimedb cluster Helm chart for KubeBlocks.

type: application

version: 0.1.0-beta.0

appVersion: "0.3.2"
14 changes: 14 additions & 0 deletions deploy/greptimedb-cluster/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

Thanks for installing GreptimeDB Cluster using KubeBlocks!

🔑 Invest in Data, Harvest over Time.

Port-forward svc to localhost and connect to it:

MySQL >
kubectl port-forward svc/my-greptimedb-cluster-frontend 4002:4002
mysql -h 127.0.0.1 -P 4002

PostgreSQL >
kubectl port-forward svc/my-greptimedb-cluster-frontend 4003:4003
psql -h 127.0.0.1 -p 4003
55 changes: 55 additions & 0 deletions deploy/greptimedb-cluster/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "greptimedb.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 "greptimedb.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 "greptimedb.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{- define "clustername" -}}
{{ include "greptimedb.fullname" .}}
{{- end}}
91 changes: 91 additions & 0 deletions deploy/greptimedb-cluster/templates/cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: Cluster
metadata:
name: {{ include "clustername" . }}
labels:
{{- include "greptimedb.labels" . | nindent 4 }}
spec:
clusterDefinitionRef: greptimedb
clusterVersionRef: greptimedb-{{ default .Chart.AppVersion .Values.clusterVersionOverride }}
terminationPolicy: {{ .Values.terminationPolicy }}
componentSpecs:
- name: frontend
componentDefRef: frontend
replicas: {{ .Values.frontend.replicas | default 1 }}
{{- with .Values.frontend.resources }}
resources:
{{- with .limits }}
limits:
cpu: {{ .cpu | quote }}
memory: {{ .memory | quote }}
{{- end }}
{{- with .requests }}
requests:
cpu: {{ .cpu | quote }}
memory: {{ .memory | quote }}
{{- end }}
{{- end }}
- name: datanode
componentDefRef: datanode
replicas: {{ .Values.datanode.replicas | default 1 }}
{{- with .Values.datanode.resources }}
resources:
{{- with .limits }}
limits:
cpu: {{ .cpu | quote }}
memory: {{ .memory | quote }}
{{- end }}
{{- with .requests }}
requests:
cpu: {{ .cpu | quote }}
memory: {{ .memory | quote }}
{{- end }}
{{- end }}
volumeClaimTemplates:
- name: datanode
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.datanode.volume.storage | default "10Gi" }}
- name: meta
componentDefRef: meta
replicas: {{ .Values.meta.replicas | default 1 }}
{{- with .Values.meta.resources }}
resources:
{{- with .limits }}
limits:
cpu: {{ .cpu | quote }}
memory: {{ .memory | quote }}
{{- end }}
{{- with .requests }}
requests:
cpu: {{ .cpu | quote }}
memory: {{ .memory | quote }}
{{- end }}
{{- end }}
- name: etcd
componentDefRef: etcd
replicas: {{ .Values.etcd.replicas | default 1 }}
{{- with .Values.etcd.resources }}
resources:
{{- with .limits }}
limits:
cpu: {{ .cpu | quote }}
memory: {{ .memory | quote }}
{{- end }}
{{- with .requests }}
requests:
cpu: {{ .cpu | quote }}
memory: {{ .memory | quote }}
{{- end }}
{{- end }}
volumeClaimTemplates:
- name: etcd-storage
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.etcd.volume.storage | default "10Gi" }}
49 changes: 49 additions & 0 deletions deploy/greptimedb-cluster/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Default values for greptimedb cluster.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

nameOverride: ""
fullnameOverride: ""
clusterVersionOverride: ""

terminationPolicy: "Delete"

## @param datanode configs
##
datanode:
replicas: 3
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: 500m
# memory: 512Mi
# requests:
# cpu: 500m
# memory: 512Mi

volume:
storage: 10Gi

## @param etcd configs
##
etcd:
replicas: 3
resources: {}
volume:
storage: 10Gi

## @param meta configs
##
meta:
replicas: 1
resources: {}

## @param frontend configs
##
frontend:
replicas: 1
resources: {}
23 changes: 23 additions & 0 deletions deploy/greptimedb/.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/
22 changes: 22 additions & 0 deletions deploy/greptimedb/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: v2
name: greptimedb
description: GreptimeDB Cluster Helm Chart for KubeBlocks.

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

# This is the version number of greptimedb
appVersion: "0.3.2"

home: https://greptime.com/
sources:
- https://github.com/GreptimeTeam/greptimedb
keywords:
- kubernetes
- promql
- database
- time-series database

maintainers:
- name: GreptimeTeam
url: https://github.com/GreptimeTeam
24 changes: 24 additions & 0 deletions deploy/greptimedb/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

Thanks for installing GreptimeDB with KubeBlocks!

🔑 Invest in Data, Harvest over Time.

Example routines to create and connect a GreptimeDB cluster using kbcli.

1. Create a GreptimeDB cluster

Minimal >
kbcli cluster create my-cluster --cluster-definition greptimedb

Replicas >
helm install my-cluster ./deploy/greptimedb-cluster

2. Port-forward svc to localhost and connect to GreptimeDB cluster

MySQL >
kubectl port-forward svc/my-cluster-frontend 4002:4002
mysql -h 127.0.0.1 -P 4002

PostgreSQL >
kubectl port-forward svc/my-cluster-frontend 4003:4003
psql -h 127.0.0.1 -p 4003
33 changes: 33 additions & 0 deletions deploy/greptimedb/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "greptimedb.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "greptimedb.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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