diff --git a/README.md b/README.md index ad5c809d..5b5eb18b 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ helm repo add appuio https://charts.appuio.ch | [![chart downloads](https://img.shields.io/github/downloads/appuio/charts/data-cube-curation-0.3.1/total)](https://github.com/appuio/charts/releases/tag/data-cube-curation-0.3.1) | [data-cube-curation](appuio/data-cube-curation/README.md) | | [![chart downloads](https://img.shields.io/github/downloads/appuio/charts/exoip-1.0.4/total)](https://github.com/appuio/charts/releases/tag/exoip-1.0.4) | [exoip](appuio/exoip/README.md) | | [![chart downloads](https://img.shields.io/github/downloads/appuio/charts/generic-0.1.2/total)](https://github.com/appuio/charts/releases/tag/generic-0.1.2) | [generic](appuio/generic/README.md) | -| [![chart downloads](https://img.shields.io/github/downloads/appuio/charts/haproxy-2.1.0/total)](https://github.com/appuio/charts/releases/tag/haproxy-2.1.0) | [haproxy](appuio/haproxy/README.md) | +| [![chart downloads](https://img.shields.io/github/downloads/appuio/charts/haproxy-2.2.0/total)](https://github.com/appuio/charts/releases/tag/haproxy-2.2.0) | [haproxy](appuio/haproxy/README.md) | | [![chart downloads](https://img.shields.io/github/downloads/appuio/charts/mariadb-galera-1.2.4/total)](https://github.com/appuio/charts/releases/tag/mariadb-galera-1.2.4) | [mariadb-galera](appuio/mariadb-galera/README.md) | | [![chart downloads](https://img.shields.io/github/downloads/appuio/charts/maxscale-1.1.2/total)](https://github.com/appuio/charts/releases/tag/maxscale-1.1.2) | [maxscale](appuio/maxscale/README.md) | | [![chart downloads](https://img.shields.io/github/downloads/appuio/charts/metrics-server-2.12.1/total)](https://github.com/appuio/charts/releases/tag/metrics-server-2.12.1) | [metrics-server](appuio/metrics-server/README.md) | diff --git a/appuio/haproxy/Chart.yaml b/appuio/haproxy/Chart.yaml index 1684f5b8..f7b18eea 100644 --- a/appuio/haproxy/Chart.yaml +++ b/appuio/haproxy/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v1 appVersion: 2.6.1 description: A Helm chart for HAProxy which can be customized by a config map. name: haproxy -version: 2.1.0 +version: 2.2.0 maintainers: - name: APPUiO Team email: info@appuio.ch diff --git a/appuio/haproxy/README.gotmpl.md b/appuio/haproxy/README.gotmpl.md index 105ba236..90fcfd91 100644 --- a/appuio/haproxy/README.gotmpl.md +++ b/appuio/haproxy/README.gotmpl.md @@ -134,17 +134,37 @@ Set `haproxy.config` to `redisk8s` to use the Redis configuration with DNS servi | `haproxy.redisk8s.metrics.enabled`| If the metric endpoint of the Redis backends should be exposed in haproxy | `false` | `haproxy.redisk8s.metrics.exposeLoadbalancer`| If the metric endpoint of the Redis backends should be exposed in the haproxy service | `true` +### filterproxy + +| Parameter | Description | Default +|--- | --- | --- +| `haproxy.filterproxy.enabled` | Enables exposing an [exporter-filterproxy](https://github.com/vshn/exporter-filterproxy) that will be filtered based on the namespace | `false` +| `haproxy.filterproxy.url` | The URL of the exporter-filterproxy to expose | `""` ## Galera and Redis metrics By setting the `haproxy.galerak8s.metrics.enabled` or `haproxy.redisk8s.metrics.enabled` parameters, you can expose the metrics of the backend pods. -For Galera the endpoints are: -* `:9090/metrics/mariadb-0/metrics` -* `:9090/metrics/mariadb-1/metrics` +For Galera the endpoints are either: +* `:9090/mariadb/0` +* `:9090/mariadb/1` * `...` -For Redis the endpoints are: -* `:9090/metrics/redis-0/metrics` -* `:9090/metrics/redis-1/metrics` +Or: +* `mariadb-0.example.com:9090/metrics` +* `mariadb-1.example.com:9090/metrics` * `...` + +When `mariadb-.example.com` resolves to the haproxy service IP. + +For Redis the endpoints are either: +* `:9090/redis/0` +* `:9090/redis/1` +* `...` + +Or: +* `redis-0.example.com:9090/metrics` +* `redis-1.example.com:9090/metrics` +* `...` + +When `redis-.example.com` resolves to the haproxy service IP. diff --git a/appuio/haproxy/README.md b/appuio/haproxy/README.md index 642c7b71..a55e4479 100644 --- a/appuio/haproxy/README.md +++ b/appuio/haproxy/README.md @@ -1,6 +1,6 @@ # haproxy -![Version: 2.1.0](https://img.shields.io/badge/Version-2.1.0-informational?style=flat-square) ![AppVersion: 2.6.1](https://img.shields.io/badge/AppVersion-2.6.1-informational?style=flat-square) +![Version: 2.2.0](https://img.shields.io/badge/Version-2.2.0-informational?style=flat-square) ![AppVersion: 2.6.1](https://img.shields.io/badge/AppVersion-2.6.1-informational?style=flat-square) A Helm chart for HAProxy which can be customized by a config map. @@ -144,20 +144,41 @@ Set `haproxy.config` to `redisk8s` to use the Redis configuration with DNS servi | `haproxy.redisk8s.metrics.enabled`| If the metric endpoint of the Redis backends should be exposed in haproxy | `false` | `haproxy.redisk8s.metrics.exposeLoadbalancer`| If the metric endpoint of the Redis backends should be exposed in the haproxy service | `true` +### filterproxy + +| Parameter | Description | Default +|--- | --- | --- +| `haproxy.filterproxy.enabled` | Enables exposing an [exporter-filterproxy](https://github.com/vshn/exporter-filterproxy) that will be filtered based on the namespace | `false` +| `haproxy.filterproxy.url` | The URL of the exporter-filterproxy to expose | `""` + ## Galera and Redis metrics By setting the `haproxy.galerak8s.metrics.enabled` or `haproxy.redisk8s.metrics.enabled` parameters, you can expose the metrics of the backend pods. -For Galera the endpoints are: -* `:9090/metrics/mariadb-0/metrics` -* `:9090/metrics/mariadb-1/metrics` +For Galera the endpoints are either: +* `:9090/mariadb/0` +* `:9090/mariadb/1` +* `...` + +Or: +* `mariadb-0.example.com:9090/metrics` +* `mariadb-1.example.com:9090/metrics` * `...` -For Redis the endpoints are: -* `:9090/metrics/redis-0/metrics` -* `:9090/metrics/redis-1/metrics` +When `mariadb-.example.com` resolves to the haproxy service IP. + +For Redis the endpoints are either: +* `:9090/redis/0` +* `:9090/redis/1` * `...` +Or: +* `redis-0.example.com:9090/metrics` +* `redis-1.example.com:9090/metrics` +* `...` + +When `redis-.example.com` resolves to the haproxy service IP. + diff --git a/appuio/haproxy/templates/_helpers.tpl b/appuio/haproxy/templates/_helpers.tpl index e60cc234..ba9a36c6 100644 --- a/appuio/haproxy/templates/_helpers.tpl +++ b/appuio/haproxy/templates/_helpers.tpl @@ -97,6 +97,12 @@ frontend galeraMetrics {{- range $i, $e := until (.Values.haproxy.galerak8s.nodeCount |int) }} use_backend galera-node-{{$i}} if { hdr_sub(host) -i mariadb-{{$i}} } {{- end }} + {{- range $i, $e := until (.Values.haproxy.galerak8s.nodeCount |int) }} + use_backend galera-node-metrics-{{$i}} if { path_beg /mariadb/{{$i}} } + {{- end }} + {{- if .Values.haproxy.filterproxy.enabled }} + use_backend filterproxy + {{- end }} {{- $namespace := .Release.Namespace -}} {{ range $i, $e := until (.Values.haproxy.galerak8s.nodeCount |int) }} @@ -104,6 +110,18 @@ backend galera-node-{{$i}} mode http server node-{{$i}} mariadb-{{$i}}.mariadb.{{ $namespace }}.svc.cluster.local:9104 init-addr none check resolvers mydns {{- end }} +{{ range $i, $e := until (.Values.haproxy.galerak8s.nodeCount |int) }} +backend galera-node-metrics-{{$i}} + mode http + http-request set-path /metrics + server node-{{$i}} mariadb-{{$i}}.mariadb.{{ $namespace }}.svc.cluster.local:9104 init-addr none check resolvers mydns +{{- end }} +{{- if .Values.haproxy.filterproxy.enabled }} +backend filterproxy + mode http + http-request set-query namespace={{ $namespace }} + server filter {{ .Values.haproxy.filterproxy.url }} +{{- end }} {{- end }} {{- end -}} @@ -119,6 +137,12 @@ frontend redisMetrics {{- range $i, $e := until (.Values.haproxy.redisk8s.nodeCount |int) }} use_backend redis-node-{{$i}} if { hdr_sub(host) -i redis-{{$i}} } {{- end }} + {{- range $i, $e := until (.Values.haproxy.redisk8s.nodeCount |int) }} + use_backend redis-node-metrics-{{$i}} if { path_beg /redis/{{$i}} } + {{- end }} + {{- if .Values.haproxy.filterproxy.enabled }} + use_backend filterproxy + {{- end }} {{- $namespace := .Release.Namespace -}} {{ range $i, $e := until (.Values.haproxy.redisk8s.nodeCount |int) }} @@ -126,5 +150,17 @@ backend redis-node-{{$i}} mode http server node-{{$i}} redis-node-{{$i}}.redis-headless.{{ $namespace }}.svc.cluster.local:9121 init-addr none check resolvers mydns {{- end }} +{{ range $i, $e := until (.Values.haproxy.galerak8s.nodeCount |int) }} +backend redis-node-metrics-{{$i}} + mode http + http-request set-path /metrics + server node-{{$i}} redis-node-{{$i}}.redis-headless.{{ $namespace }}.svc.cluster.local:9121 init-addr none check resolvers mydns +{{- end }} +{{- if .Values.haproxy.filterproxy.enabled }} +backend filterproxy + mode http + http-request set-query namespace={{ $namespace }} + server filter {{ .Values.haproxy.filterproxy.url }} +{{- end }} {{- end }} {{- end -}} diff --git a/appuio/haproxy/values.yaml b/appuio/haproxy/values.yaml index 73afb784..d6881c37 100644 --- a/appuio/haproxy/values.yaml +++ b/appuio/haproxy/values.yaml @@ -106,6 +106,12 @@ haproxy: enabled: false exposeLoadbalancer: true + filterproxy: + # Enables exposing an [exporter-filterproxy](https://github.com/vshn/exporter-filterproxy) that will be filtered using the namspace + enabled: false + # The URL of the exporter-filterproxy to expose + url: "" + metrics: enabled: true