Skip to content

Commit

Permalink
feat(authelia): metrics (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
james-d-elliott authored Jul 1, 2022
1 parent 0b96d0d commit 889d131
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/authelia/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: authelia
version: 0.8.36
version: 0.8.37
kubeVersion: ">= 1.13.0-0"
description: Authelia is a Single Sign-On Multi-Factor portal for web apps
type: application
Expand Down
6 changes: 6 additions & 0 deletions charts/authelia/templates/configMap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ data:
format: {{ default "text" .Values.configMap.log.format }}
file_path: {{ .Values.configMap.log.file_path | default "" | quote }}
keep_stdout: true
{{- if semverCompare ">=4.36.0" (include "authelia.version" .) }}
telemetry:
metrics:
enabled: {{ .Values.configMap.telemetry.metrics.enabled | default false }}
address: '0.0.0.0:{{ .Values.configMap.telemetry.metrics.port | default 9959 }}'
{{- end }}
totp:
{{- if semverCompare ">=4.34.0" (include "authelia.version" .) }}
disable: {{ .Values.configMap.totp.disable | default false }}
Expand Down
7 changes: 6 additions & 1 deletion charts/authelia/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,13 @@ spec:
{{- end }}
ports:
- name: http
containerPort: {{ default 9091 .Values.configMap.port }}
containerPort: {{ .Values.configMap.port | default 9091 }}
protocol: TCP
{{- if and (semverCompare ">=4.36.0" (include "authelia.version" .)) .Values.configMap.telemetry.metrics.enabled }}
- name: metrics
containerPort: {{ .Values.configMap.telemetry.metrics.port | default 9959 }}
protocol: TCP
{{- end }}
volumeMounts:
{{- if (include "authelia.enabled.persistentVolumeClaim" .) }}
- mountPath: /config
Expand Down
8 changes: 7 additions & 1 deletion charts/authelia/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,10 @@ spec:
- name: http
protocol: TCP
port: {{ include "authelia.service.port" . }}
targetPort: http
targetPort: http
{{- if and (semverCompare ">=4.36.0" (include "authelia.version" .)) .Values.configMap.telemetry.metrics.enabled }}
- name: metrics
protocol: TCP
port: {{ .Values.configMap.telemetry.metrics.port | default 9959 }}
targetPort: metrics
{{- end }}
21 changes: 21 additions & 0 deletions charts/authelia/templates/serviceMonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- if and (semverCompare ">=4.36.0" (include "authelia.version" .)) .Values.configMap.telemetry.metrics.enabled .Values.configMap.telemetry.metrics.serviceMonitor.enabled }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "authelia.name" . }}
labels: {{ include "authelia.labels" (merge (dict "Labels" .Values.configMap.telemetry.metrics.serviceMonitor.labels) .) | nindent 4 }}
{{- with $annotations := include "authelia.annotations" (merge (dict "Annotations" .Values.configMap.telemetry.metrics.serviceMonitor.annotations) .) }}
annotations: {{ $annotations | nindent 4 }}
{{- end }}
spec:
endpoints:
- path: /metrics
port: metrics
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels: {{ include "authelia.labels" (merge (dict "Labels" .Values.service.labels) .) | nindent 6 }}
...
{{- end }}
20 changes: 20 additions & 0 deletions charts/authelia/values.local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,26 @@ configMap:
# file_path: /config/authelia.log
file_path: ""

##
## Telemetry Configuration
##
telemetry:

##
## Metrics Configuration
##
metrics:
## Enable Metrics.
enabled: false

## The port to listen on for metrics. This should be on a different port to the main server.port value.
port: 9959

serviceMonitor:
enabled: false
annotations: {}
labels: {}

## Default redirection URL
##
## If user tries to authenticate without any referer, Authelia does not know where to redirect the user to at the end
Expand Down
20 changes: 20 additions & 0 deletions charts/authelia/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,26 @@ configMap:
# file_path: /config/authelia.log
file_path: ""

##
## Telemetry Configuration
##
telemetry:

##
## Metrics Configuration
##
metrics:
## Enable Metrics.
enabled: false

## The port to listen on for metrics. This should be on a different port to the main server.port value.
port: 9959

serviceMonitor:
enabled: false
annotations: {}
labels: {}

## Default redirection URL
##
## If user tries to authenticate without any referer, Authelia does not know where to redirect the user to at the end
Expand Down

0 comments on commit 889d131

Please sign in to comment.