Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

[stable/prometheus-operator] Allow option to create additional Ingress for health endpoints #23450

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stable/prometheus-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ sources:
- https://github.com/coreos/kube-prometheus
- https://github.com/coreos/prometheus-operator
- https://coreos.com/operators/prometheus
version: 9.3.1
version: 9.3.2
appVersion: 0.38.1
tillerVersion: ">=2.12.0"
home: https://github.com/coreos/prometheus-operator
Expand Down
11 changes: 9 additions & 2 deletions stable/prometheus-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ The following tables list the configurable parameters of the prometheus-operator
| `prometheus.additionalServiceMonitors` | List of `ServiceMonitor` objects to create. See https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#servicemonitorspec | `[]` |
| `prometheus.enabled` | Deploy prometheus | `true` |
| `prometheus.annotations` | Prometheus annotations | `{}` |
| `prometheus.healthIngress.annotations` | Prometheus Health Ingress annotations | `{}` |
| `prometheus.healthIngress.enabled` | If true, an additional Ingress for monitoring Prometheus health will be created | `false` |
| `prometheus.healthIngress.labels` | Prometheus Health Ingress additional labels | `{}` |
| `prometheus.ingressPerReplica.hostPrefix` | | `""` |
| `prometheus.ingress.annotations` | Prometheus Ingress annotations | `{}` |
| `prometheus.ingress.enabled` | If true, Prometheus Ingress will be created | `false` |
| `prometheus.ingress.hosts` | Prometheus Ingress hostnames | `[]` |
Expand Down Expand Up @@ -381,8 +385,8 @@ The following tables list the configurable parameters of the prometheus-operator
| `prometheus.thanosIngress.paths` | Ingress paths for Thanos Sidecar | `[]` |
| `prometheus.thanosIngress.annotations` | Ingress annotations for Thanos Sidecar | `{}` |
| `prometheus.thanosIngress.labels` | Ingress labels for Thanos Sidecar | `{}` |
| `prometheus.thanosIngress.hosts | Ingress hosts for Thanos Sidecar | `[]` |
| `prometheus.thanosIngress.tls | Ingress tls for Thanos Sidecar | `[]` |
| `prometheus.thanosIngress.hosts` | Ingress hosts for Thanos Sidecar | `[]` |
| `prometheus.thanosIngress.tls` | Ingress tls for Thanos Sidecar | `[]` |

