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

add tikv-importer chart #1910

Merged
merged 3 commits into from
Mar 13, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
21 changes: 21 additions & 0 deletions charts/tikv-importer/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 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
*~
# Various IDEs
.project
.idea/
*.tmproj
13 changes: 13 additions & 0 deletions charts/tikv-importer/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
description: A Helm chart for TiKV Importer
name: tikv-importer
version: dev
home: https://github.com/pingcap/tidb-operator
sources:
- https://github.com/pingcap/tidb-operator
keywords:
- newsql
- htap
- database
- mysql
- raft
21 changes: 21 additions & 0 deletions charts/tikv-importer/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "chart.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Encapsulate tikv-importer configmap data for consistent digest calculation
*/}}
{{- define "importer-configmap.data" -}}
config-file: |-
{{- if .Values.config }}
{{ .Values.config | indent 2 }}
{{- end -}}
{{- end -}}

{{- define "importer-configmap.data-digest" -}}
{{ include "importer-configmap.data" . | sha256sum | trunc 8 }}
{{- end -}}
12 changes: 12 additions & 0 deletions charts/tikv-importer/templates/tikv-importer-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.clusterName }}-importer-{{ template "importer-configmap.data-digest" . }}
labels:
app.kubernetes.io/name: {{ template "chart.name" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: importer
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
data:
{{ include "importer-configmap.data" . | indent 2 }}
19 changes: 19 additions & 0 deletions charts/tikv-importer/templates/tikv-importer-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.clusterName }}-importer
labels:
app.kubernetes.io/name: {{ template "chart.name" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: importer
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
spec:
clusterIP: None
ports:
- name: importer
port: 8287
selector:
app.kubernetes.io/name: {{ template "chart.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: importer
89 changes: 89 additions & 0 deletions charts/tikv-importer/templates/tikv-importer-statefulset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ .Values.clusterName }}-importer
labels:
app.kubernetes.io/name: {{ template "chart.name" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: importer
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
spec:
selector:
matchLabels:
app.kubernetes.io/name: {{ template "chart.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: importer
serviceName: {{ .Values.clusterName }}-importer
replicas: 1
template:
metadata:
annotations:
prometheus.io/scrape: "true"
prometheus.io/path: "/metrics"
prometheus.io/port: "9091"
labels:
app.kubernetes.io/name: {{ template "chart.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: importer
spec:
{{- if .Values.affinity }}
affinity:
{{ toYaml .Values.affinity | indent 6 }}
{{- end }}
{{- if .Values.tolerations }}
tolerations:
{{ toYaml .Values.tolerations | indent 6 }}
{{- end }}
containers:
- name: importer
image: {{ .Values.image }}
imagePullPolicy: {{ .Values.imagePullPolicy | default "IfNotPresent"}}
command:
- /tikv-importer
# tikv-importer does not support domain name: https://github.com/tikv/importer/issues/16
# - --addr=${MY_POD_NAME}.tikv-importer:8287
- --addr=$(MY_POD_IP):8287
- --config=/etc/tikv-importer/tikv-importer.toml
- --import-dir=/var/lib/tikv-importer
env:
- name: MY_POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: MY_POD_IP
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: status.podIP
- name: TZ
value: {{ .Values.timezone | default "UTC" }}
volumeMounts:
- name: data
mountPath: /var/lib/tikv-importer
- name: config
mountPath: /etc/tikv-importer
{{- if .Values.resources }}
resources:
{{ toYaml .Values.resources | indent 10 }}
{{- end }}
- name: pushgateway
image: {{ .Values.pushgatewayImage }}
imagePullPolicy: {{ .Values.pushgatewayImagePullPolicy | default "IfNotPresent" }}
volumes:
- name: config
configMap:
name: {{ .Values.clusterName }}-importer-{{ template "importer-configmap.data-digest" . }}
items:
- key: config-file
path: tikv-importer.toml
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: {{ .Values.storageClassName }}
resources:
requests:
storage: {{ .Values.storage }}
32 changes: 32 additions & 0 deletions charts/tikv-importer/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Default values for tikv-importer.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

# timezone is the default system timzone for TiDB
timezone: UTC

# clusterName is the TiDB cluster name, if not specified, the chart release name will be used
clusterName: demo

image: pingcap/tidb-lightning:v3.0.8
imagePullPolicy: IfNotPresent
storageClassName: local-storage
storage: 20Gi
resources:
{}
# limits:
# cpu: 16000m
# memory: 8Gi
# requests:
# cpu: 16000m
# memory: 8Gi
affinity: {}
tolerations: []
pushgatewayImage: prom/pushgateway:v0.3.1
pushgatewayImagePullPolicy: IfNotPresent
config: |
log-level = "info"
[metric]
job = "tikv-importer"
interval = "15s"
address = "localhost:9091"