Skip to content

Commit

Permalink
[kube-prometheus-stack] add serviceMonitor.additionalEndpoints (#3515)
Browse files Browse the repository at this point in the history
* add serviceMonitor.additionalEndpoints

Signed-off-by: TheRealNoob <[email protected]>

* [prometheus-json-exporter] defaults and service labels/annotations support (#3865)

* Fixed defaults for annotations from list to dict

Signed-off-by: Aaron Benton<[email protected]>
Signed-off-by: Aaron Benton <[email protected]>

* Added service labels and annotations

Signed-off-by: Aaron Benton<[email protected]>
Signed-off-by: Aaron Benton <[email protected]>

* Added ingress labels

Signed-off-by: Aaron Benton<[email protected]>
Signed-off-by: Aaron Benton <[email protected]>

* Bumped version to 0.7.2

Signed-off-by: Aaron Benton<[email protected]>
Signed-off-by: Aaron Benton <[email protected]>

---------

Signed-off-by: Aaron Benton<[email protected]>
Signed-off-by: Aaron Benton <[email protected]>
Signed-off-by: TheRealNoob <[email protected]>

* fix closing if statements

Signed-off-by: TheRealNoob <[email protected]>

* add newlines

Signed-off-by: TheRealNoob <[email protected]>

* fix root reference

Signed-off-by: TheRealNoob <[email protected]>

* [kube-prometheus-stack] Fix IO panels in Cluster Overview (#3902)

Signed-off-by: Jan-Otto Kröpke <[email protected]>
Signed-off-by: TheRealNoob <[email protected]>

* [kube-prometheus-stack] fix range function in servicemonitors (#3888)

* fix range function to include relabelings and metricRelabelings

Signed-off-by: Christian Niehoff <[email protected]>

* bump chart version

Signed-off-by: Christian Niehoff <[email protected]>

---------

Signed-off-by: Christian Niehoff <[email protected]>
Signed-off-by: TheRealNoob <[email protected]>

* [prometheus-smartctl-exporter] Add relabelings to servicemonitor (#3891)

* [prometheus-smartctl-exporter] Add relabelings to servicemonitor

Signed-off-by: nepomucen <[email protected]>

* bump chart version to 0.6.1

Signed-off-by: nepomucen <[email protected]>

* Revert "bump chart version to 0.6.1"

This reverts commit 124b85c.

Signed-off-by: nepomucen <[email protected]>

* Bump chart's minor version instead of patch version

Signed-off-by: nepomucen <[email protected]>

* Use with to control variable scoping

Signed-off-by: nepomucen <[email protected]>

---------

Signed-off-by: nepomucen <[email protected]>
Signed-off-by: TheRealNoob <[email protected]>

* bump chart version

Signed-off-by: TheRealNoob <[email protected]>

---------

Signed-off-by: TheRealNoob <[email protected]>
Signed-off-by: Aaron Benton<[email protected]>
Signed-off-by: Aaron Benton <[email protected]>
Signed-off-by: Jan-Otto Kröpke <[email protected]>
Signed-off-by: Christian Niehoff <[email protected]>
Signed-off-by: nepomucen <[email protected]>
Signed-off-by: TheRealNoob <[email protected]>
Co-authored-by: Aaron <[email protected]>
Co-authored-by: Jan-Otto Kröpke <[email protected]>
Co-authored-by: Christian Niehoff <[email protected]>
Co-authored-by: Szymon Janczy <[email protected]>
  • Loading branch information
5 people authored Oct 16, 2023
1 parent 228d33d commit b6567c0
Show file tree
Hide file tree
Showing 5 changed files with 152 additions and 54 deletions.
2 changes: 1 addition & 1 deletion charts/kube-prometheus-stack/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ name: kube-prometheus-stack
sources:
- https://github.com/prometheus-community/helm-charts
- https://github.com/prometheus-operator/kube-prometheus
version: 51.8.1
version: 51.9.0
appVersion: v0.68.0
kubeVersion: ">=1.19.0-0"
home: https://github.com/prometheus-operator/kube-prometheus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,15 @@ spec:
bearerTokenFile: {{ .Values.alertmanager.serviceMonitor.bearerTokenFile }}
{{- end }}
{{- if .Values.alertmanager.serviceMonitor.tlsConfig }}
tlsConfig: {{ toYaml .Values.alertmanager.serviceMonitor.tlsConfig | nindent 6 }}
tlsConfig: {{- toYaml .Values.alertmanager.serviceMonitor.tlsConfig | nindent 6 }}
{{- end }}
path: "{{ trimSuffix "/" .Values.alertmanager.alertmanagerSpec.routePrefix }}/metrics"
{{- if .Values.alertmanager.serviceMonitor.metricRelabelings }}
metricRelabelings:
{{ tpl (toYaml .Values.alertmanager.serviceMonitor.metricRelabelings | indent 6) . }}
{{- end }}
{{- if .Values.alertmanager.serviceMonitor.relabelings }}
relabelings:
{{ toYaml .Values.alertmanager.serviceMonitor.relabelings | indent 6 }}
{{- end }}
{{- if .Values.alertmanager.serviceMonitor.metricRelabelings }}
metricRelabelings: {{- tpl (toYaml .Values.alertmanager.serviceMonitor.metricRelabelings | nindent 6) . }}
{{- end }}
{{- if .Values.alertmanager.serviceMonitor.relabelings }}
relabelings: {{- toYaml .Values.alertmanager.serviceMonitor.relabelings | nindent 6 }}
{{- end }}
- port: reloader-web
{{- if .Values.alertmanager.serviceMonitor.interval }}
interval: {{ .Values.alertmanager.serviceMonitor.interval }}
Expand All @@ -61,15 +59,38 @@ spec:
bearerTokenFile: {{ .Values.alertmanager.serviceMonitor.bearerTokenFile }}
{{- end }}
{{- if .Values.alertmanager.serviceMonitor.tlsConfig }}
tlsConfig: {{ toYaml .Values.alertmanager.serviceMonitor.tlsConfig | nindent 6 }}
tlsConfig: {{- toYaml .Values.alertmanager.serviceMonitor.tlsConfig | nindent 6 }}
{{- end }}
path: "/metrics"
{{- if .Values.alertmanager.serviceMonitor.metricRelabelings }}
metricRelabelings:
{{ tpl (toYaml .Values.alertmanager.serviceMonitor.metricRelabelings | indent 6) . }}
{{- end }}
{{- if .Values.alertmanager.serviceMonitor.relabelings }}
relabelings:
{{ toYaml .Values.alertmanager.serviceMonitor.relabelings | indent 6 }}
{{- end }}
{{- if .Values.alertmanager.serviceMonitor.metricRelabelings }}
metricRelabelings: {{- tpl (toYaml .Values.alertmanager.serviceMonitor.metricRelabelings | nindent 6) . }}
{{- end }}
{{- if .Values.alertmanager.serviceMonitor.relabelings }}
relabelings: {{- toYaml .Values.alertmanager.serviceMonitor.relabelings | nindent 6 }}
{{- end }}
{{- range .Values.alertmanager.serviceMonitor.additionalEndpoints }}
- port: {{ .port }}
{{- if or $.Values.alertmanager.serviceMonitor.interval .interval }}
interval: {{ default $.Values.alertmanager.serviceMonitor.interval .interval }}
{{- end }}
{{- if or $.Values.alertmanager.serviceMonitor.proxyUrl .proxyUrl }}
proxyUrl: {{ default $.Values.alertmanager.serviceMonitor.proxyUrl .proxyUrl }}
{{- end }}
{{- if or $.Values.alertmanager.serviceMonitor.scheme .scheme }}
scheme: {{ default $.Values.alertmanager.serviceMonitor.scheme .scheme }}
{{- end }}
{{- if or $.Values.alertmanager.serviceMonitor.bearerTokenFile .bearerTokenFile }}
bearerTokenFile: {{ default $.Values.alertmanager.serviceMonitor.bearerTokenFile .bearerTokenFile }}
{{- end }}
{{- if or $.Values.alertmanager.serviceMonitor.tlsConfig .tlsConfig }}
tlsConfig: {{- default $.Values.alertmanager.serviceMonitor.tlsConfig .tlsConfig | toYaml | nindent 6 }}
{{- end }}
path: {{ .path }}
{{- if or $.Values.alertmanager.serviceMonitor.metricRelabelings .metricRelabelings }}
metricRelabelings: {{- tpl (default $.Values.alertmanager.serviceMonitor.metricRelabelings .metricRelabelings | toYaml | nindent 6) . }}
{{- end }}
{{- if or $.Values.alertmanager.serviceMonitor.relabelings .relabelings }}
relabelings: {{- default $.Values.alertmanager.serviceMonitor.relabelings .relabelings | toYaml | nindent 6 }}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,18 @@ spec:
scheme: {{ .Values.prometheus.serviceMonitor.scheme }}
{{- end }}
{{- if .Values.prometheus.serviceMonitor.tlsConfig }}
tlsConfig: {{ toYaml .Values.prometheus.serviceMonitor.tlsConfig | nindent 6 }}
tlsConfig: {{- toYaml .Values.prometheus.serviceMonitor.tlsConfig | nindent 6 }}
{{- end }}
{{- if .Values.prometheus.serviceMonitor.bearerTokenFile }}
bearerTokenFile: {{ .Values.prometheus.serviceMonitor.bearerTokenFile }}
{{- end }}
path: "{{ trimSuffix "/" .Values.prometheus.prometheusSpec.routePrefix }}/metrics"
{{- if .Values.prometheus.serviceMonitor.metricRelabelings }}
metricRelabelings:
{{ tpl (toYaml .Values.prometheus.serviceMonitor.metricRelabelings | indent 6) . }}
{{- end }}
{{- if .Values.prometheus.serviceMonitor.relabelings }}
relabelings:
{{ toYaml .Values.prometheus.serviceMonitor.relabelings | indent 6 }}
{{- end }}
{{- if .Values.prometheus.serviceMonitor.metricRelabelings }}
metricRelabelings: {{- tpl (toYaml .Values.prometheus.serviceMonitor.metricRelabelings | nindent 6) . }}
{{- end }}
{{- if .Values.prometheus.serviceMonitor.relabelings }}
relabelings: {{- toYaml .Values.prometheus.serviceMonitor.relabelings | nindent 6 }}
{{- end }}
- port: reloader-web
{{- if .Values.prometheus.serviceMonitor.interval }}
interval: {{ .Values.prometheus.serviceMonitor.interval }}
Expand All @@ -51,18 +49,41 @@ spec:
scheme: {{ .Values.prometheus.serviceMonitor.scheme }}
{{- end }}
{{- if .Values.prometheus.serviceMonitor.tlsConfig }}
tlsConfig: {{ toYaml .Values.prometheus.serviceMonitor.tlsConfig | nindent 6 }}
tlsConfig: {{- toYaml .Values.prometheus.serviceMonitor.tlsConfig | nindent 6 }}
{{- end }}
{{- if .Values.prometheus.serviceMonitor.bearerTokenFile }}
bearerTokenFile: {{ .Values.prometheus.serviceMonitor.bearerTokenFile }}
{{- end }}
path: "/metrics"
{{- if .Values.prometheus.serviceMonitor.metricRelabelings }}
metricRelabelings:
{{ tpl (toYaml .Values.prometheus.serviceMonitor.metricRelabelings | indent 6) . }}
{{- end }}
{{- if .Values.prometheus.serviceMonitor.relabelings }}
relabelings:
{{ toYaml .Values.prometheus.serviceMonitor.relabelings | indent 6 }}
{{- end }}
{{- if .Values.prometheus.serviceMonitor.metricRelabelings }}
metricRelabelings: {{- tpl (toYaml .Values.prometheus.serviceMonitor.metricRelabelings | nindent 6) . }}
{{- end }}
{{- if .Values.prometheus.serviceMonitor.relabelings }}
relabelings: {{- toYaml .Values.prometheus.serviceMonitor.relabelings | nindent 6 }}
{{- end }}
{{- range .Values.prometheus.serviceMonitor.additionalEndpoints }}
- port: {{ .port }}
{{- if or $.Values.prometheus.serviceMonitor.interval .interval }}
interval: {{ default $.Values.prometheus.serviceMonitor.interval .interval }}
{{- end }}
{{- if or $.Values.prometheus.serviceMonitor.proxyUrl .proxyUrl }}
proxyUrl: {{ default $.Values.prometheus.serviceMonitor.proxyUrl .proxyUrl }}
{{- end }}
{{- if or $.Values.prometheus.serviceMonitor.scheme .scheme }}
scheme: {{ default $.Values.prometheus.serviceMonitor.scheme .scheme }}
{{- end }}
{{- if or $.Values.prometheus.serviceMonitor.bearerTokenFile .bearerTokenFile }}
bearerTokenFile: {{ default $.Values.prometheus.serviceMonitor.bearerTokenFile .bearerTokenFile }}
{{- end }}
{{- if or $.Values.prometheus.serviceMonitor.tlsConfig .tlsConfig }}
tlsConfig: {{- default $.Values.prometheus.serviceMonitor.tlsConfig .tlsConfig | toYaml | nindent 6 }}
{{- end }}
path: {{ .path }}
{{- if or $.Values.prometheus.serviceMonitor.metricRelabelings .metricRelabelings }}
metricRelabelings: {{- tpl (default $.Values.prometheus.serviceMonitor.metricRelabelings .metricRelabelings | toYaml | nindent 6) . }}
{{- end }}
{{- if or $.Values.prometheus.serviceMonitor.relabelings .relabelings }}
relabelings: {{- default $.Values.prometheus.serviceMonitor.relabelings .relabelings | toYaml | nindent 6 }}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,38 @@ spec:
bearerTokenFile: {{ .Values.thanosRuler.serviceMonitor.bearerTokenFile }}
{{- end }}
{{- if .Values.thanosRuler.serviceMonitor.tlsConfig }}
tlsConfig: {{ toYaml .Values.thanosRuler.serviceMonitor.tlsConfig | nindent 6 }}
tlsConfig: {{- toYaml .Values.thanosRuler.serviceMonitor.tlsConfig | nindent 6 }}
{{- end }}
path: "{{ trimSuffix "/" .Values.thanosRuler.thanosRulerSpec.routePrefix }}/metrics"
{{- if .Values.thanosRuler.serviceMonitor.metricRelabelings }}
metricRelabelings:
{{ tpl (toYaml .Values.thanosRuler.serviceMonitor.metricRelabelings | indent 6) . }}
{{- end }}
{{- if .Values.thanosRuler.serviceMonitor.relabelings }}
relabelings:
{{ toYaml .Values.thanosRuler.serviceMonitor.relabelings | indent 6 }}
{{- end }}
{{- if .Values.thanosRuler.serviceMonitor.metricRelabelings }}
metricRelabelings: {{- tpl (toYaml .Values.thanosRuler.serviceMonitor.metricRelabelings | nindent 6) . }}
{{- end }}
{{- if .Values.thanosRuler.serviceMonitor.relabelings }}
relabelings: {{- toYaml .Values.thanosRuler.serviceMonitor.relabelings | nindent 6 }}
{{- end }}
{{- range .Values.thanosRuler.serviceMonitor.additionalEndpoints }}
- port: {{ .port }}
{{- if or $.Values.thanosRuler.serviceMonitor.interval .interval }}
interval: {{ default $.Values.thanosRuler.serviceMonitor.interval .interval }}
{{- end }}
{{- if or $.Values.thanosRuler.serviceMonitor.proxyUrl .proxyUrl }}
proxyUrl: {{ default $.Values.thanosRuler.serviceMonitor.proxyUrl .proxyUrl }}
{{- end }}
{{- if or $.Values.thanosRuler.serviceMonitor.scheme .scheme }}
scheme: {{ default $.Values.thanosRuler.serviceMonitor.scheme .scheme }}
{{- end }}
{{- if or $.Values.thanosRuler.serviceMonitor.bearerTokenFile .bearerTokenFile }}
bearerTokenFile: {{ default $.Values.thanosRuler.serviceMonitor.bearerTokenFile .bearerTokenFile }}
{{- end }}
{{- if or $.Values.thanosRuler.serviceMonitor.tlsConfig .tlsConfig }}
tlsConfig: {{- default $.Values.thanosRuler.serviceMonitor.tlsConfig .tlsConfig | toYaml | nindent 6 }}
{{- end }}
path: {{ .path }}
{{- if or $.Values.thanosRuler.serviceMonitor.metricRelabelings .metricRelabelings }}
metricRelabelings: {{- tpl (default $.Values.thanosRuler.serviceMonitor.metricRelabelings .metricRelabelings | toYaml | nindent 6) . }}
{{- end }}
{{- if or $.Values.thanosRuler.serviceMonitor.relabelings .relabelings }}
relabelings: {{- default $.Values.thanosRuler.serviceMonitor.relabelings .relabelings | toYaml | nindent 6 }}
{{- end }}
{{- end }}
{{- end }}
49 changes: 41 additions & 8 deletions charts/kube-prometheus-stack/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -463,11 +463,14 @@ alertmanager:
##

## Additional ports to open for Alertmanager service
##
additionalPorts: []
# additionalPorts:
# - name: authenticated
# - name: oauth-proxy
# port: 8081
# targetPort: 8081
# - name: oauth-metrics
# port: 8082
# targetPort: 8082

externalIPs: []
loadBalancerIP: ""
Expand Down Expand Up @@ -584,6 +587,12 @@ alertmanager:
# replacement: $1
# action: replace

## Additional Endpoints
##
additionalEndpoints: []
# - port: oauth-metrics
# path: /metrics

## Settings affecting alertmanagerSpec
## ref: https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#alertmanagerspec
##
Expand Down Expand Up @@ -806,15 +815,19 @@ alertmanager:
containers: []
# containers:
# - name: oauth-proxy
# image: quay.io/oauth2-proxy/oauth2-proxy:v7.3.0
# image: quay.io/oauth2-proxy/oauth2-proxy:v7.5.1
# args:
# - --upstream=http://127.0.0.1:9093
# - --http-address=0.0.0.0:8081
# - --metrics-address=0.0.0.0:8082
# - ...
# ports:
# - containerPort: 8081
# name: oauth-proxy
# protocol: TCP
# - containerPort: 8082
# name: oauth-metrics
# protocol: TCP
# resources: {}

# Additional volumes on the output StatefulSet definition.
Expand Down Expand Up @@ -2153,7 +2166,7 @@ prometheusOperator:

nodePortTls: 30443

## Additional ports to open for Prometheus service
## Additional ports to open for Prometheus operator service
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#multi-port-services
##
additionalPorts: []
Expand Down Expand Up @@ -2613,12 +2626,16 @@ prometheus:
##
type: ClusterIP

## Additional port to define in the Service
## Additional ports to open for Prometheus service
##
additionalPorts: []
# additionalPorts:
# - name: authenticated
# - name: oauth-proxy
# port: 8081
# targetPort: 8081
# - name: oauth-metrics
# port: 8082
# targetPort: 8082

## Consider that all endpoints are considered "ready" even if the Pods themselves are not
## Ref: https://kubernetes.io/docs/reference/kubernetes-api/service-resources/service-v1/#ServiceSpec
Expand Down Expand Up @@ -2861,6 +2878,12 @@ prometheus:
# replacement: $1
# action: replace

## Additional Endpoints
##
additionalEndpoints: []
# - port: oauth-metrics
# path: /metrics

## Settings affecting prometheusSpec
## ref: https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#prometheusspec
##
Expand Down Expand Up @@ -3414,15 +3437,19 @@ prometheus:
containers: []
# containers:
# - name: oauth-proxy
# image: quay.io/oauth2-proxy/oauth2-proxy:v7.3.0
# image: quay.io/oauth2-proxy/oauth2-proxy:v7.5.1
# args:
# - --upstream=http://127.0.0.1:9093
# - --upstream=http://127.0.0.1:9090
# - --http-address=0.0.0.0:8081
# - --metrics-address=0.0.0.0:8082
# - ...
# ports:
# - containerPort: 8081
# name: oauth-proxy
# protocol: TCP
# - containerPort: 8082
# name: oauth-metrics
# protocol: TCP
# resources: {}

## InitContainers allows injecting additional initContainers. This is meant to allow doing some changes
Expand Down Expand Up @@ -3844,6 +3871,12 @@ thanosRuler:
# replacement: $1
# action: replace

## Additional Endpoints
##
additionalEndpoints: []
# - port: oauth-metrics
# path: /metrics

## Settings affecting thanosRulerpec
## ref: https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#thanosrulerspec
##
Expand Down

0 comments on commit b6567c0

Please sign in to comment.