### Alertmanager
| Parameter | Description | Default |
Expand Down Expand Up @@ -419,6 +423,9 @@ The following tables list the configurable parameters of the prometheus-operator
| `alertmanager.apiVersion` | Api that prometheus will use to communicate with alertmanager. Possible values are v1, v2 | `v2` |
| `alertmanager.config` | Provide YAML to configure Alertmanager. See https://prometheus.io/docs/alerting/configuration/#configuration-file. The default provided works to suppress the Watchdog alert from `defaultRules.create` | `{"global":{"resolve_timeout":"5m"},"route":{"group_by":["job"],"group_wait":"30s","group_interval":"5m","repeat_interval":"12h","receiver":"null","routes":[{"match":{"alertname":"Watchdog"},"receiver":"null"}]},"receivers":[{"name":"null"}]}` |
| `alertmanager.enabled` | Deploy alertmanager | `true` |
| `alertmanager.healthIngress.annotations` | Alertmanager Health Ingress annotations | `{}` |
| `alertmanager.healthIngress.enabled` | If true, an additional Ingress for monitoring Alertmanager health will be created | `false` |
| `alertmanager.healthIngress.labels` | Alertmanager Health Ingress additional labels | `{}` |
| `alertmanager.ingress.annotations` | Alertmanager Ingress annotations | `{}` |
| `alertmanager.ingress.enabled` | If true, Alertmanager Ingress will be created | `false` |
| `alertmanager.ingress.hosts` | Alertmanager Ingress hostnames | `[]` |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{{- if and .Values.alertmanager.enabled .Values.alertmanager.healthIngress.enabled }}
{{- $serviceName := printf "%s-%s" (include "prometheus-operator.fullname" .) "alertmanager" }}
{{- $servicePort := .Values.alertmanager.service.port -}}
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" }}
apiVersion: networking.k8s.io/v1beta1
{{ else }}
apiVersion: extensions/v1beta1
{{ end -}}
kind: Ingress
metadata:
name: {{ $serviceName }}-health
namespace: {{ template "prometheus-operator.namespace" . }}
{{- if .Values.alertmanager.healthIngress.annotations }}
annotations:
{{ toYaml .Values.alertmanager.healthIngress.annotations | indent 4 }}
{{- end }}
labels:
app: {{ template "prometheus-operator.name" . }}-alertmanager
{{- if .Values.alertmanager.healthIngress.labels }}
{{ toYaml .Values.alertmanager.healthIngress.labels | indent 4 }}
{{- end }}
{{ include "prometheus-operator.labels" . | indent 4 }}
spec:
rules:
{{- if .Values.alertmanager.ingress.hosts }}
{{- range $host := .Values.alertmanager.ingress.hosts }}
- host: {{ tpl $host $ }}
http:
paths:
- path: /-/ready
backend:
serviceName: {{ $serviceName }}
servicePort: {{ $servicePort }}
{{- end -}}
{{- else }}
- http:
paths:
- path: /-/ready
backend:
serviceName: {{ $serviceName }}
servicePort: {{ $servicePort }}
{{- end -}}
{{- if .Values.alertmanager.ingress.tls }}
tls:
{{ toYaml .Values.alertmanager.ingress.tls | indent 4 }}
{{- end -}}
{{- end -}}
47 changes: 47 additions & 0 deletions stable/prometheus-operator/templates/prometheus/ingressHealth.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{{- if and .Values.prometheus.enabled .Values.prometheus.healthIngress.enabled }}
{{- $serviceName := printf "%s-%s" (include "prometheus-operator.fullname" .) "prometheus" }}
{{- $servicePort := .Values.prometheus.service.port -}}
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" }}
apiVersion: networking.k8s.io/v1beta1
{{ else }}
apiVersion: extensions/v1beta1
{{ end -}}
kind: Ingress
metadata:
{{- if .Values.prometheus.healthIngress.annotations }}
annotations:
{{ toYaml .Values.prometheus.healthIngress.annotations | indent 4 }}
{{- end }}
name: {{ $serviceName }}-health
namespace: {{ template "prometheus-operator.namespace" . }}
labels:
app: {{ template "prometheus-operator.name" . }}-prometheus
{{ include "prometheus-operator.labels" . | indent 4 }}
{{- if .Values.prometheus.healthIngress.labels }}
{{ toYaml .Values.prometheus.healthIngress.labels | indent 4 }}
{{- end }}
spec:
rules:
{{- if .Values.prometheus.ingress.hosts }}
{{- range $host := .Values.prometheus.ingress.hosts }}
- host: {{ tpl $host $ }}
http:
paths:
- path: /-/ready
backend:
serviceName: {{ $serviceName }}
servicePort: {{ $servicePort }}
{{- end -}}
{{- else }}
- http:
paths:
- path: /-/ready
backend:
serviceName: {{ $serviceName }}
servicePort: {{ $servicePort }}
{{- end -}}
{{- if .Values.prometheus.ingress.tls }}
tls:
{{ toYaml .Values.prometheus.ingress.tls | indent 4 }}
{{- end -}}
{{- end -}}
22 changes: 19 additions & 3 deletions stable/prometheus-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,12 @@ alertmanager:
# {{ end }}
# {{ end }}

## Configure an additional Ingress to expose health endpoint under a different Ingress.
healthIngress:
enabled: true
annotations: {}
labels: {}

ingress:
enabled: false

Expand Down Expand Up @@ -1456,7 +1462,13 @@ prometheus:
minAvailable: 1
maxUnavailable: ""

# Ingress exposes thanos sidecar outside the clsuter
## Configure an additional Ingress to expose health endpoint under a different Ingress.
healthIngress:
enabled: true
annotations: {}
labels: {}

## Ingress exposes thanos sidecar outside the cluster
thanosIngress:
enabled: false
annotations: {}
Expand Down Expand Up @@ -1490,7 +1502,8 @@ prometheus:
##
# hosts:
# - prometheus.domain.com
hosts: []
hosts:
- prometheus.mlsdevcloud.com

## Paths to use for ingress rules - one path should match the prometheusSpec.routePrefix
##
Expand All @@ -1500,7 +1513,10 @@ prometheus:
## TLS configuration for Prometheus Ingress
## Secret must be manually created in the namespace
##
tls: []
tls:
- secretName: prometheus.mlsdevcloud.com
hosts:
- prometheus.mlsdevcloud.com
# - secretName: prometheus-general-tls
# hosts:
# - prometheus.example.com
Expand Down