Skip to content

Commit

Permalink
add influxdb addon
Browse files Browse the repository at this point in the history
  • Loading branch information
lingdie committed Dec 5, 2023
1 parent a11f35e commit 8ae9695
Show file tree
Hide file tree
Showing 6 changed files with 230 additions and 0 deletions.
23 changes: 23 additions & 0 deletions addons/influxdb/.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/
24 changes: 24 additions & 0 deletions addons/influxdb/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: influxdb
type: application

version: 0.7.0

appVersion: 2.7.4

annotations:
category: Database
licenses: Apache-2.0
addon.kubeblocks.io/kubeblocks-version: ">=0.7.0"
addon.kubeblocks.io/model: "time-series"

description: InfluxDB(TM) is an open source time-series database. It is a core component of the TICK (Telegraf, InfluxDB(TM), Chronograf, Kapacitor) stack.

home: https://bitnami.com
icon: https://bitnami.com/assets/stacks/influxdb/img/influxdb-stack-220x234.png

keywords:
- influxdb
- tick
- database
- timeseries
33 changes: 33 additions & 0 deletions addons/influxdb/templates/__helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "influxdb.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Common labels
*/}}
{{- define "influxdb.labels" -}}
helm.sh/chart: {{ include "influxdb.chart" . }}
{{ include "influxdb.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
123 changes: 123 additions & 0 deletions addons/influxdb/templates/clusterdefinition.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: ClusterDefinition
metadata:
name: influxdb
labels:
{{- include "influxdb.labels" . | nindent 4 }}
spec:
connectionCredential:
admin-user: "admin"
admin-user-password: "$(RANDOM_PASSWD)"
admin-user-token: "$(RANDOM_PASSWD)"
http-endpoint: "$(SVC_FQDN):$(SVC_PORT_http)"
http-port: "$(SVC_PORT_http)"
rpc-endpoint: "$(SVC_FQDN):$(SVC_PORT_rpc)"
rpc-port: "$(SVC_PORT_rpc)"
host: "$(SVC_FQDN)"
componentDefs:
- name: influxdb
characterType: influxdb
workloadType: Stateful
service:
ports:
- name: http
port: 8086
targetPort: http
- name: rpc
port: 8088
targetPort: rpc
podSpec:
containers:
- name: influxdb
image: docker.io/bitnami/influxdb:2.7.4-debian-11-r0
imagePullPolicy: "IfNotPresent"
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
privileged: false
readOnlyRootFilesystem: false
runAsNonRoot: true
runAsUser: 1001
seccompProfile:
type: RuntimeDefault
env:
- name: BITNAMI_DEBUG
value: "false"
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: INFLUXDB_HTTP_AUTH_ENABLED
value: "true"
- name: INFLUXDB_CREATE_USER_TOKEN
value: "no"
- name: INFLUXDB_ADMIN_USER
valueFrom:
secretKeyRef:
name: $(CONN_CREDENTIAL_SECRET_NAME)
key: admin-user
- name: INFLUXDB_ADMIN_USER_PASSWORD
valueFrom:
secretKeyRef:
name: $(CONN_CREDENTIAL_SECRET_NAME)
key: admin-user-password
- name: INFLUXDB_ADMIN_USER_TOKEN
valueFrom:
secretKeyRef:
name: $(CONN_CREDENTIAL_SECRET_NAME)
key: admin-user-token
- name: INFLUXDB_ADMIN_BUCKET
value: "primary"
- name: INFLUXDB_ADMIN_ORG
value: "primary"
ports:
- name: http
containerPort: 8086
protocol: TCP
- name: rpc
containerPort: 8088
protocol: TCP
livenessProbe:
failureThreshold: 6
initialDelaySeconds: 180
periodSeconds: 45
successThreshold: 1
timeoutSeconds: 30
exec:
command:
- bash
- -c
- |
. /opt/bitnami/scripts/libinfluxdb.sh
influxdb_env
export INFLUX_USERNAME="$INFLUXDB_ADMIN_USER"
export INFLUX_PASSWORD="$INFLUXDB_ADMIN_USER_PASSWORD"
timeout 29s influx ping --host http://$POD_IP:8086
readinessProbe:
failureThreshold: 6
initialDelaySeconds: 60
periodSeconds: 45
successThreshold: 1
timeoutSeconds: 30
exec:
command:
- bash
- -c
- |
. /opt/bitnami/scripts/libinfluxdb.sh
influxdb_env
export INFLUX_USERNAME="$INFLUXDB_ADMIN_USER"
export INFLUX_PASSWORD="$INFLUXDB_ADMIN_USER_PASSWORD"
timeout 29s influx ping --host http://$POD_IP:8086
resources:
limits: {}
requests: {}
volumeMounts:
- name: data
mountPath: /bitnami/influxdb
15 changes: 15 additions & 0 deletions addons/influxdb/templates/clusterversion.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: ClusterVersion
metadata:
name: influxdb-{{ default .Chart.AppVersion .Values.clusterVersionOverride }}
labels:
{{- include "influxdb.labels" . | nindent 4 }}
spec:
clusterDefinitionRef: influxdb
componentVersions:
- componentDefRef: influxdb
versionsContext:
containers:
- name: influxdb
image: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}
imagePullPolicy: {{ default .Values.image.pullPolicy "IfNotPresent" }}
12 changes: 12 additions & 0 deletions addons/influxdb/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Default values for mysql.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
image:
registry: docker.io
repository: bitnami/influxdb
pullPolicy: IfNotPresent
tag: 2.7.4-debian-11-r0

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

0 comments on commit 8ae9695

Please sign in to comment.