From c61bd2c65eaa7e2bef74efb2dd5bdd4dcba3ebc0 Mon Sep 17 00:00:00 2001 From: liyang Date: Wed, 11 Oct 2023 16:09:19 +0800 Subject: [PATCH 01/10] feat: add greptimedb standalone chart --- charts/greptimedb-standalone/.helmignore | 23 +++++ charts/greptimedb-standalone/Chart.yaml | 6 ++ .../templates/_helpers.tpl | 62 +++++++++++++ .../templates/deployment.yaml | 86 +++++++++++++++++++ .../templates/podmonitor.yaml | 18 ++++ .../templates/service.yaml | 31 +++++++ .../templates/serviceaccount.yaml | 13 +++ charts/greptimedb-standalone/values.yaml | 53 ++++++++++++ 8 files changed, 292 insertions(+) create mode 100644 charts/greptimedb-standalone/.helmignore create mode 100644 charts/greptimedb-standalone/Chart.yaml create mode 100644 charts/greptimedb-standalone/templates/_helpers.tpl create mode 100644 charts/greptimedb-standalone/templates/deployment.yaml create mode 100644 charts/greptimedb-standalone/templates/podmonitor.yaml create mode 100644 charts/greptimedb-standalone/templates/service.yaml create mode 100644 charts/greptimedb-standalone/templates/serviceaccount.yaml create mode 100644 charts/greptimedb-standalone/values.yaml diff --git a/charts/greptimedb-standalone/.helmignore b/charts/greptimedb-standalone/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/greptimedb-standalone/.helmignore @@ -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/ diff --git a/charts/greptimedb-standalone/Chart.yaml b/charts/greptimedb-standalone/Chart.yaml new file mode 100644 index 0000000..01cbb87 --- /dev/null +++ b/charts/greptimedb-standalone/Chart.yaml @@ -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 diff --git a/charts/greptimedb-standalone/templates/_helpers.tpl b/charts/greptimedb-standalone/templates/_helpers.tpl new file mode 100644 index 0000000..f2fe3a7 --- /dev/null +++ b/charts/greptimedb-standalone/templates/_helpers.tpl @@ -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 }} diff --git a/charts/greptimedb-standalone/templates/deployment.yaml b/charts/greptimedb-standalone/templates/deployment.yaml new file mode 100644 index 0000000..f883cd0 --- /dev/null +++ b/charts/greptimedb-standalone/templates/deployment.yaml @@ -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 }} diff --git a/charts/greptimedb-standalone/templates/podmonitor.yaml b/charts/greptimedb-standalone/templates/podmonitor.yaml new file mode 100644 index 0000000..2779b46 --- /dev/null +++ b/charts/greptimedb-standalone/templates/podmonitor.yaml @@ -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 }} diff --git a/charts/greptimedb-standalone/templates/service.yaml b/charts/greptimedb-standalone/templates/service.yaml new file mode 100644 index 0000000..385148b --- /dev/null +++ b/charts/greptimedb-standalone/templates/service.yaml @@ -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 }} diff --git a/charts/greptimedb-standalone/templates/serviceaccount.yaml b/charts/greptimedb-standalone/templates/serviceaccount.yaml new file mode 100644 index 0000000..fb5abec --- /dev/null +++ b/charts/greptimedb-standalone/templates/serviceaccount.yaml @@ -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 }} diff --git a/charts/greptimedb-standalone/values.yaml b/charts/greptimedb-standalone/values.yaml new file mode 100644 index 0000000..bb6708b --- /dev/null +++ b/charts/greptimedb-standalone/values.yaml @@ -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: {} From 0c65012f9afcad2408e858d34cfd23cbb570d3f0 Mon Sep 17 00:00:00 2001 From: liyang Date: Thu, 12 Oct 2023 18:11:50 +0800 Subject: [PATCH 02/10] refactor: use statefulset deploy greptimedb --- .../templates/_helpers.tpl | 20 +-- .../templates/deployment.yaml | 86 ----------- .../templates/podmonitor.yaml | 4 +- .../templates/service.yaml | 6 +- .../templates/serviceaccount.yaml | 4 +- .../templates/statefulset.yaml | 137 ++++++++++++++++++ charts/greptimedb-standalone/values.yaml | 122 ++++++++++++++-- 7 files changed, 260 insertions(+), 119 deletions(-) delete mode 100644 charts/greptimedb-standalone/templates/deployment.yaml create mode 100644 charts/greptimedb-standalone/templates/statefulset.yaml diff --git a/charts/greptimedb-standalone/templates/_helpers.tpl b/charts/greptimedb-standalone/templates/_helpers.tpl index f2fe3a7..95bb9c4 100644 --- a/charts/greptimedb-standalone/templates/_helpers.tpl +++ b/charts/greptimedb-standalone/templates/_helpers.tpl @@ -1,7 +1,7 @@ {{/* Expand the name of the chart. */}} -{{- define "greptimedb-standalone.name" -}} +{{- define "greptimedb.name" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} {{- end }} @@ -10,7 +10,7 @@ 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" -}} +{{- define "greptimedb.fullname" -}} {{- if .Values.fullnameOverride }} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} {{- else }} @@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name. {{/* Create chart name and version as used by the chart label. */}} -{{- define "greptimedb-standalone.chart" -}} +{{- define "greptimedb.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" . }} +{{- define "greptimedb.labels" -}} +helm.sh/chart: {{ include "greptimedb.chart" . }} +{{ include "greptimedb.selectorLabels" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} @@ -45,17 +45,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} {{/* Selector labels */}} -{{- define "greptimedb-standalone.selectorLabels" -}} -app.kubernetes.io/name: {{ include "greptimedb-standalone.name" . }} +{{- define "greptimedb.selectorLabels" -}} +app.kubernetes.io/name: {{ include "greptimedb.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} {{/* Create the name of the service account to use */}} -{{- define "greptimedb-standalone.serviceAccountName" -}} +{{- define "greptimedb.serviceAccountName" -}} {{- if .Values.serviceAccount.create }} -{{- default (include "greptimedb-standalone.fullname" .) .Values.serviceAccount.name }} +{{- default (include "greptimedb.fullname" .) .Values.serviceAccount.name }} {{- else }} {{- default "default" .Values.serviceAccount.name }} {{- end }} diff --git a/charts/greptimedb-standalone/templates/deployment.yaml b/charts/greptimedb-standalone/templates/deployment.yaml deleted file mode 100644 index f883cd0..0000000 --- a/charts/greptimedb-standalone/templates/deployment.yaml +++ /dev/null @@ -1,86 +0,0 @@ -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 }} diff --git a/charts/greptimedb-standalone/templates/podmonitor.yaml b/charts/greptimedb-standalone/templates/podmonitor.yaml index 2779b46..148a6b0 100644 --- a/charts/greptimedb-standalone/templates/podmonitor.yaml +++ b/charts/greptimedb-standalone/templates/podmonitor.yaml @@ -1,7 +1,7 @@ apiVersion: monitoring.coreos.com/v1 kind: PodMonitor metadata: - name: {{ include "greptimedb-standalone.fullname" . }} + name: {{ include "greptimedb.fullname" . }} namespace: {{ .Release.Namespace }} labels: release: prometheus @@ -15,4 +15,4 @@ spec: - {{ .Release.Namespace }} selector: matchLabels: - {{- include "greptimedb-standalone.selectorLabels" . | nindent 6 }} + {{- include "greptimedb.selectorLabels" . | nindent 6 }} diff --git a/charts/greptimedb-standalone/templates/service.yaml b/charts/greptimedb-standalone/templates/service.yaml index 385148b..673f826 100644 --- a/charts/greptimedb-standalone/templates/service.yaml +++ b/charts/greptimedb-standalone/templates/service.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "greptimedb-standalone.fullname" . }} + name: {{ include "greptimedb.fullname" . }} labels: - {{- include "greptimedb-standalone.labels" . | nindent 4 }} + {{- include "greptimedb.labels" . | nindent 4 }} spec: type: {{ .Values.service.type }} ports: @@ -28,4 +28,4 @@ spec: targetPort: 4004 protocol: TCP selector: - {{- include "greptimedb-standalone.selectorLabels" . | nindent 4 }} + {{- include "greptimedb.selectorLabels" . | nindent 4 }} diff --git a/charts/greptimedb-standalone/templates/serviceaccount.yaml b/charts/greptimedb-standalone/templates/serviceaccount.yaml index fb5abec..4e1e2c8 100644 --- a/charts/greptimedb-standalone/templates/serviceaccount.yaml +++ b/charts/greptimedb-standalone/templates/serviceaccount.yaml @@ -2,10 +2,10 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: {{ include "greptimedb-standalone.serviceAccountName" . }} + name: {{ include "greptimedb.serviceAccountName" . }} namespace: {{ .Release.Namespace }} labels: - {{- include "greptimedb-standalone.labels" . | nindent 4 }} + {{- include "greptimedb.labels" . | nindent 4 }} {{- with .Values.serviceAccount.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/charts/greptimedb-standalone/templates/statefulset.yaml b/charts/greptimedb-standalone/templates/statefulset.yaml new file mode 100644 index 0000000..260ecee --- /dev/null +++ b/charts/greptimedb-standalone/templates/statefulset.yaml @@ -0,0 +1,137 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ include "greptimedb.fullname" . }} + namespace: {{ $.Release.Namespace }} + labels: + {{- include "greptimedb.labels" . | nindent 4 }} + {{- if not (empty .Values.annotations) }} + annotations: + {{- with .Values.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- end }} +spec: + replicas: 1 + updateStrategy: + rollingUpdate: + partition: 0 + serviceName: {{ include "greptimedb.fullname" . }} + {{- if and (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) (.Values.persistence.enableStatefulSetAutoDeletePVC) (.Values.persistence.enabled) }} + persistentVolumeClaimRetentionPolicy: + whenDeleted: Delete + whenScaled: Delete + {{- end }} + selector: + matchLabels: + {{- include "greptimedb.selectorLabels" . | nindent 6 }} + template: + metadata: + annotations: + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "greptimedb.selectorLabels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ include "greptimedb.serviceAccountName" . }} + {{- if .Values.image.pullSecrets }} + imagePullSecrets: + {{- range .Values.image.pullSecrets }} + - name: {{ . }} + {{- end }} + {{- end }} + {{- if .Values.securityContext }} + securityContext: + {{- toYaml .Values.securityContext | nindent 8 }} + {{- end }} + terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }} + containers: + - name: {{ include "greptimedb.fullname" . }} + 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 }} + 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 + {{- with .Values.env }} + env: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.envFrom }} + envFrom: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.podSecurityContext }} + securityContext: + {{- toYaml . | nindent 12 }} + {{- end }} + volumeMounts: + - name: tmp + mountPath: /tmp + {{- with .Values.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- tpl . $ | nindent 8 }} + {{- end }} + {{- with .Values.dnsConfig }} + dnsConfig: + {{- tpl . $ | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + volumes: + - name: tmp + emptyDir: {} + {{- if .Values.persistence.enabled }} + volumeClaimTemplates: + - apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: storage + spec: + accessModes: + - ReadWriteOnce + {{- with .Values.persistence.storageClass }} + storageClassName: {{ if (eq "-" .) }}""{{ else }}{{ . }}{{ end }} + {{- end }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} + {{- with .Values.persistence.selector }} + selector: + {{- toYaml . | nindent 10 }} + {{- end }} + {{- end }} diff --git a/charts/greptimedb-standalone/values.yaml b/charts/greptimedb-standalone/values.yaml index bb6708b..780f03e 100644 --- a/charts/greptimedb-standalone/values.yaml +++ b/charts/greptimedb-standalone/values.yaml @@ -4,22 +4,17 @@ image: repository: greptime/greptimedb # The image tag tag: "v0.4.0" - + # The image pull policy for the controller pullPolicy: IfNotPresent + # The image pull secrets. pullSecrets: [] +# Overrides the chart's name nameOverride: "" +# Provide a name to substitute for the full names of resources fullnameOverride: "" -command: [ - "greptime", "standalone", "start" -] - -args: [] - -env: [] - serviceAccount: # Specifies whether a service account should be created create: true @@ -29,25 +24,120 @@ serviceAccount: # If not set and create is true, a name is generated using the fullname template name: "" +# Command to execute instead of defined in Docker image +command: [ + "greptime", "standalone", "start" +] + +# Additional cli args +args: [] + +# Environment variables +env: [] +# - name: DEMO_GREETING +# value: "Hello from the environment" + +# Environment variables +envFrom: {} +# - secretRef: +# name: config + +# The pod annotations podAnnotations: {} +# The pod labels +podLabels: {} + +# The pod security context podSecurityContext: {} +# runAsUser: 1000 +# runAsGroup: 3000 +# fsGroup: 2000 +# The annotations +annotations: {} +# imageregistry: "https://hub.docker.com/" + +# The security context securityContext: {} +# runAsUser: 1000 +# runAsGroup: 3000 +# fsGroup: 2000 service: type: ClusterIP -resources: - limits: - cpu: 800m - memory: 1Gi - requests: - cpu: 200m - memory: 512Mi +# Resource requests and limits for the container +resources: {} +# limits: +# cpu: 800m +# memory: 1Gi +# requests: +# cpu: 200m +# memory: 512Mi + + +# The node selector nodeSelector: {} +# disktype: ssd + +# The tolerations tolerations: {} +# - key: "key1" +# operator: "Equal" +# value: "value1" +# effect: "NoSchedule" + +# The affinity rules affinity: {} +# nodeAffinity: +# requiredDuringSchedulingIgnoredDuringExecution: +# nodeSelectorTerms: +# - matchExpressions: +# - key: topology.kubernetes.io/zone +# operator: In +# values: +# - antarctica-east1 +# - antarctica-west1 +# preferredDuringSchedulingIgnoredDuringExecution: +# - weight: 1 +# preference: +# matchExpressions: +# - key: another-node-label-key +# operator: In +# values: +# - another-node-label-value + +# DNS config for pods +dnsConfig: {} +# nameservers: +# - 10.0.0.1 +# searches: +# - mydomain.local +# options: +# - name: ndots +# value: "2" + + +# Grace period to allow the single binary to shutdown before it is killed +terminationGracePeriodSeconds: 30 + + +persistence: + # Enable persistent disk + enabled: true + + # Enable StatefulSetAutoDeletePVC feature + enableStatefulSetAutoDeletePVC: false + + # Size of persistent disk + size: 10Gi + + # Storage class name + storageClass: null + + # Selector for persistent disk + selector: null From 5468ba81f8a4ddeda53cd341d63334a90412b86a Mon Sep 17 00:00:00 2001 From: liyang Date: Thu, 12 Oct 2023 20:06:02 +0800 Subject: [PATCH 03/10] feat: add more values --- .../templates/podmonitor.yaml | 12 +++- .../templates/service.yaml | 4 ++ .../templates/statefulset.yaml | 13 ++--- charts/greptimedb-standalone/values.yaml | 57 +++++++++++++------ 4 files changed, 60 insertions(+), 26 deletions(-) diff --git a/charts/greptimedb-standalone/templates/podmonitor.yaml b/charts/greptimedb-standalone/templates/podmonitor.yaml index 148a6b0..938a886 100644 --- a/charts/greptimedb-standalone/templates/podmonitor.yaml +++ b/charts/greptimedb-standalone/templates/podmonitor.yaml @@ -1,13 +1,20 @@ +{{- if .Values.monitoring.enabled }} apiVersion: monitoring.coreos.com/v1 kind: PodMonitor metadata: name: {{ include "greptimedb.fullname" . }} namespace: {{ .Release.Namespace }} + {{- with .Values.monitoring.labels }} labels: - release: prometheus + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.monitoring.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} spec: podMetricsEndpoints: - - interval: 30s + - interval: {{ .Values.monitoring.interval }} port: http path: /metrics namespaceSelector: @@ -16,3 +23,4 @@ spec: selector: matchLabels: {{- include "greptimedb.selectorLabels" . | nindent 6 }} +{{- end }} diff --git a/charts/greptimedb-standalone/templates/service.yaml b/charts/greptimedb-standalone/templates/service.yaml index 673f826..09ac8d0 100644 --- a/charts/greptimedb-standalone/templates/service.yaml +++ b/charts/greptimedb-standalone/templates/service.yaml @@ -4,6 +4,10 @@ metadata: name: {{ include "greptimedb.fullname" . }} labels: {{- include "greptimedb.labels" . | nindent 4 }} + {{- with .Values.service.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} spec: type: {{ .Values.service.type }} ports: diff --git a/charts/greptimedb-standalone/templates/statefulset.yaml b/charts/greptimedb-standalone/templates/statefulset.yaml index 260ecee..1c73867 100644 --- a/charts/greptimedb-standalone/templates/statefulset.yaml +++ b/charts/greptimedb-standalone/templates/statefulset.yaml @@ -90,19 +90,19 @@ spec: {{- toYaml . | nindent 12 }} {{- end }} volumeMounts: - - name: tmp - mountPath: /tmp + - name: data + mountPath: /data {{- with .Values.resources }} resources: {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.affinity }} affinity: - {{- tpl . $ | nindent 8 }} + {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.dnsConfig }} dnsConfig: - {{- tpl . $ | nindent 8 }} + {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.nodeSelector }} nodeSelector: @@ -112,15 +112,12 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} - volumes: - - name: tmp - emptyDir: {} {{- if .Values.persistence.enabled }} volumeClaimTemplates: - apiVersion: v1 kind: PersistentVolumeClaim metadata: - name: storage + name: data spec: accessModes: - ReadWriteOnce diff --git a/charts/greptimedb-standalone/values.yaml b/charts/greptimedb-standalone/values.yaml index 780f03e..99bbf14 100644 --- a/charts/greptimedb-standalone/values.yaml +++ b/charts/greptimedb-standalone/values.yaml @@ -33,9 +33,32 @@ command: [ args: [] # Environment variables -env: [] -# - name: DEMO_GREETING -# value: "Hello from the environment" +env: + GREPTIMEDB_STANDALONE__HTTP_OPTIONS__ADDR: "0.0.0.0:4000" + GREPTIMEDB_STANDALONE__HTTP_OPTIONS__TIMEOUT: "120s" + GREPTIMEDB_STANDALONE__PROM_OPTIONS__ADDR: "0.0.0.0:4004" + GREPTIMEDB_STANDALONE__WAL__FILE_SIZE: "128MB" + GREPTIMEDB_STANDALONE__WAL__PURGE_THRESHOLD: "2GB" + GREPTIMEDB_STANDALONE__STORAGE__TYPE: "File" + # Temporary put this in another directory to clear the database's data. + GREPTIMEDB_STANDALONE__STORAGE__DATA_HOME: "/tmp/greptimedb/data" + # GREPTIMEDB_STANDALONE__STORAGE__TYPE: "S3" + # GREPTIMEDB_STANDALONE__STORAGE__BUCKET: "bucket-name" + # GREPTIMEDB_STANDALONE__STORAGE__ROOT: "/data" + # GREPTIMEDB_STANDALONE__STORAGE__REGION: "ap-southeast-1" + GREPTIMEDB_STANDALONE__STORAGE__CACHE_PATH: "/tmp/greptimedb/s3cache" + GREPTIMEDB_STANDALONE__STORAGE__GLOBAL_TTL: "1d" + GREPTIMEDB_STANDALONE__STORAGE__MANIFEST__CHECKPOINT_ON_STARTUP: "true" + # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__REGION_WRITE_BUFFER_SIZE: "256MB" + # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__REGION_WRITE_BUFFER_SIZE: "1MB" + GREPTIMEDB_STANDALONE__STORAGE__FLUSH__GLOBAL_WRITE_BUFFER_SIZE: "512MB" + # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__GLOBAL_WRITE_BUFFER_SIZE: "300MB" + # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__GLOBAL_WRITE_BUFFER_SIZE: "100MB" + # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__AUTO_FLUSH_INTERVAL: "5m" + # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__MAX_FLUSH_TASKS: "2" + # GREPTIMEDB_STANDALONE__STORAGE__COMPACTION__MAX_INFLIGHT_TASKS: "2" + MALLOC_CONF: "prof:true" + # GREPTIMEDB_STANDALONE__STORAGE__SKIP_WAL: "true" # Environment variables envFrom: {} @@ -64,10 +87,6 @@ securityContext: {} # runAsGroup: 3000 # fsGroup: 2000 -service: - type: ClusterIP - - # Resource requests and limits for the container resources: {} # limits: @@ -77,12 +96,10 @@ resources: {} # cpu: 200m # memory: 512Mi - # The node selector nodeSelector: {} # disktype: ssd - # The tolerations tolerations: {} # - key: "key1" @@ -90,7 +107,6 @@ tolerations: {} # value: "value1" # effect: "NoSchedule" - # The affinity rules affinity: {} # nodeAffinity: @@ -121,23 +137,32 @@ dnsConfig: {} # - name: ndots # value: "2" - # Grace period to allow the single binary to shutdown before it is killed terminationGracePeriodSeconds: 30 - persistence: # Enable persistent disk enabled: true - # Enable StatefulSetAutoDeletePVC feature enableStatefulSetAutoDeletePVC: false - # Size of persistent disk size: 10Gi - # Storage class name storageClass: null - # Selector for persistent disk selector: null + +monitoring: + enabled: true + # PodMonitor annotations + annotations: {} + # PodMonitor labels + labels: + release: prometheus + # PodMonitor scrape interval + interval: 15s + +service: + type: ClusterIP + # Annotations for Service + annotations: {} From fd88b1e5a4f0e62382b38e9af11b23c0585d8f2a Mon Sep 17 00:00:00 2001 From: liyang Date: Thu, 12 Oct 2023 20:28:30 +0800 Subject: [PATCH 04/10] chore: ready for review --- charts/greptimedb-standalone/values.yaml | 55 ++++++++++++------------ 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/charts/greptimedb-standalone/values.yaml b/charts/greptimedb-standalone/values.yaml index 99bbf14..b9ec8ce 100644 --- a/charts/greptimedb-standalone/values.yaml +++ b/charts/greptimedb-standalone/values.yaml @@ -33,32 +33,32 @@ command: [ args: [] # Environment variables -env: - GREPTIMEDB_STANDALONE__HTTP_OPTIONS__ADDR: "0.0.0.0:4000" - GREPTIMEDB_STANDALONE__HTTP_OPTIONS__TIMEOUT: "120s" - GREPTIMEDB_STANDALONE__PROM_OPTIONS__ADDR: "0.0.0.0:4004" - GREPTIMEDB_STANDALONE__WAL__FILE_SIZE: "128MB" - GREPTIMEDB_STANDALONE__WAL__PURGE_THRESHOLD: "2GB" - GREPTIMEDB_STANDALONE__STORAGE__TYPE: "File" - # Temporary put this in another directory to clear the database's data. - GREPTIMEDB_STANDALONE__STORAGE__DATA_HOME: "/tmp/greptimedb/data" - # GREPTIMEDB_STANDALONE__STORAGE__TYPE: "S3" - # GREPTIMEDB_STANDALONE__STORAGE__BUCKET: "bucket-name" - # GREPTIMEDB_STANDALONE__STORAGE__ROOT: "/data" - # GREPTIMEDB_STANDALONE__STORAGE__REGION: "ap-southeast-1" - GREPTIMEDB_STANDALONE__STORAGE__CACHE_PATH: "/tmp/greptimedb/s3cache" - GREPTIMEDB_STANDALONE__STORAGE__GLOBAL_TTL: "1d" - GREPTIMEDB_STANDALONE__STORAGE__MANIFEST__CHECKPOINT_ON_STARTUP: "true" - # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__REGION_WRITE_BUFFER_SIZE: "256MB" - # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__REGION_WRITE_BUFFER_SIZE: "1MB" - GREPTIMEDB_STANDALONE__STORAGE__FLUSH__GLOBAL_WRITE_BUFFER_SIZE: "512MB" - # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__GLOBAL_WRITE_BUFFER_SIZE: "300MB" - # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__GLOBAL_WRITE_BUFFER_SIZE: "100MB" - # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__AUTO_FLUSH_INTERVAL: "5m" - # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__MAX_FLUSH_TASKS: "2" - # GREPTIMEDB_STANDALONE__STORAGE__COMPACTION__MAX_INFLIGHT_TASKS: "2" - MALLOC_CONF: "prof:true" - # GREPTIMEDB_STANDALONE__STORAGE__SKIP_WAL: "true" +env: [] +# GREPTIMEDB_STANDALONE__HTTP_OPTIONS__ADDR: "0.0.0.0:4000" +# GREPTIMEDB_STANDALONE__HTTP_OPTIONS__TIMEOUT: "120s" +# GREPTIMEDB_STANDALONE__PROM_OPTIONS__ADDR: "0.0.0.0:4004" +# GREPTIMEDB_STANDALONE__WAL__FILE_SIZE: "128MB" +# GREPTIMEDB_STANDALONE__WAL__PURGE_THRESHOLD: "2GB" +# GREPTIMEDB_STANDALONE__STORAGE__TYPE: "File" +# # Temporary put this in another directory to clear the database's data. +# GREPTIMEDB_STANDALONE__STORAGE__DATA_HOME: "/tmp/greptimedb/data" +# # GREPTIMEDB_STANDALONE__STORAGE__TYPE: "S3" +# # GREPTIMEDB_STANDALONE__STORAGE__BUCKET: "bucket-name" +# # GREPTIMEDB_STANDALONE__STORAGE__ROOT: "/data" +# # GREPTIMEDB_STANDALONE__STORAGE__REGION: "ap-southeast-1" +# GREPTIMEDB_STANDALONE__STORAGE__CACHE_PATH: "/tmp/greptimedb/s3cache" +# GREPTIMEDB_STANDALONE__STORAGE__GLOBAL_TTL: "1d" +# GREPTIMEDB_STANDALONE__STORAGE__MANIFEST__CHECKPOINT_ON_STARTUP: "true" +# # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__REGION_WRITE_BUFFER_SIZE: "256MB" +# # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__REGION_WRITE_BUFFER_SIZE: "1MB" +# GREPTIMEDB_STANDALONE__STORAGE__FLUSH__GLOBAL_WRITE_BUFFER_SIZE: "512MB" +# # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__GLOBAL_WRITE_BUFFER_SIZE: "300MB" +# # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__GLOBAL_WRITE_BUFFER_SIZE: "100MB" +# # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__AUTO_FLUSH_INTERVAL: "5m" +# # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__MAX_FLUSH_TASKS: "2" +# # GREPTIMEDB_STANDALONE__STORAGE__COMPACTION__MAX_INFLIGHT_TASKS: "2" +# MALLOC_CONF: "prof:true" +# # GREPTIMEDB_STANDALONE__STORAGE__SKIP_WAL: "true" # Environment variables envFrom: {} @@ -157,8 +157,7 @@ monitoring: # PodMonitor annotations annotations: {} # PodMonitor labels - labels: - release: prometheus + labels: {} # PodMonitor scrape interval interval: 15s From 423c2299793dd3b98f49e7de025631744773b3d1 Mon Sep 17 00:00:00 2001 From: liyang Date: Thu, 12 Oct 2023 20:32:17 +0800 Subject: [PATCH 05/10] chore: default disable monitoring --- charts/greptimedb-standalone/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/greptimedb-standalone/values.yaml b/charts/greptimedb-standalone/values.yaml index b9ec8ce..807c665 100644 --- a/charts/greptimedb-standalone/values.yaml +++ b/charts/greptimedb-standalone/values.yaml @@ -153,7 +153,7 @@ persistence: selector: null monitoring: - enabled: true + enabled: false # PodMonitor annotations annotations: {} # PodMonitor labels From 08aae789e4bcd9070011e751b9b919043f8381fa Mon Sep 17 00:00:00 2001 From: liyang Date: Fri, 13 Oct 2023 12:04:25 +0800 Subject: [PATCH 06/10] feat: add readme --- .github/chart-test.yaml | 1 + charts/greptimedb-standalone/README.md | 20 +++++++++++ .../templates/service.yaml | 20 +++++------ .../templates/statefulset.yaml | 19 +++++----- charts/greptimedb-standalone/values.yaml | 36 +++++++++++-------- 5 files changed, 64 insertions(+), 32 deletions(-) create mode 100644 charts/greptimedb-standalone/README.md diff --git a/.github/chart-test.yaml b/.github/chart-test.yaml index 2772345..87389c9 100644 --- a/.github/chart-test.yaml +++ b/.github/chart-test.yaml @@ -3,3 +3,4 @@ chart-dirs: charts: - charts/greptimedb-operator - charts/greptimedb + - charts/greptimedb-standalone diff --git a/charts/greptimedb-standalone/README.md b/charts/greptimedb-standalone/README.md new file mode 100644 index 0000000..0165628 --- /dev/null +++ b/charts/greptimedb-standalone/README.md @@ -0,0 +1,20 @@ +# Overview + +Helm chart for [GreptimeDB](https://github.com/GreptimeTeam/greptimedb) standalone mode. + +## How to install + +```console +# Add charts repo. +helm repo add greptime https://greptimeteam.github.io/helm-charts/ +helm repo update + +# Install greptimedb in default namespace. +helm install greptimedb greptime/greptimedb-standalone -n default --devel +``` + +## How to uninstall + +```console +helm uninstall greptimedb -n default +``` diff --git a/charts/greptimedb-standalone/templates/service.yaml b/charts/greptimedb-standalone/templates/service.yaml index 09ac8d0..4068018 100644 --- a/charts/greptimedb-standalone/templates/service.yaml +++ b/charts/greptimedb-standalone/templates/service.yaml @@ -12,24 +12,24 @@ spec: type: {{ .Values.service.type }} ports: - name: http - port: 4000 - targetPort: 4000 + port: {{ .Values.httpPort }} + targetPort: {{ .Values.httpPort }} protocol: TCP - name: grpc - port: 4001 - targetPort: 4001 + port: {{ .Values.grpcPort }} + targetPort: {{ .Values.grpcPort }} protocol: TCP - name: mysql - port: 4002 - targetPort: 4002 + port: {{ .Values.mysqlPort }} + targetPort: {{ .Values.mysqlPort }} protocol: TCP - name: postgres - port: 4003 - targetPort: 4003 + port: {{ .Values.postgresPort }} + targetPort: {{ .Values.postgresPort }} protocol: TCP - name: prom - port: 4004 - targetPort: 4004 + port: {{ .Values.promPort }} + targetPort: {{ .Values.promPort }} protocol: TCP selector: {{- include "greptimedb.selectorLabels" . | nindent 4 }} diff --git a/charts/greptimedb-standalone/templates/statefulset.yaml b/charts/greptimedb-standalone/templates/statefulset.yaml index 1c73867..513aad4 100644 --- a/charts/greptimedb-standalone/templates/statefulset.yaml +++ b/charts/greptimedb-standalone/templates/statefulset.yaml @@ -62,24 +62,27 @@ spec: {{- toYaml . | nindent 10 }} {{- end }} ports: - - containerPort: 4000 + - containerPort: {{ .Values.httpPort }} name: http protocol: TCP - - containerPort: 4001 + - containerPort: {{ .Values.grpcPort }} name: grpc protocol: TCP - - containerPort: 4002 + - containerPort: {{ .Values.mysqlPort }} name: mysql protocol: TCP - - containerPort: 4003 + - containerPort: {{ .Values.postgresPort }} name: postgres protocol: TCP - - containerPort: 4004 + - containerPort: {{ .Values.promPort }} name: prom protocol: TCP - {{- with .Values.env }} + {{- if .Values.env }} env: - {{- toYaml . | nindent 12 }} + {{- range $key, $val := .Values.env }} + - name: {{ $key }} + value: {{ $val | quote }} + {{- end }} {{- end }} {{- with .Values.envFrom }} envFrom: @@ -91,7 +94,7 @@ spec: {{- end }} volumeMounts: - name: data - mountPath: /data + mountPath: /tmp/greptimedb {{- with .Values.resources }} resources: {{- toYaml . | nindent 12 }} diff --git a/charts/greptimedb-standalone/values.yaml b/charts/greptimedb-standalone/values.yaml index 807c665..4ed3adf 100644 --- a/charts/greptimedb-standalone/values.yaml +++ b/charts/greptimedb-standalone/values.yaml @@ -24,43 +24,44 @@ serviceAccount: # If not set and create is true, a name is generated using the fullname template name: "" -# Command to execute instead of defined in Docker image command: [ "greptime", "standalone", "start" ] -# Additional cli args args: [] -# Environment variables -env: [] -# GREPTIMEDB_STANDALONE__HTTP_OPTIONS__ADDR: "0.0.0.0:4000" -# GREPTIMEDB_STANDALONE__HTTP_OPTIONS__TIMEOUT: "120s" -# GREPTIMEDB_STANDALONE__PROM_OPTIONS__ADDR: "0.0.0.0:4004" +env: + GREPTIMEDB_STANDALONE__HTTP_OPTIONS__ADDR: "0.0.0.0:4000" + GREPTIMEDB_STANDALONE__HTTP_OPTIONS__TIMEOUT: "120s" + GREPTIMEDB_STANDALONE__PROM_OPTIONS__ADDR: "0.0.0.0:4004" + # GREPTIMEDB_STANDALONE__WAL__FILE_SIZE: "128MB" # GREPTIMEDB_STANDALONE__WAL__PURGE_THRESHOLD: "2GB" +# # GREPTIMEDB_STANDALONE__STORAGE__TYPE: "File" # # Temporary put this in another directory to clear the database's data. # GREPTIMEDB_STANDALONE__STORAGE__DATA_HOME: "/tmp/greptimedb/data" +# # # GREPTIMEDB_STANDALONE__STORAGE__TYPE: "S3" # # GREPTIMEDB_STANDALONE__STORAGE__BUCKET: "bucket-name" # # GREPTIMEDB_STANDALONE__STORAGE__ROOT: "/data" # # GREPTIMEDB_STANDALONE__STORAGE__REGION: "ap-southeast-1" +# # GREPTIMEDB_STANDALONE__STORAGE__CACHE_PATH: "/tmp/greptimedb/s3cache" +# GREPTIMEDB_DATANODE__WAL__DIR: "/tmp/greptimedb/wal" # GREPTIMEDB_STANDALONE__STORAGE__GLOBAL_TTL: "1d" # GREPTIMEDB_STANDALONE__STORAGE__MANIFEST__CHECKPOINT_ON_STARTUP: "true" -# # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__REGION_WRITE_BUFFER_SIZE: "256MB" -# # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__REGION_WRITE_BUFFER_SIZE: "1MB" # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__GLOBAL_WRITE_BUFFER_SIZE: "512MB" -# # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__GLOBAL_WRITE_BUFFER_SIZE: "300MB" -# # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__GLOBAL_WRITE_BUFFER_SIZE: "100MB" +# # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__REGION_WRITE_BUFFER_SIZE: "256MB" # # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__AUTO_FLUSH_INTERVAL: "5m" # # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__MAX_FLUSH_TASKS: "2" # # GREPTIMEDB_STANDALONE__STORAGE__COMPACTION__MAX_INFLIGHT_TASKS: "2" # MALLOC_CONF: "prof:true" # # GREPTIMEDB_STANDALONE__STORAGE__SKIP_WAL: "true" +# # GREPTIMEDB_DATANODE__STORAGE__MANIFEST__CHECKPOINT_MARGIN: "100" +# # GREPTIMEDB_DATANODE__STORAGE__MANIFEST__GC_DURATION: "5m" + -# Environment variables envFrom: {} # - secretRef: # name: config @@ -153,14 +154,21 @@ persistence: selector: null monitoring: - enabled: false + enabled: true # PodMonitor annotations annotations: {} # PodMonitor labels - labels: {} + labels: + release: prometheus # PodMonitor scrape interval interval: 15s +httpPort: 4000 +grpcPort: 4001 +mysqlPort: 4002 +postgresPort: 4003 +promPort: 4004 + service: type: ClusterIP # Annotations for Service From b8c989a118a7ca7a9ec808e80a638e0acf60eca8 Mon Sep 17 00:00:00 2001 From: liyang Date: Fri, 13 Oct 2023 16:31:02 +0800 Subject: [PATCH 07/10] refactor: delete prometheus port --- charts/greptimedb-standalone/Chart.yaml | 2 +- charts/greptimedb-standalone/README.md | 6 ++-- .../templates/_helpers.tpl | 20 ++++++------- .../templates/podmonitor.yaml | 4 +-- .../templates/service.yaml | 10 ++----- .../templates/serviceaccount.yaml | 4 +-- .../templates/statefulset.yaml | 28 +++++++++---------- charts/greptimedb-standalone/values.yaml | 16 ++++------- 8 files changed, 41 insertions(+), 49 deletions(-) diff --git a/charts/greptimedb-standalone/Chart.yaml b/charts/greptimedb-standalone/Chart.yaml index 01cbb87..164c0d8 100644 --- a/charts/greptimedb-standalone/Chart.yaml +++ b/charts/greptimedb-standalone/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 -name: greptimedb +name: greptimedb-standalone description: A Helm chart for deploying standalone greptimedb. type: application version: 0.1.0-alpha.1 diff --git a/charts/greptimedb-standalone/README.md b/charts/greptimedb-standalone/README.md index 0165628..fb34dbd 100644 --- a/charts/greptimedb-standalone/README.md +++ b/charts/greptimedb-standalone/README.md @@ -9,12 +9,12 @@ Helm chart for [GreptimeDB](https://github.com/GreptimeTeam/greptimedb) standalo helm repo add greptime https://greptimeteam.github.io/helm-charts/ helm repo update -# Install greptimedb in default namespace. -helm install greptimedb greptime/greptimedb-standalone -n default --devel +# Install greptimedb standalone in default namespace. +helm install greptimedb-standalone greptime/greptimedb-standalone -n default --devel ``` ## How to uninstall ```console -helm uninstall greptimedb -n default +helm uninstall greptimedb-standalone -n default ``` diff --git a/charts/greptimedb-standalone/templates/_helpers.tpl b/charts/greptimedb-standalone/templates/_helpers.tpl index 95bb9c4..f2fe3a7 100644 --- a/charts/greptimedb-standalone/templates/_helpers.tpl +++ b/charts/greptimedb-standalone/templates/_helpers.tpl @@ -1,7 +1,7 @@ {{/* Expand the name of the chart. */}} -{{- define "greptimedb.name" -}} +{{- define "greptimedb-standalone.name" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} {{- end }} @@ -10,7 +10,7 @@ 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" -}} +{{- define "greptimedb-standalone.fullname" -}} {{- if .Values.fullnameOverride }} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} {{- else }} @@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name. {{/* Create chart name and version as used by the chart label. */}} -{{- define "greptimedb.chart" -}} +{{- define "greptimedb-standalone.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" . }} +{{- 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 }} @@ -45,17 +45,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} {{/* Selector labels */}} -{{- define "greptimedb.selectorLabels" -}} -app.kubernetes.io/name: {{ include "greptimedb.name" . }} +{{- 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.serviceAccountName" -}} +{{- define "greptimedb-standalone.serviceAccountName" -}} {{- if .Values.serviceAccount.create }} -{{- default (include "greptimedb.fullname" .) .Values.serviceAccount.name }} +{{- default (include "greptimedb-standalone.fullname" .) .Values.serviceAccount.name }} {{- else }} {{- default "default" .Values.serviceAccount.name }} {{- end }} diff --git a/charts/greptimedb-standalone/templates/podmonitor.yaml b/charts/greptimedb-standalone/templates/podmonitor.yaml index 938a886..462c020 100644 --- a/charts/greptimedb-standalone/templates/podmonitor.yaml +++ b/charts/greptimedb-standalone/templates/podmonitor.yaml @@ -2,7 +2,7 @@ apiVersion: monitoring.coreos.com/v1 kind: PodMonitor metadata: - name: {{ include "greptimedb.fullname" . }} + name: {{ include "greptimedb-standalone.fullname" . }} namespace: {{ .Release.Namespace }} {{- with .Values.monitoring.labels }} labels: @@ -22,5 +22,5 @@ spec: - {{ .Release.Namespace }} selector: matchLabels: - {{- include "greptimedb.selectorLabels" . | nindent 6 }} + {{- include "greptimedb-standalone.selectorLabels" . | nindent 6 }} {{- end }} diff --git a/charts/greptimedb-standalone/templates/service.yaml b/charts/greptimedb-standalone/templates/service.yaml index 4068018..f5e072b 100644 --- a/charts/greptimedb-standalone/templates/service.yaml +++ b/charts/greptimedb-standalone/templates/service.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "greptimedb.fullname" . }} + name: {{ include "greptimedb-standalone.fullname" . }} labels: - {{- include "greptimedb.labels" . | nindent 4 }} + {{- include "greptimedb-standalone.labels" . | nindent 4 }} {{- with .Values.service.annotations }} annotations: {{- toYaml . | nindent 4 }} @@ -27,9 +27,5 @@ spec: port: {{ .Values.postgresPort }} targetPort: {{ .Values.postgresPort }} protocol: TCP - - name: prom - port: {{ .Values.promPort }} - targetPort: {{ .Values.promPort }} - protocol: TCP selector: - {{- include "greptimedb.selectorLabels" . | nindent 4 }} + {{- include "greptimedb-standalone.selectorLabels" . | nindent 4 }} diff --git a/charts/greptimedb-standalone/templates/serviceaccount.yaml b/charts/greptimedb-standalone/templates/serviceaccount.yaml index 4e1e2c8..fb5abec 100644 --- a/charts/greptimedb-standalone/templates/serviceaccount.yaml +++ b/charts/greptimedb-standalone/templates/serviceaccount.yaml @@ -2,10 +2,10 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: {{ include "greptimedb.serviceAccountName" . }} + name: {{ include "greptimedb-standalone.serviceAccountName" . }} namespace: {{ .Release.Namespace }} labels: - {{- include "greptimedb.labels" . | nindent 4 }} + {{- include "greptimedb-standalone.labels" . | nindent 4 }} {{- with .Values.serviceAccount.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/charts/greptimedb-standalone/templates/statefulset.yaml b/charts/greptimedb-standalone/templates/statefulset.yaml index 513aad4..e45ba20 100644 --- a/charts/greptimedb-standalone/templates/statefulset.yaml +++ b/charts/greptimedb-standalone/templates/statefulset.yaml @@ -1,10 +1,10 @@ apiVersion: apps/v1 kind: StatefulSet metadata: - name: {{ include "greptimedb.fullname" . }} + name: {{ include "greptimedb-standalone.fullname" . }} namespace: {{ $.Release.Namespace }} labels: - {{- include "greptimedb.labels" . | nindent 4 }} + {{- include "greptimedb-standalone.labels" . | nindent 4 }} {{- if not (empty .Values.annotations) }} annotations: {{- with .Values.annotations }} @@ -16,7 +16,7 @@ spec: updateStrategy: rollingUpdate: partition: 0 - serviceName: {{ include "greptimedb.fullname" . }} + serviceName: {{ include "greptimedb-standalone.fullname" . }} {{- if and (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) (.Values.persistence.enableStatefulSetAutoDeletePVC) (.Values.persistence.enabled) }} persistentVolumeClaimRetentionPolicy: whenDeleted: Delete @@ -24,7 +24,7 @@ spec: {{- end }} selector: matchLabels: - {{- include "greptimedb.selectorLabels" . | nindent 6 }} + {{- include "greptimedb-standalone.selectorLabels" . | nindent 6 }} template: metadata: annotations: @@ -32,12 +32,12 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} labels: - {{- include "greptimedb.selectorLabels" . | nindent 8 }} + {{- include "greptimedb-standalone.selectorLabels" . | nindent 8 }} {{- with .Values.podLabels }} {{- toYaml . | nindent 8 }} {{- end }} spec: - serviceAccountName: {{ include "greptimedb.serviceAccountName" . }} + serviceAccountName: {{ include "greptimedb-standalone.serviceAccountName" . }} {{- if .Values.image.pullSecrets }} imagePullSecrets: {{- range .Values.image.pullSecrets }} @@ -50,16 +50,19 @@ spec: {{- end }} terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }} containers: - - name: {{ include "greptimedb.fullname" . }} + - name: {{ include "greptimedb-standalone.fullname" . }} 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 }} + - greptime + - standalone + - start + {{- if .Values.command }} + {{- toYaml .Values.command | nindent 12 }} {{- end }} - {{- with .Values.args }} + {{- if .Values.args }} args: - {{- toYaml . | nindent 10 }} + {{- toYaml .Values.args | nindent 12 }} {{- end }} ports: - containerPort: {{ .Values.httpPort }} @@ -74,9 +77,6 @@ spec: - containerPort: {{ .Values.postgresPort }} name: postgres protocol: TCP - - containerPort: {{ .Values.promPort }} - name: prom - protocol: TCP {{- if .Values.env }} env: {{- range $key, $val := .Values.env }} diff --git a/charts/greptimedb-standalone/values.yaml b/charts/greptimedb-standalone/values.yaml index 4ed3adf..af79f8c 100644 --- a/charts/greptimedb-standalone/values.yaml +++ b/charts/greptimedb-standalone/values.yaml @@ -24,16 +24,14 @@ serviceAccount: # If not set and create is true, a name is generated using the fullname template name: "" -command: [ - "greptime", "standalone", "start" -] +command: [] args: [] env: - GREPTIMEDB_STANDALONE__HTTP_OPTIONS__ADDR: "0.0.0.0:4000" - GREPTIMEDB_STANDALONE__HTTP_OPTIONS__TIMEOUT: "120s" - GREPTIMEDB_STANDALONE__PROM_OPTIONS__ADDR: "0.0.0.0:4004" + GREPTIMEDB_STANDALONE__HTTP__ADDR: "0.0.0.0:4000" + GREPTIMEDB_STANDALONE__HTTP__TIMEOUT: "120s" +# GREPTIMEDB_STANDALONE__PROM_OPTIONS__ADDR: "0.0.0.0:4004" # GREPTIMEDB_STANDALONE__WAL__FILE_SIZE: "128MB" # GREPTIMEDB_STANDALONE__WAL__PURGE_THRESHOLD: "2GB" @@ -154,12 +152,11 @@ persistence: selector: null monitoring: - enabled: true + enabled: false # PodMonitor annotations annotations: {} # PodMonitor labels - labels: - release: prometheus + labels: {} # PodMonitor scrape interval interval: 15s @@ -167,7 +164,6 @@ httpPort: 4000 grpcPort: 4001 mysqlPort: 4002 postgresPort: 4003 -promPort: 4004 service: type: ClusterIP From 21514087bc3a92929cc313d9714b17a2c28c4a02 Mon Sep 17 00:00:00 2001 From: liyang Date: Mon, 16 Oct 2023 19:38:41 +0800 Subject: [PATCH 08/10] refactor: greptimedb standalone storage configure --- charts/greptimedb-standalone/values.yaml | 53 ++++++++++++------------ 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/charts/greptimedb-standalone/values.yaml b/charts/greptimedb-standalone/values.yaml index af79f8c..098a180 100644 --- a/charts/greptimedb-standalone/values.yaml +++ b/charts/greptimedb-standalone/values.yaml @@ -31,33 +31,32 @@ args: [] env: GREPTIMEDB_STANDALONE__HTTP__ADDR: "0.0.0.0:4000" GREPTIMEDB_STANDALONE__HTTP__TIMEOUT: "120s" -# GREPTIMEDB_STANDALONE__PROM_OPTIONS__ADDR: "0.0.0.0:4004" - -# GREPTIMEDB_STANDALONE__WAL__FILE_SIZE: "128MB" -# GREPTIMEDB_STANDALONE__WAL__PURGE_THRESHOLD: "2GB" -# -# GREPTIMEDB_STANDALONE__STORAGE__TYPE: "File" -# # Temporary put this in another directory to clear the database's data. -# GREPTIMEDB_STANDALONE__STORAGE__DATA_HOME: "/tmp/greptimedb/data" -# -# # GREPTIMEDB_STANDALONE__STORAGE__TYPE: "S3" -# # GREPTIMEDB_STANDALONE__STORAGE__BUCKET: "bucket-name" -# # GREPTIMEDB_STANDALONE__STORAGE__ROOT: "/data" -# # GREPTIMEDB_STANDALONE__STORAGE__REGION: "ap-southeast-1" -# -# GREPTIMEDB_STANDALONE__STORAGE__CACHE_PATH: "/tmp/greptimedb/s3cache" -# GREPTIMEDB_DATANODE__WAL__DIR: "/tmp/greptimedb/wal" -# GREPTIMEDB_STANDALONE__STORAGE__GLOBAL_TTL: "1d" -# GREPTIMEDB_STANDALONE__STORAGE__MANIFEST__CHECKPOINT_ON_STARTUP: "true" -# GREPTIMEDB_STANDALONE__STORAGE__FLUSH__GLOBAL_WRITE_BUFFER_SIZE: "512MB" -# # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__REGION_WRITE_BUFFER_SIZE: "256MB" -# # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__AUTO_FLUSH_INTERVAL: "5m" -# # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__MAX_FLUSH_TASKS: "2" -# # GREPTIMEDB_STANDALONE__STORAGE__COMPACTION__MAX_INFLIGHT_TASKS: "2" -# MALLOC_CONF: "prof:true" -# # GREPTIMEDB_STANDALONE__STORAGE__SKIP_WAL: "true" -# # GREPTIMEDB_DATANODE__STORAGE__MANIFEST__CHECKPOINT_MARGIN: "100" -# # GREPTIMEDB_DATANODE__STORAGE__MANIFEST__GC_DURATION: "5m" + + GREPTIMEDB_STANDALONE__WAL__FILE_SIZE: "128MB" + GREPTIMEDB_STANDALONE__WAL__PURGE_THRESHOLD: "2GB" + GREPTIMEDB_DATANODE__WAL__DIR: "/tmp/greptimedb/wal" + +# # configure to use local storage. + GREPTIMEDB_STANDALONE__STORAGE__TYPE: "File" + GREPTIMEDB_STANDALONE__STORAGE__DATA_HOME: "/tmp/greptimedb" + +# # configure to use s3 storage. +# GREPTIMEDB_STANDALONE__STORAGE__TYPE: "S3" +# GREPTIMEDB_STANDALONE__STORAGE__BUCKET: "bucket-name" +# GREPTIMEDB_STANDALONE__STORAGE__ROOT: "/data" +# GREPTIMEDB_STANDALONE__STORAGE__REGION: "ap-southeast-1" +# GREPTIMEDB_STANDALONE__STORAGE__ACCESS_KEY_ID: "access_key_id" +# GREPTIMEDB_STANDALONE__STORAGE__SECRET_ACCESS_KEY: "secret_access_key" +# GREPTIMEDB_STANDALONE__STORAGE__CACHE__CACHE_PATH: "/tmp/greptimedb/s3cache" + + GREPTIMEDB_STANDALONE__STORAGE__GLOBAL_TTL: "1d" + GREPTIMEDB_STANDALONE__STORAGE__FLUSH__GLOBAL_WRITE_BUFFER_SIZE: "512MB" +# GREPTIMEDB_STANDALONE__STORAGE__FLUSH__REGION_WRITE_BUFFER_SIZE: "256MB" +# GREPTIMEDB_STANDALONE__STORAGE__FLUSH__AUTO_FLUSH_INTERVAL: "5m" +# GREPTIMEDB_STANDALONE__STORAGE__FLUSH__MAX_FLUSH_TASKS: "2" +# GREPTIMEDB_STANDALONE__STORAGE__COMPACTION__MAX_INFLIGHT_TASKS: "2" +# GREPTIMEDB_DATANODE__STORAGE__MANIFEST__CHECKPOINT_MARGIN: "100" +# GREPTIMEDB_DATANODE__STORAGE__MANIFEST__GC_DURATION: "5m" envFrom: {} From c4801767da0a2c04ad40c56b7de93694586f5ff4 Mon Sep 17 00:00:00 2001 From: liyang Date: Mon, 16 Oct 2023 20:02:44 +0800 Subject: [PATCH 09/10] refactor: use greptimedb config default values --- charts/greptimedb-standalone/values.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/charts/greptimedb-standalone/values.yaml b/charts/greptimedb-standalone/values.yaml index 098a180..cd6d40f 100644 --- a/charts/greptimedb-standalone/values.yaml +++ b/charts/greptimedb-standalone/values.yaml @@ -30,15 +30,15 @@ args: [] env: GREPTIMEDB_STANDALONE__HTTP__ADDR: "0.0.0.0:4000" - GREPTIMEDB_STANDALONE__HTTP__TIMEOUT: "120s" - - GREPTIMEDB_STANDALONE__WAL__FILE_SIZE: "128MB" - GREPTIMEDB_STANDALONE__WAL__PURGE_THRESHOLD: "2GB" - GREPTIMEDB_DATANODE__WAL__DIR: "/tmp/greptimedb/wal" +# GREPTIMEDB_STANDALONE__HTTP__TIMEOUT: "120s" +# +# GREPTIMEDB_STANDALONE__WAL__FILE_SIZE: "128MB" +# GREPTIMEDB_STANDALONE__WAL__PURGE_THRESHOLD: "2GB" +# GREPTIMEDB_DATANODE__WAL__DIR: "/tmp/greptimedb/wal" # # configure to use local storage. - GREPTIMEDB_STANDALONE__STORAGE__TYPE: "File" - GREPTIMEDB_STANDALONE__STORAGE__DATA_HOME: "/tmp/greptimedb" +# GREPTIMEDB_STANDALONE__STORAGE__TYPE: "File" +# GREPTIMEDB_STANDALONE__STORAGE__DATA_HOME: "/tmp/greptimedb" # # configure to use s3 storage. # GREPTIMEDB_STANDALONE__STORAGE__TYPE: "S3" From 134b8775a924e5db5e1fefba248c150ae8b69f95 Mon Sep 17 00:00:00 2001 From: liyang Date: Mon, 16 Oct 2023 20:05:26 +0800 Subject: [PATCH 10/10] refactor: use greptimedb config default values --- charts/greptimedb-standalone/values.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/greptimedb-standalone/values.yaml b/charts/greptimedb-standalone/values.yaml index cd6d40f..deaac9a 100644 --- a/charts/greptimedb-standalone/values.yaml +++ b/charts/greptimedb-standalone/values.yaml @@ -31,7 +31,7 @@ args: [] env: GREPTIMEDB_STANDALONE__HTTP__ADDR: "0.0.0.0:4000" # GREPTIMEDB_STANDALONE__HTTP__TIMEOUT: "120s" -# + # GREPTIMEDB_STANDALONE__WAL__FILE_SIZE: "128MB" # GREPTIMEDB_STANDALONE__WAL__PURGE_THRESHOLD: "2GB" # GREPTIMEDB_DATANODE__WAL__DIR: "/tmp/greptimedb/wal" @@ -49,8 +49,8 @@ env: # GREPTIMEDB_STANDALONE__STORAGE__SECRET_ACCESS_KEY: "secret_access_key" # GREPTIMEDB_STANDALONE__STORAGE__CACHE__CACHE_PATH: "/tmp/greptimedb/s3cache" - GREPTIMEDB_STANDALONE__STORAGE__GLOBAL_TTL: "1d" - GREPTIMEDB_STANDALONE__STORAGE__FLUSH__GLOBAL_WRITE_BUFFER_SIZE: "512MB" +# GREPTIMEDB_STANDALONE__STORAGE__GLOBAL_TTL: "1d" +# GREPTIMEDB_STANDALONE__STORAGE__FLUSH__GLOBAL_WRITE_BUFFER_SIZE: "512MB" # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__REGION_WRITE_BUFFER_SIZE: "256MB" # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__AUTO_FLUSH_INTERVAL: "5m" # GREPTIMEDB_STANDALONE__STORAGE__FLUSH__MAX_FLUSH_TASKS: "2"