Package InfluxDB 2.7.12 as adoptable Helm chart
This commit is contained in:
commit
1aef84f094
9 files changed
+236
No files matched your search
@@ -0,0 +1,57 @@
|
||||
name: Validate, publish and promote InfluxDB 2 chart
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
jobs:
|
||||
validate:
|
||||
runs-on: linux_amd64
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with: {fetch-depth: 0}
|
||||
- run: ./scripts/test-chart.sh
|
||||
publish:
|
||||
if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/main'
|
||||
needs: validate
|
||||
runs-on: linux_amd64
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with: {fetch-depth: 0}
|
||||
- name: Derive chart version
|
||||
run: echo "CHART_VERSION=$(./scripts/chart-version.sh)" >> "$GITHUB_ENV"
|
||||
- name: Publish public chart
|
||||
env:
|
||||
PACKAGE_USERNAME: ${{ secrets.PACKAGE_USERNAME }}
|
||||
PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
test -n "$PACKAGE_USERNAME" && test -n "$PACKAGE_TOKEN"
|
||||
helm package chart --destination "$RUNNER_TEMP" --version "$CHART_VERSION"
|
||||
curl --fail --silent --show-error --user "$PACKAGE_USERNAME:$PACKAGE_TOKEN" --request POST --upload-file "$RUNNER_TEMP/influxdb2-$CHART_VERSION.tgz" https://code.brunner.ninja/api/packages/feedc0de/helm/api/charts
|
||||
- name: Confirm current main
|
||||
env:
|
||||
COMMIT_SHA: ${{ gitea.sha }}
|
||||
run: |
|
||||
git fetch --no-tags origin main
|
||||
test "$(git rev-parse FETCH_HEAD)" = "$COMMIT_SHA"
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: feedc0de/homelab-gitops
|
||||
ref: main
|
||||
token: ${{ secrets.GITOPS_TOKEN }}
|
||||
path: homelab-gitops
|
||||
- name: Promote exact chart
|
||||
working-directory: homelab-gitops
|
||||
run: |
|
||||
set -euo pipefail
|
||||
./scripts/update-chart-version.sh influxdb2 "$CHART_VERSION"
|
||||
git config user.name feedc0de
|
||||
git config user.email feedc0de@users.noreply.code.brunner.ninja
|
||||
git add bootstrap/influxdb2.yaml
|
||||
if git diff --cached --quiet; then exit 0; fi
|
||||
git commit -m "Deploy influxdb2 chart $CHART_VERSION"
|
||||
for attempt in 1 2 3; do
|
||||
git push origin HEAD:main && exit 0
|
||||
test "$attempt" = 3 && exit 1
|
||||
git fetch origin main
|
||||
git rebase origin/main
|
||||
done
|
||||
@@ -0,0 +1,16 @@
|
||||
# InfluxDB 2 Helm chart
|
||||
|
||||
This chart runs the official InfluxDB 2 image using a pre-existing PVC. It
|
||||
keeps the Deployment and Service names stable during adoption. It does not
|
||||
create or initialize the database, and never deletes the claim.
|
||||
|
||||
```sh
|
||||
helm repo add brunner.ninja https://brunner.ninja/charts
|
||||
helm repo update brunner.ninja
|
||||
helm upgrade --install influxdb2 brunner.ninja/influxdb2 --namespace default \
|
||||
--set persistence.existingClaim=influxdb2-pvc --wait --timeout 10m
|
||||
```
|
||||
|
||||
The homelab instance is reconciled by Argo CD from `homelab-gitops`.
|
||||
The separate `influxdb/` folder was an InfluxDB 3 experiment and is not part
|
||||
of this chart.
|
||||
@@ -0,0 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: influxdb2
|
||||
description: InfluxDB 2 with an existing persistent volume
|
||||
type: application
|
||||
version: 0.0.0
|
||||
appVersion: "2.7.12"
|
||||
@@ -0,0 +1,28 @@
|
||||
{{- if .Values.monitoring.storageAlerts }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: PrometheusRule
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-storage
|
||||
spec:
|
||||
groups:
|
||||
- name: {{ .Release.Name }}.storage
|
||||
rules:
|
||||
- alert: InfluxDBVolumeFillingUp
|
||||
expr: |
|
||||
100 * kubelet_volume_stats_used_bytes{namespace="{{ .Release.Namespace }}", persistentvolumeclaim="{{ .Values.persistence.existingClaim }}"}
|
||||
/ kubelet_volume_stats_capacity_bytes{namespace="{{ .Release.Namespace }}", persistentvolumeclaim="{{ .Values.persistence.existingClaim }}"} > 80
|
||||
for: 30m
|
||||
labels: {severity: warning}
|
||||
annotations:
|
||||
summary: InfluxDB volume is more than 80% full
|
||||
description: Add capacity or shorten bucket retention before compactions run out of working space.
|
||||
- alert: InfluxDBVolumeAlmostFull
|
||||
expr: |
|
||||
100 * kubelet_volume_stats_used_bytes{namespace="{{ .Release.Namespace }}", persistentvolumeclaim="{{ .Values.persistence.existingClaim }}"}
|
||||
/ kubelet_volume_stats_capacity_bytes{namespace="{{ .Release.Namespace }}", persistentvolumeclaim="{{ .Values.persistence.existingClaim }}"} > 90
|
||||
for: 10m
|
||||
labels: {severity: critical}
|
||||
annotations:
|
||||
summary: InfluxDB volume is more than 90% full
|
||||
description: InfluxDB is at risk of WAL and TSM compaction failures.
|
||||
{{- end }}
|
||||
@@ -0,0 +1,95 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ .Release.Name }}
|
||||
spec:
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ .Release.Name }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ .Release.Name }}
|
||||
spec:
|
||||
imagePullSecrets: []
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: influxdb2
|
||||
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 8086
|
||||
startupProbe:
|
||||
httpGet: {path: /health, port: http}
|
||||
failureThreshold: 60
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 3
|
||||
readinessProbe:
|
||||
httpGet: {path: /health, port: http}
|
||||
failureThreshold: 3
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 3
|
||||
livenessProbe:
|
||||
httpGet: {path: /health, port: http}
|
||||
failureThreshold: 6
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 3
|
||||
{{- with .Values.resources }}
|
||||
resources:
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- with .Values.env }}
|
||||
env:
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: influxdb2
|
||||
mountPath: /var/lib/influxdb2
|
||||
volumes:
|
||||
- name: influxdb2
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ required "persistence.existingClaim is required" .Values.persistence.existingClaim }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .Release.Name }}
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app: {{ .Release.Name }}
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
targetPort: 8086
|
||||
{{- if .Values.ingress.enabled }}
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ .Release.Name }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
ingressClassName: {{ .Values.ingress.className }}
|
||||
rules:
|
||||
- host: {{ required "ingress.host is required" .Values.ingress.host }}
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: {{ .Release.Name }}
|
||||
port:
|
||||
name: http
|
||||
{{- end }}
|
||||
@@ -0,0 +1,15 @@
|
||||
image:
|
||||
repository: influxdb
|
||||
tag: "2.7.12"
|
||||
persistence:
|
||||
existingClaim: ""
|
||||
resources: {}
|
||||
affinity: {}
|
||||
env: []
|
||||
ingress:
|
||||
enabled: false
|
||||
host: ""
|
||||
className: ""
|
||||
annotations: {}
|
||||
monitoring:
|
||||
storageAlerts: false
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
helm repo add brunner.ninja https://brunner.ninja/charts --force-update
|
||||
helm repo update brunner.ninja
|
||||
helm upgrade --install influxdb2 brunner.ninja/influxdb2 \
|
||||
--namespace default --set persistence.existingClaim=influxdb2-pvc \
|
||||
--wait --timeout 10m
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
description=$(git describe --tags --long --match 'v[0-9]*' --dirty)
|
||||
case "$description" in *-dirty) echo 'Refusing dirty tree' >&2; exit 1 ;; esac
|
||||
version=${description#v}
|
||||
case "$version" in *-0-g*) version=${version%%-0-g*} ;; esac
|
||||
printf '%s\n' "$version"
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
helm lint chart --set persistence.existingClaim=example-data
|
||||
helm template influxdb2 chart --namespace default --set persistence.existingClaim=example-data --set ingress.enabled=true --set ingress.host=influx.example.test --set monitoring.storageAlerts=true > /dev/null
|
||||
Reference in new issue
Block a user