Skip to content

Commit

Permalink
feat: add greptimedb standalone chart
Browse files Browse the repository at this point in the history
  • Loading branch information
daviderli614 committed Oct 11, 2023
1 parent 9f554de commit c61bd2c
Show file tree
Hide file tree
Showing 8 changed files with 292 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/greptimedb-standalone/.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/
6 changes: 6 additions & 0 deletions charts/greptimedb-standalone/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: greptimedb
description: A Helm chart for deploying standalone greptimedb.
type: application
version: 0.1.0-alpha.1
appVersion: 0.4.0
62 changes: 62 additions & 0 deletions charts/greptimedb-standalone/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "greptimedb-standalone.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-standalone.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-standalone.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "greptimedb-standalone.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "greptimedb-standalone.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
86 changes: 86 additions & 0 deletions charts/greptimedb-standalone/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "greptimedb-standalone.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "greptimedb-standalone.labels" . | nindent 4 }}
spec:
# Always set to 1.
replicas: 1
selector:
matchLabels:
{{- include "greptimedb-standalone.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "greptimedb-standalone.selectorLabels" . | nindent 8 }}
spec:
{{- if .Values.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.image.pullSecrets }}
- name: {{ . }}
{{- end }}
{{- end }}
serviceAccountName: {{ include "greptimedb-standalone.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
volumes:
- name: greptimedb-host-volume
hostPath:
path: /var/greptimedb/standalone-test
type: DirectoryOrCreate
containers:
- name: greptimedb
image: {{ printf "%s/%s:%s" .Values.image.registry .Values.image.repository .Values.image.tag }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.command }}
command:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.args }}
args:
{{- toYaml . | nindent 10 }}
{{- end }}
env:
{{- range $key, $val := .Values.env }}
- name: {{ $key }}
value: {{ $val | quote }}
{{- end }}
ports:
- containerPort: 4000
name: http
protocol: TCP
- containerPort: 4001
name: grpc
protocol: TCP
- containerPort: 4002
name: mysql
protocol: TCP
- containerPort: 4003
name: postgres
protocol: TCP
- containerPort: 4004
name: prom
protocol: TCP
volumeMounts:
- name: greptimedb-host-volume
mountPath: /data
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
18 changes: 18 additions & 0 deletions charts/greptimedb-standalone/templates/podmonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: {{ include "greptimedb-standalone.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
release: prometheus
spec:
podMetricsEndpoints:
- interval: 30s
port: http
path: /metrics
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
{{- include "greptimedb-standalone.selectorLabels" . | nindent 6 }}
31 changes: 31 additions & 0 deletions charts/greptimedb-standalone/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "greptimedb-standalone.fullname" . }}
labels:
{{- include "greptimedb-standalone.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- name: http
port: 4000
targetPort: 4000
protocol: TCP
- name: grpc
port: 4001
targetPort: 4001
protocol: TCP
- name: mysql
port: 4002
targetPort: 4002
protocol: TCP
- name: postgres
port: 4003
targetPort: 4003
protocol: TCP
- name: prom
port: 4004
targetPort: 4004
protocol: TCP
selector:
{{- include "greptimedb-standalone.selectorLabels" . | nindent 4 }}
13 changes: 13 additions & 0 deletions charts/greptimedb-standalone/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "greptimedb-standalone.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "greptimedb-standalone.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
53 changes: 53 additions & 0 deletions charts/greptimedb-standalone/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
image:
registry: docker.io
# The image repository
repository: greptime/greptimedb
# The image tag
tag: "v0.4.0"

pullPolicy: IfNotPresent
pullSecrets: []

nameOverride: ""

fullnameOverride: ""

command: [
"greptime", "standalone", "start"
]

args: []

env: []

serviceAccount:
# Specifies whether a service account should be created
create: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""

podAnnotations: {}

podSecurityContext: {}

securityContext: {}

service:
type: ClusterIP

resources:
limits:
cpu: 800m
memory: 1Gi
requests:
cpu: 200m
memory: 512Mi

nodeSelector: {}

tolerations: {}

affinity: {}

0 comments on commit c61bd2c

Please sign in to comment.