Skip to content

Commit 4e6e2f5

Browse files
committed
add helm support for metrics exporter
change fix a few more changes try a fix more fixes add replica count more fixes remove some stuff more changes more changes change change more fixes add helm support for metrics exporter
1 parent 4a2de41 commit 4e6e2f5

File tree

9 files changed

+329
-23
lines changed

9 files changed

+329
-23
lines changed

helm/librechat-exporter/Chart.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
apiVersion: v2
2+
name: librechat-exporter
3+
description: A Prometheus metrics exporter for LibreChat
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.#
9+
# Library charts provide useful utilities or functions for the chart developer. They're included as
10+
# a dependency of application charts to inject those utilities and functions into the rendering
11+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
12+
type: application
13+
14+
# This is the chart version. This version number should be incremented each time you make changes
15+
# to the chart and its templates, including the app version.
16+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
17+
version: 0.1.0
18+
19+
# This is the version number of the application being deployed. This version number should be
20+
# incremented each time you make changes to the application. Versions are not expected to
21+
# follow Semantic Versioning. They should reflect the version the application is using.
22+
# It is recommended to use it with quotes.
23+
24+
# renovate: image=ghcr.io/virtuos/librechat_exporter:main
25+
appVersion: "2.0.6"
26+
27+
home: https://www.librechat.ai
28+
sources:
29+
- https://github.com/virtUOS/librechat_exporter
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
2+
3+
4+
5+
{{/*
6+
Create chart name and version as used by the chart label.
7+
*/}}
8+
{{- define "librechat-exporter.chart" -}}
9+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
10+
{{- end }}
11+
12+
13+
{{/*
14+
Create a default fully qualified app name.
15+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
16+
If release name contains chart name it will be used as a full name.
17+
*/}}
18+
19+
{{- define "librechat-exporter.fullname" -}}
20+
{{- if $.Values.fullnameOverride }}
21+
{{- $.Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
22+
{{- else }}
23+
{{- $name := default .Chart.Name .Values.nameOverride }}
24+
{{- if contains .Release.Name $name }}
25+
{{- $name | trunc 63 | trimSuffix "-" }}
26+
{{- else }}
27+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
28+
{{- end }}
29+
{{- end }}
30+
{{- end }}
31+
32+
{{/*
33+
Common labels
34+
*/}}
35+
{{- define "librechat-exporter.labels" -}}
36+
helm.sh/chart: {{ include "librechat-exporter.chart" . }}
37+
{{ include "librechat-exporter.selectorLabels" . }}
38+
{{- if .Chart.AppVersion }}
39+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
40+
{{- end }}
41+
app.kubernetes.io/managed-by: {{ .Release.Service }}
42+
{{- end }}
43+
44+
45+
{{/*
46+
Exporter selector labels
47+
*/}}
48+
{{- define "librechat-exporter.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "librechat-exporter.fullname" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "librechat-exporter.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "librechat-exporter.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "librechat-exporter.fullname" $ }}
5+
labels:
6+
{{- include "librechat-exporter.labels" . | nindent 4 }}
7+
spec:
8+
replicas: {{ .Values.replicaCount }}
9+
selector:
10+
matchLabels:
11+
{{- include "librechat-exporter.selectorLabels" . | nindent 6 }}
12+
template:
13+
metadata:
14+
{{- with .Values.podAnnotations }}
15+
annotations:
16+
{{- toYaml . | nindent 8 }}
17+
{{- end }}
18+
labels:
19+
{{- include "librechat-exporter.labels" . | nindent 8 }}
20+
{{- with .Values.podLabels }}
21+
{{- toYaml . | nindent 8 }}
22+
{{- end }}
23+
spec:
24+
{{- with .Values.imagePullSecrets }}
25+
imagePullSecrets:
26+
{{- toYaml . | nindent 8 }}
27+
{{- end }}
28+
{{- with .Values.podSecurityContext }}
29+
securityContext:
30+
{{- toYaml . | nindent 8 }}
31+
{{- end }}
32+
containers:
33+
- name: {{ include "librechat-exporter.fullname" $ }}
34+
{{- with .Values.securityContext }}
35+
securityContext:
36+
{{- toYaml . | nindent 12 }}
37+
{{- end }}
38+
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
39+
imagePullPolicy: {{ .Values.image.pullPolicy }}
40+
{{- with .Values.env }}
41+
env:
42+
{{- toYaml . | nindent 12 }}
43+
{{- end }}
44+
ports:
45+
- name: http
46+
containerPort: {{ .Values.service.port }}
47+
protocol: TCP
48+
{{- with .Values.livenessProbe }}
49+
livenessProbe:
50+
{{- toYaml . | nindent 12 }}
51+
{{- end }}
52+
{{- with .Values.readinessProbe }}
53+
readinessProbe:
54+
{{- toYaml . | nindent 12 }}
55+
{{- end }}
56+
{{- with .Values.resources }}
57+
resources:
58+
{{- toYaml . | nindent 12 }}
59+
{{- end }}
60+
{{- with .Values.volumeMounts }}
61+
volumeMounts:
62+
{{- toYaml . | nindent 12 }}
63+
{{- end }}
64+
{{- with .Values.extraContainers }}
65+
{{ toYaml . | nindent 12 }}
66+
{{- end }}
67+
68+
{{- with .Values.volumes }}
69+
volumes:
70+
{{- toYaml . | nindent 8 }}
71+
{{- end }}
72+
{{- with .Values.nodeSelector }}
73+
nodeSelector:
74+
{{- toYaml . | nindent 8 }}
75+
{{- end }}
76+
{{- with .Values.affinity }}
77+
affinity:
78+
{{- toYaml . | nindent 8 }}
79+
{{- end }}
80+
{{- with .Values.tolerations }}
81+
tolerations:
82+
{{- toYaml . | nindent 8 }}
83+
{{- end }}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "librechat-exporter.fullname" . }}
5+
labels:
6+
{{- include "librechat-exporter.labels" . | nindent 4 }}
7+
annotations:
8+
{{- toYaml .Values.service.annotations | nindent 4 }}
9+
spec:
10+
type: {{ .Values.service.type }}
11+
ports:
12+
- port: {{ .Values.service.port }}
13+
targetPort: http
14+
protocol: TCP
15+
name: http
16+
selector:
17+
{{- include "librechat-exporter.selectorLabels" . | nindent 4 }}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{{- if .Values.serviceMonitor.enabled }}
2+
apiVersion: monitoring.coreos.com/v1
3+
kind: ServiceMonitor
4+
metadata:
5+
name: {{ include "librechat-exporter.fullname" . }}
6+
labels:
7+
{{- include "librechat-exporter.labels" . | nindent 4 }}
8+
{{- with .Values.serviceMonitor.labels }}
9+
{{- toYaml . | nindent 4 }}
10+
{{- end }}
11+
spec:
12+
endpoints:
13+
- interval: {{ .Values.serviceMonitor.interval }}
14+
path: /metrics
15+
port: http
16+
scheme: http
17+
scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }}
18+
selector:
19+
matchLabels:
20+
{{- include "librechat-exporter.selectorLabels" . | nindent 6 }}
21+
{{- end }}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
enabled: false
2+
3+
replicaCount: 1
4+
5+
image:
6+
repository: virtuos/librechat_exporter
7+
registry: ghcr.io
8+
pullPolicy: IfNotPresent
9+
# Overrides the image tag whose default is the chart appVersion.
10+
tag: main
11+
12+
env: []
13+
# - name: MONGODB_URI
14+
# value: "mongodb://mongodb:27017/"
15+
# - name: LOGGING_LEVEL
16+
# value: "info"
17+
18+
imagePullSecrets: []
19+
nameOverride: ""
20+
fullnameOverride: ""
21+
22+
podAnnotations: {}
23+
podLabels: {}
24+
25+
podSecurityContext:
26+
fsGroup: 2000
27+
28+
securityContext:
29+
capabilities:
30+
drop:
31+
- ALL
32+
# readOnlyRootFilesystem: true # not supported yet
33+
runAsNonRoot: true
34+
runAsUser: 1000
35+
36+
service:
37+
type: ClusterIP
38+
port: 8000
39+
annotations: {}
40+
41+
resources: {}
42+
# We usually recommend not to specify default resources and to leave this as a conscious
43+
# choice for the user. This also increases chances charts run on environments with little
44+
# resources, such as Minikube. If you do want to specify resources, uncomment the following
45+
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
46+
# limits:
47+
# cpu: 100m
48+
# memory: 128Mi
49+
# requests:
50+
# cpu: 100m
51+
# memory: 128Mi
52+
53+
livenessProbe:
54+
httpGet:
55+
path: /
56+
port: http
57+
readinessProbe:
58+
httpGet:
59+
path: /
60+
port: http
61+
62+
# Additional volumes on the output Deployment definition.
63+
volumes: []
64+
# - name: foo
65+
# secret:
66+
# secretName: mysecret
67+
# optional: false
68+
69+
# Additional volumeMounts on the output Deployment definition.
70+
volumeMounts: []
71+
# - name: foo
72+
# mountPath: "/etc/foo"
73+
# readOnly: true
74+
75+
nodeSelector: {}
76+
77+
tolerations: []
78+
79+
affinity: {}
80+
81+
extraContainers: {}
82+
83+
serviceMonitor:
84+
enabled: false
85+
interval: 30s
86+
scrapeTimeout: 30s
87+
labels: []

helm/librechat/Chart.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,7 @@ dependencies:
4040
version: "0.5.2"
4141
condition: librechat-rag-api.enabled
4242
repository: file://../librechat-rag-api
43+
- name: librechat-exporter
44+
version: "0.1.0"
45+
condition: librechat-exporter.enabled
46+
repository: file://../librechat-exporter

helm/librechat/templates/_helpers.tpl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ app.kubernetes.io/name: {{ include "librechat.fullname" . }}-rag
5353
app.kubernetes.io/instance: {{ .Release.Name }}
5454
{{- end }}
5555

56+
{{/*
57+
Exporter selector labels
58+
*/}}
59+
{{- define "librechat-exporter.selectorLabels" -}}
60+
app.kubernetes.io/name: {{ include "librechat-exporter.fullname" . }}
61+
app.kubernetes.io/instance: {{ .Release.Name }}
62+
{{- end }}
63+
5664
{{/*
5765
Create the name of the service account to use
5866
*/}}

0 commit comments

Comments
 (0)