From ee22a676cadb2206c1088834f3d13e4ac27f0822 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Colombaro?= Date: Mon, 9 Sep 2024 17:32:50 +0000 Subject: [PATCH] Creat appropriate vhost for httpd metrics Fixes #276 --- charts/yourls/Chart.yaml | 2 +- charts/yourls/files/00_status-vhost.conf | 7 +++++++ charts/yourls/templates/deployment.yaml | 11 +++++++++++ .../yourls/templates/metrics-httpd-configmap.yaml | 14 ++++++++++++++ charts/yourls/values.yaml | 3 +++ 5 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 charts/yourls/files/00_status-vhost.conf create mode 100644 charts/yourls/templates/metrics-httpd-configmap.yaml diff --git a/charts/yourls/Chart.yaml b/charts/yourls/Chart.yaml index 156054d..c3a4402 100644 --- a/charts/yourls/Chart.yaml +++ b/charts/yourls/Chart.yaml @@ -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" diff --git a/charts/yourls/files/00_status-vhost.conf b/charts/yourls/files/00_status-vhost.conf new file mode 100644 index 0000000..c0838da --- /dev/null +++ b/charts/yourls/files/00_status-vhost.conf @@ -0,0 +1,7 @@ + + ServerName status.localhost + + Require local + SetHandler server-status + + diff --git a/charts/yourls/templates/deployment.yaml b/charts/yourls/templates/deployment.yaml index 823cb59..6541910 100644 --- a/charts/yourls/templates/deployment.yaml +++ b/charts/yourls/templates/deployment.yaml @@ -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 }} @@ -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: diff --git a/charts/yourls/templates/metrics-httpd-configmap.yaml b/charts/yourls/templates/metrics-httpd-configmap.yaml new file mode 100644 index 0000000..c69b8ad --- /dev/null +++ b/charts/yourls/templates/metrics-httpd-configmap.yaml @@ -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 }} diff --git a/charts/yourls/values.yaml b/charts/yourls/values.yaml index 4b8957e..ed70b61 100644 --- a/charts/yourls/values.yaml +++ b/charts/yourls/values.yaml @@ -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