Commit 24ffe57c authored by David McKay's avatar David McKay

feat: initial Enterprise support

parent 7df6d770
# 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/
apiVersion: v2
version: 0.1.0
appVersion: 1.8.0
engine: gotpl
name: influxdb-enterprise
type: application
description: Run InfluxDB Enterprise on Kubernetes
keywords:
- influxdb
- database
- timeseries
- influxdata
home: https://www.influxdata.com/time-series-platform/influxdb/
sources:
- https://github.com/influxdata/influxdb
maintainers:
- name: rawkode
email: rawkode@influxdata.com
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "influxdb-enterprise.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 "influxdb-enterprise.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 "influxdb-enterprise.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "influxdb-enterprise.labels" -}}
helm.sh/chart: {{ include "influxdb-enterprise.chart" . }}
{{ include "influxdb-enterprise.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "influxdb-enterprise.selectorLabels" -}}
app.kubernetes.io/name: {{ include "influxdb-enterprise.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "influxdb-enterprise.fullname" . }}-data
labels:
app.kubernetes.io/component: data
{{- include "influxdb-enterprise.labels" . | nindent 4 }}
data:
influxdb.conf: |+
bind-address = ":8088"
reporting-disabled = false
[enterprise]
{{ if .Values.license.key }}
# license-key and license-path are mutually exclusive, use only one and leave the other blank
license-key = "{{ .Values.license.key }}" #✨ mutually exclusive with license-path
{{ else }}
# license-key and license-path are mutually exclusive, use only one and leave the other blank
license-path = "/etc/influxdb/license.json"
{{ end }}
[meta]
dir = "/var/lib/influxdb/meta"
[hinted-handoff]
dir = "/var/lib/influxdb/hh"
[data]
dir = "/var/lib/influxdb/data"
wal-dir = "/var/lib/influxdb/wal"
entrypoint.sh: |+
#!/usr/bin/env sh
META_LEADER=$(hostname -f | sed -r 's/-[0-9]+./-0./' | sed -r 's/data/meta/g')
n=0
until [ "$n" -ge 1000 ]
do
curl -XPOST -Faddr=$(hostname -f):8088 http://${META_LEADER}:8091/add-data && break
sleep 2
n=$((n+1))
done
export INFLUXDB_HOSTNAME=$(hostname -f)
exec influxd
apiVersion: v1
kind: Service
metadata:
name: {{ template "influxdb-enterprise.fullname" . }}-data
labels:
influxdb.influxdata.com/component: data
{{- include "influxdb-enterprise.labels" . | nindent 4 }}
spec:
type: ClusterIP
clusterIP: None
publishNotReadyAddresses: true
ports:
- port: 8088
protocol: TCP
name: rpc
- port: 8089
protocol: TCP
name: udp
- port: 8091
protocol: TCP
name: raft
selector:
influxdb.influxdata.com/component: data
{{- include "influxdb-enterprise.selectorLabels" . | nindent 4 }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "influxdb-enterprise.fullname" . }}-data
labels:
{{- include "influxdb-enterprise.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.data.replicas | default 3 }}
podManagementPolicy: Parallel
serviceName: {{ include "influxdb-enterprise.fullname" . }}-data
selector:
matchLabels:
influxdb.influxdata.com/component: data
{{- include "influxdb-enterprise.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.data.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
influxdb.influxdata.com/component: data
{{- include "influxdb-enterprise.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.data.podSecurityContext | nindent 8 }}
volumes:
- name: config
configMap:
name: {{ include "influxdb-enterprise.fullname" . }}-data
containers:
- name: {{ .Chart.Name }}
command:
- "/bin/sh"
args:
- "/etc/influxdb/entrypoint.sh"
securityContext:
{{- toYaml .Values.data.securityContext | nindent 12 }}
image: "{{ .Values.data.image.repository | default "influxdb" }}:{{ .Values.data.image.tag | default (printf "%s-%s" .Chart.AppVersion "data") }}"
imagePullPolicy: {{ .Values.data.image.pullPolicy }}
ports:
- name: http
containerPort: 8088
protocol: TCP
- name: raft
containerPort: 8089
protocol: TCP
livenessProbe:
httpGet:
path: /ping
port: http
readinessProbe:
initialDelaySeconds: 30
httpGet:
path: /status
port: http
volumeMounts:
- name: config
mountPath: /etc/influxdb
- name: {{ include "influxdb-enterprise.fullname" . }}-data-data
mountPath: /var/lib/influxdb
resources:
{{- toYaml .Values.data.resources | nindent 12 }}
{{- with .Values.data.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.data.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.data.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if and .Values.data.persistence.enabled (not .Values.data.persistence.existingClaim) }}
volumeClaimTemplates:
- metadata:
name: {{ include "influxdb-enterprise.fullname" . }}-data-data
annotations:
{{- range $key, $value := .Values.data.persistence.annotations }}
{{ $key }}: "{{ $value }}"
{{- end }}
spec:
accessModes:
- {{ .Values.data.persistence.accessMode | quote}}
resources:
requests:
storage: {{ .Values.data.persistence.size | quote }}
{{- if .Values.data.persistence.storageClass }}
{{- if (eq "-" .Values.data.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.data.persistence.storageClass }}"
{{- end }}
{{- end }}
{{- end }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "influxdb-enterprise.fullname" . }}-meta
labels:
app.kubernetes.io/component: meta
{{- include "influxdb-enterprise.labels" . | nindent 4 }}
data:
influxdb-meta.conf: |+
bind-address = ":8091"
reporting-disabled = false
[enterprise]
{{ if .Values.license.key }}
# license-key and license-path are mutually exclusive, use only one and leave the other blank
license-key = "{{ .Values.license.key }}" #✨ mutually exclusive with license-path
{{ else }}
# license-key and license-path are mutually exclusive, use only one and leave the other blank
license-path = "/etc/influxdb/license.json"
{{ end }}
[meta]
dir = "/var/lib/influxdb/meta"
entrypoint.sh: |+
#!/usr/bin/env sh
set -e
META_LEADER=$(hostname -f | sed -r 's/-[0-9]+./-0./')
if [ $META_LEADER != $(hostname -f) ]; then
influxd-ctl join ${META_LEADER}:8091
else
influxd-ctl add-meta $(hostname -f):8091
fi
apiVersion: v1
kind: Service
metadata:
name: {{ template "influxdb-enterprise.fullname" . }}-meta
labels:
influxdb.influxdata.com/component: meta
influxdb.influxdata.com/role: follower
{{- include "influxdb-enterprise.labels" . | nindent 4 }}
spec:
type: ClusterIP
clusterIP: None
publishNotReadyAddresses: true
ports:
- port: 8089
protocol: TCP
name: raft
- port: 8091
protocol: TCP
name: http
selector:
influxdb.influxdata.com/component: meta
influxdb.influxdata.com/role: follower
{{- include "influxdb-enterprise.selectorLabels" . | nindent 4 }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "influxdb-enterprise.fullname" . }}-meta
labels:
{{- include "influxdb-enterprise.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.meta.replicas | default 3 }}
podManagementPolicy: Parallel
serviceName: {{ include "influxdb-enterprise.fullname" . }}-meta
selector:
matchLabels:
influxdb.influxdata.com/component: meta
influxdb.influxdata.com/role: follower
{{- include "influxdb-enterprise.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.meta.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
influxdb.influxdata.com/component: meta
influxdb.influxdata.com/role: follower
{{- include "influxdb-enterprise.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.meta.podSecurityContext | nindent 8 }}
volumes:
- name: config
configMap:
name: {{ include "influxdb-enterprise.fullname" . }}-meta
containers:
- name: {{ .Chart.Name }}
command:
- "/bin/sh"
args:
- "-c"
- "INFLUXDB_HOSTNAME=$(hostname -f) influxd-meta"
securityContext:
{{- toYaml .Values.meta.securityContext | nindent 12 }}
image: "{{ .Values.meta.image.repository | default "influxdb" }}:{{ .Values.meta.image.tag | default (printf "%s-%s" .Chart.AppVersion "meta") }}"
imagePullPolicy: {{ .Values.meta.image.pullPolicy }}
lifecycle:
postStart:
exec:
command: ["/bin/sh", "/etc/influxdb/entrypoint.sh"]
ports:
- name: http
containerPort: 8091
protocol: TCP
- name: raft
containerPort: 8089
protocol: TCP
livenessProbe:
httpGet:
path: /ping
port: http
readinessProbe:
httpGet:
path: /status
port: http
volumeMounts:
- name: config
mountPath: /etc/influxdb
- name: {{ include "influxdb-enterprise.fullname" . }}-meta-data
mountPath: /var/lib/influxdb
resources:
{{- toYaml .Values.meta.resources | nindent 12 }}
{{- with .Values.meta.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.meta.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.meta.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if and .Values.meta.persistence.enabled (not .Values.meta.persistence.existingClaim) }}
volumeClaimTemplates:
- metadata:
name: {{ include "influxdb-enterprise.fullname" . }}-meta-data
annotations:
{{- range $key, $value := .Values.meta.persistence.annotations }}
{{ $key }}: "{{ $value }}"
{{- end }}
spec:
accessModes:
- {{ .Values.meta.persistence.accessMode | quote}}
resources:
requests:
storage: {{ .Values.meta.persistence.size | quote }}
{{- if .Values.meta.persistence.storageClass }}
{{- if (eq "-" .Values.meta.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.meta.persistence.storageClass }}"
{{- end }}
{{- end }}
{{- end }}
# Default values for influxdb-enterprise.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
nameOverride: "idb"
fullnameOverride: "idb"
imagePullSecrets: []
license:
# You can put your license key here for testing this chart out,
# but we STRONGLY recommend using a license file stored in a secret
# when you ship to production.
key: "31176f98-26ef-4066-9eab-3e05596056d1"
#secret:
#name: secretName
#key: fieldKey
meta:
replicas: 3
image: {}
#override: true
#pullPolicy: IfNotPresent
#repository: influxdb
#tag: "meta"
#nodeSelector: {}
#tolerations: []
#affinity: {}
#podAnnotations: {}
#podSecurityContext: {}
# fsGroup: 2000
#securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
## Persist data to a persistent volume
##
persistence:
enabled: true
## A manually managed Persistent Volume and Claim
## Requires persistence.enabled: true
## If defined, PVC must be created manually before volume will be bound
# existingClaim:
## influxdb data Persistent Volume Storage Class
## If defined, storageClassName: <storageClass>
## If set to "-", storageClassName: "", which disables dynamic provisioning
## If undefined (the default) or set to null, no storageClassName spec is
## set, choosing the default provisioner. (gp2 on AWS, standard on
## GKE, AWS & OpenStack)
##
# storageClass: "-"
# annotations:
accessMode: ReadWriteOnce
size: 8Gi
data:
replicas: 3
image: {}
#override: true
#pullPolicy: IfNotPresent
#repository: influxdb
#tag: "data"
#nodeSelector: {}
#tolerations: []
#affinity: {}
#podAnnotations: {}
#podSecurityContext: {}
# fsGroup: 2000
#securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
## Persist data to a persistent volume
##
persistence:
enabled: true
## A manually managed Persistent Volume and Claim
## Requires persistence.enabled: true
## If defined, PVC must be created manually before volume will be bound
# existingClaim:
## influxdb data Persistent Volume Storage Class
## If defined, storageClassName: <storageClass>
## If set to "-", storageClassName: "", which disables dynamic provisioning
## If undefined (the default) or set to null, no storageClassName spec is
## set, choosing the default provisioner. (gp2 on AWS, standard on
## GKE, AWS & OpenStack)
##
# storageClass: "-"
# annotations:
accessMode: ReadWriteOnce
size: 8Gi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment