Skip to content

Commit

Permalink
Creat appropriate vhost for httpd metrics
Browse files Browse the repository at this point in the history
Fixes #276
  • Loading branch information
LeoColomb authored Sep 9, 2024
1 parent b0aabcd commit ee22a67
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/yourls/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
version: 6.0.0
version: 6.1.0
name: yourls
description: Your Own URL Shortener
appVersion: "1.9.2"
Expand Down
7 changes: 7 additions & 0 deletions charts/yourls/files/00_status-vhost.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<VirtualHost 127.0.0.1:80>
ServerName status.localhost
<Location /server-status>
Require local
SetHandler server-status
</Location>
</VirtualHost>
11 changes: 11 additions & 0 deletions charts/yourls/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ spec:
- mountPath: /docker-entrypoint-init.d
name: custom-postinit
{{- end }}
{{- if and .Values.metrics.enabled .Values.metrics.apacheVhost }}
- name: apache-metrics
mountPath: /etc/apache2/sites-enabled/00_status-vhost.conf
subPath: 00_status-vhost.conf
{{- end }}
{{- if .Values.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
Expand Down Expand Up @@ -275,6 +280,12 @@ spec:
name: {{ printf "%s-postinit" (include "common.names.fullname" .) }}
defaultMode: 0755
{{- end }}
{{- if and .Values.metrics.enabled .Values.metrics.apacheVhost }}
- name: apache-metrics
configMap:
name: {{ printf "%s-apache-metrics" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}
defaultMode: 0644
{{- end }}
- name: yourls-data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
Expand Down
14 changes: 14 additions & 0 deletions charts/yourls/templates/metrics-httpd-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- if and .Values.metrics.enabled .Values.metrics.apacheVhost }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-apache-metrics" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
data:
00_status-vhost.conf: |-
{{- .Files.Get "files/00_status-vhost.conf" | nindent 4 }}
{{- end }}
3 changes: 3 additions & 0 deletions charts/yourls/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,9 @@ metrics:
## @param metrics.enabled Start a sidecar prometheus exporter to expose metrics
##
enabled: false
## @param metrics.apacheVhost Create a virtual host to enable Apache httpd to serve metrics
##
apacheVhost: true
## Bitnami Apache Exporter image
## ref: https://hub.docker.com/r/bitnami/apache-exporter/tags/
## @param metrics.image.registry Apache Exporter image registry
Expand Down

0 comments on commit ee22a67

Please sign in to comment.