Skip to content

Commit

Permalink
Add podTargeLabels to Prometheus ServiceMonitor CRDs (#439)
Browse files Browse the repository at this point in the history
* Add podTargeLabels to Prometheus ServiceMonitor CRDs #437

Signed-off-by: John Meza <john.m.meza@protonmail.com>

* Add correct PR number to CHANGELOG

Signed-off-by: John Meza <john.m.meza@protonmail.com>

* Fix typo in podTargetLabels

Signed-off-by: John Meza <john.m.meza@protonmail.com>

---------

Signed-off-by: John Meza <john.m.meza@protonmail.com>
  • Loading branch information
Meza authored Mar 14, 2023
1 parent 46ede5f commit ea6fe64
Show file tree
Hide file tree
Showing 14 changed files with 89 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

* [FEATURE] add autoscaler for the ruler #430
* [ENHANCEMENT] Add annotations and labels to memberlist service #433
* [ENHANCEMENT] Add podTargetLabels to all Prometheus servicemonitor CRs #439

# 2.0.1 / 2023-01-06

Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ Kubernetes: `^1.19.0-0`
| alertmanager.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;enabled | bool | `false` | |
| alertmanager.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;extraEndpointSpec | object | `{}` | Additional endpoint configuration https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#endpoint |
| alertmanager.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;metricRelabelings | list | `[]` | |
| alertmanager.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;podTargetLabels | list | `[]` | |
| alertmanager.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;relabelings | list | `[]` | |
| alertmanager.&ZeroWidthSpace;sidecar.&ZeroWidthSpace;containerSecurityContext.&ZeroWidthSpace;enabled | bool | `true` | |
| alertmanager.&ZeroWidthSpace;sidecar.&ZeroWidthSpace;containerSecurityContext.&ZeroWidthSpace;readOnlyRootFilesystem | bool | `true` | |
Expand Down Expand Up @@ -203,6 +204,7 @@ Kubernetes: `^1.19.0-0`
| compactor.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;enabled | bool | `false` | |
| compactor.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;extraEndpointSpec | object | `{}` | Additional endpoint configuration https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#endpoint |
| compactor.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;metricRelabelings | list | `[]` | |
| compactor.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;podTargetLabels | list | `[]` | |
| compactor.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;relabelings | list | `[]` | |
| compactor.&ZeroWidthSpace;startupProbe.&ZeroWidthSpace;failureThreshold | int | `60` | |
| compactor.&ZeroWidthSpace;startupProbe.&ZeroWidthSpace;httpGet.&ZeroWidthSpace;path | string | `"/ready"` | |
Expand Down Expand Up @@ -298,6 +300,7 @@ Kubernetes: `^1.19.0-0`
| distributor.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;enabled | bool | `false` | |
| distributor.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;extraEndpointSpec | object | `{}` | Additional endpoint configuration https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#endpoint |
| distributor.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;metricRelabelings | list | `[]` | |
| distributor.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;podTargetLabels | list | `[]` | |
| distributor.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;relabelings | list | `[]` | |
| distributor.&ZeroWidthSpace;startupProbe.&ZeroWidthSpace;failureThreshold | int | `10` | |
| distributor.&ZeroWidthSpace;startupProbe.&ZeroWidthSpace;httpGet.&ZeroWidthSpace;path | string | `"/ready"` | |
Expand Down Expand Up @@ -361,6 +364,7 @@ Kubernetes: `^1.19.0-0`
| ingester.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;enabled | bool | `false` | |
| ingester.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;extraEndpointSpec | object | `{}` | Additional endpoint configuration https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#endpoint |
| ingester.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;metricRelabelings | list | `[]` | |
| ingester.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;podTargetLabels | list | `[]` | |
| ingester.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;relabelings | list | `[]` | |
| ingester.&ZeroWidthSpace;startupProbe | object | `{}` | Startup/liveness probes for ingesters are not recommended. Ref: https://cortexmetrics.io/docs/guides/running-cortex-on-kubernetes/#take-extra-care-with-ingesters |
| ingester.&ZeroWidthSpace;statefulSet.&ZeroWidthSpace;enabled | bool | `false` | If true, use a statefulset instead of a deployment for pod management. This is useful when using WAL |
Expand Down Expand Up @@ -506,6 +510,7 @@ Kubernetes: `^1.19.0-0`
| overrides_exporter.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;enabled | bool | `false` | |
| overrides_exporter.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;extraEndpointSpec | object | `{}` | Additional endpoint configuration https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#endpoint |
| overrides_exporter.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;metricRelabelings | list | `[]` | |
| overrides_exporter.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;podTargetLabels | list | `[]` | |
| overrides_exporter.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;relabelings | list | `[]` | |
| overrides_exporter.&ZeroWidthSpace;startupProbe.&ZeroWidthSpace;failureThreshold | int | `10` | |
| overrides_exporter.&ZeroWidthSpace;startupProbe.&ZeroWidthSpace;httpGet.&ZeroWidthSpace;path | string | `"/ready"` | |
Expand Down Expand Up @@ -548,6 +553,7 @@ Kubernetes: `^1.19.0-0`
| purger.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;enabled | bool | `false` | |
| purger.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;extraEndpointSpec | object | `{}` | |
| purger.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;metricRelabelings | list | `[]` | |
| purger.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;podTargetLabels | list | `[]` | |
| purger.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;relabelings | list | `[]` | |
| purger.&ZeroWidthSpace;startupProbe.&ZeroWidthSpace;failureThreshold | int | `60` | |
| purger.&ZeroWidthSpace;startupProbe.&ZeroWidthSpace;httpGet.&ZeroWidthSpace;path | string | `"/ready"` | |
Expand Down Expand Up @@ -600,6 +606,7 @@ Kubernetes: `^1.19.0-0`
| querier.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;enabled | bool | `false` | |
| querier.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;extraEndpointSpec | object | `{}` | Additional endpoint configuration https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#endpoint |
| querier.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;metricRelabelings | list | `[]` | |
| querier.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;podTargetLabels | list | `[]` | |
| querier.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;relabelings | list | `[]` | |
| querier.&ZeroWidthSpace;startupProbe.&ZeroWidthSpace;failureThreshold | int | `10` | |
| querier.&ZeroWidthSpace;startupProbe.&ZeroWidthSpace;httpGet.&ZeroWidthSpace;path | string | `"/ready"` | |
Expand Down Expand Up @@ -646,6 +653,7 @@ Kubernetes: `^1.19.0-0`
| query_frontend.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;enabled | bool | `false` | |
| query_frontend.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;extraEndpointSpec | object | `{}` | Additional endpoint configuration https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#endpoint |
| query_frontend.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;metricRelabelings | list | `[]` | |
| query_frontend.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;podTargetLabels | list | `[]` | |
| query_frontend.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;relabelings | list | `[]` | |
| query_frontend.&ZeroWidthSpace;startupProbe.&ZeroWidthSpace;failureThreshold | int | `10` | |
| query_frontend.&ZeroWidthSpace;startupProbe.&ZeroWidthSpace;httpGet.&ZeroWidthSpace;path | string | `"/ready"` | |
Expand Down Expand Up @@ -691,6 +699,7 @@ Kubernetes: `^1.19.0-0`
| query_scheduler.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;enabled | bool | `false` | |
| query_scheduler.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;extraEndpointSpec | object | `{}` | Additional endpoint configuration https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#endpoint |
| query_scheduler.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;metricRelabelings | list | `[]` | |
| query_scheduler.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;podTargetLabels | list | `[]` | |
| query_scheduler.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;relabelings | list | `[]` | |
| query_scheduler.&ZeroWidthSpace;startupProbe.&ZeroWidthSpace;failureThreshold | int | `10` | |
| query_scheduler.&ZeroWidthSpace;startupProbe.&ZeroWidthSpace;httpGet.&ZeroWidthSpace;path | string | `"/ready"` | |
Expand Down Expand Up @@ -738,6 +747,7 @@ Kubernetes: `^1.19.0-0`
| ruler.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;enabled | bool | `false` | |
| ruler.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;extraEndpointSpec | object | `{}` | Additional endpoint configuration https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#endpoint |
| ruler.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;metricRelabelings | list | `[]` | |
| ruler.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;podTargetLabels | list | `[]` | |
| ruler.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;relabelings | list | `[]` | |
| ruler.&ZeroWidthSpace;sidecar.&ZeroWidthSpace;containerSecurityContext.&ZeroWidthSpace;enabled | bool | `true` | |
| ruler.&ZeroWidthSpace;sidecar.&ZeroWidthSpace;containerSecurityContext.&ZeroWidthSpace;readOnlyRootFilesystem | bool | `true` | |
Expand Down Expand Up @@ -821,6 +831,7 @@ Kubernetes: `^1.19.0-0`
| store_gateway.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;enabled | bool | `false` | |
| store_gateway.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;extraEndpointSpec | object | `{}` | Additional endpoint configuration https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#endpoint |
| store_gateway.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;metricRelabelings | list | `[]` | |
| store_gateway.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;podTargetLabels | list | `[]` | |
| store_gateway.&ZeroWidthSpace;serviceMonitor.&ZeroWidthSpace;relabelings | list | `[]` | |
| store_gateway.&ZeroWidthSpace;startupProbe.&ZeroWidthSpace;failureThreshold | int | `60` | |
| store_gateway.&ZeroWidthSpace;startupProbe.&ZeroWidthSpace;httpGet.&ZeroWidthSpace;path | string | `"/ready"` | |
Expand Down
6 changes: 6 additions & 0 deletions templates/alertmanager/alertmanager-servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ spec:
namespaceSelector:
matchNames:
- {{ .Release.Namespace | quote }}
{{- if .Values.purger.serviceMonitor.podTargetLabels }}
podTargetLabels:
{{- range .Values.purger.serviceMonitor.podTargetLabels }}
- {{ . }}
{{- end }}
{{- end }}
endpoints:
- port: http-metrics
{{- if .Values.alertmanager.serviceMonitor.interval }}
Expand Down
6 changes: 6 additions & 0 deletions templates/compactor/compactor-servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ spec:
namespaceSelector:
matchNames:
- {{ .Release.Namespace | quote }}
{{- if .Values.purger.serviceMonitor.podTargetLabels }}
podTargetLabels:
{{- range .Values.purger.serviceMonitor.podTargetLabels }}
- {{ . }}
{{- end }}
{{- end }}
endpoints:
- port: http-metrics
{{- if .Values.compactor.serviceMonitor.interval }}
Expand Down
6 changes: 6 additions & 0 deletions templates/distributor/distributor-servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ spec:
namespaceSelector:
matchNames:
- {{ .Release.Namespace | quote }}
{{- if .Values.purger.serviceMonitor.podTargetLabels }}
podTargetLabels:
{{- range .Values.purger.serviceMonitor.podTargetLabels }}
- {{ . }}
{{- end }}
{{- end }}
endpoints:
- port: http-metrics
{{- if .Values.distributor.serviceMonitor.interval }}
Expand Down
6 changes: 6 additions & 0 deletions templates/ingester/ingester-servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ spec:
namespaceSelector:
matchNames:
- {{ .Release.Namespace | quote }}
{{- if .Values.purger.serviceMonitor.podTargetLabels }}
podTargetLabels:
{{- range .Values.purger.serviceMonitor.podTargetLabels }}
- {{ . }}
{{- end }}
{{- end }}
endpoints:
- port: http-metrics
{{- if .Values.ingester.serviceMonitor.interval }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ spec:
namespaceSelector:
matchNames:
- {{ .Release.Namespace | quote }}
{{- if .Values.purger.serviceMonitor.podTargetLabels }}
podTargetLabels:
{{- range .Values.purger.serviceMonitor.podTargetLabels }}
- {{ . }}
{{- end }}
{{- end }}
endpoints:
- port: http-metrics
{{- if .Values.overrides_exporter.serviceMonitor.interval }}
Expand Down
6 changes: 6 additions & 0 deletions templates/purger/purger-servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ spec:
namespaceSelector:
matchNames:
- {{ .Release.Namespace | quote }}
{{- if .Values.purger.serviceMonitor.podTargetLabels }}
podTargetLabels:
{{- range .Values.purger.serviceMonitor.podTargetLabels }}
- {{ . }}
{{- end }}
{{- end }}
endpoints:
- port: http-metrics
{{- if .Values.purger.serviceMonitor.interval }}
Expand Down
6 changes: 6 additions & 0 deletions templates/querier/querier-servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ spec:
namespaceSelector:
matchNames:
- {{ .Release.Namespace | quote }}
{{- if .Values.purger.serviceMonitor.podTargetLabels }}
podTargetLabels:
{{- range .Values.purger.serviceMonitor.podTargetLabels }}
- {{ . }}
{{- end }}
{{- end }}
endpoints:
- port: http-metrics
{{- if .Values.querier.serviceMonitor.interval }}
Expand Down
6 changes: 6 additions & 0 deletions templates/query-frontend/query-frontend-servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ spec:
namespaceSelector:
matchNames:
- {{ .Release.Namespace | quote }}
{{- if .Values.purger.serviceMonitor.podTargetLabels }}
podTargetLabels:
{{- range .Values.purger.serviceMonitor.podTargetLabels }}
- {{ . }}
{{- end }}
{{- end }}
endpoints:
- port: http-metrics
{{- if .Values.query_frontend.serviceMonitor.interval }}
Expand Down
6 changes: 6 additions & 0 deletions templates/query-scheduler/query-scheduler-servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ spec:
namespaceSelector:
matchNames:
- {{ .Release.Namespace | quote }}
{{- if .Values.purger.serviceMonitor.podTargetLabels }}
podTargetLabels:
{{- range .Values.purger.serviceMonitor.podTargetLabels }}
- {{ . }}
{{- end }}
{{- end }}
endpoints:
- port: http-metrics
{{- if .Values.query_scheduler.serviceMonitor.interval }}
Expand Down
6 changes: 6 additions & 0 deletions templates/ruler/ruler-servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ spec:
namespaceSelector:
matchNames:
- {{ .Release.Namespace | quote }}
{{- if .Values.purger.serviceMonitor.podTargetLabels }}
podTargetLabels:
{{- range .Values.purger.serviceMonitor.podTargetLabels }}
- {{ . }}
{{- end }}
{{- end }}
endpoints:
- port: http-metrics
{{- if .Values.ruler.serviceMonitor.interval }}
Expand Down
6 changes: 6 additions & 0 deletions templates/store-gateway/store-gateway-servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ spec:
namespaceSelector:
matchNames:
- {{ .Release.Namespace | quote }}
{{- if .Values.purger.serviceMonitor.podTargetLabels }}
podTargetLabels:
{{- range .Values.purger.serviceMonitor.podTargetLabels }}
- {{ . }}
{{- end }}
{{- end }}
endpoints:
- port: http-metrics
{{- if .Values.store_gateway.serviceMonitor.interval }}
Expand Down
11 changes: 11 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ alertmanager:
metricRelabelings: []
# -- Additional endpoint configuration https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#endpoint
extraEndpointSpec: {}
podTargetLabels: []

resources: {}

Expand Down Expand Up @@ -330,6 +331,7 @@ distributor:
metricRelabelings: []
# -- Additional endpoint configuration https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#endpoint
extraEndpointSpec: {}
podTargetLabels: []

resources: {}

Expand Down Expand Up @@ -440,6 +442,7 @@ ingester:
metricRelabelings: []
# -- Additional endpoint configuration https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#endpoint
extraEndpointSpec: {}
podTargetLabels: []

resources: {}

Expand Down Expand Up @@ -592,6 +595,7 @@ ruler:
metricRelabelings: []
# -- Additional endpoint configuration https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#endpoint
extraEndpointSpec: {}
podTargetLabels: []

resources: {}

Expand Down Expand Up @@ -728,6 +732,7 @@ querier:
metricRelabelings: []
# -- Additional endpoint configuration https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#endpoint
extraEndpointSpec: {}
podTargetLabels: []

resources: {}

Expand Down Expand Up @@ -832,6 +837,7 @@ query_frontend:
metricRelabelings: []
# -- Additional endpoint configuration https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#endpoint
extraEndpointSpec: {}
podTargetLabels: []

resources: {}

Expand Down Expand Up @@ -922,6 +928,7 @@ query_scheduler:
metricRelabelings: []
# -- Additional endpoint configuration https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#endpoint
extraEndpointSpec: {}
podTargetLabels: []

resources: {}

Expand Down Expand Up @@ -1010,6 +1017,7 @@ overrides_exporter:
metricRelabelings: []
# -- Additional endpoint configuration https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#endpoint
extraEndpointSpec: {}
podTargetLabels: []

resources: {}

Expand Down Expand Up @@ -1095,6 +1103,7 @@ purger:
relabelings: []
metricRelabelings: []
extraEndpointSpec: {}
podTargetLabels: []

resources: {}

Expand Down Expand Up @@ -1306,6 +1315,7 @@ store_gateway:
metricRelabelings: []
# -- Additional endpoint configuration https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#endpoint
extraEndpointSpec: {}
podTargetLabels: []

resources: {}

Expand Down Expand Up @@ -1433,6 +1443,7 @@ compactor:
metricRelabelings: []
# -- Additional endpoint configuration https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#endpoint
extraEndpointSpec: {}
podTargetLabels: []

resources: {}

Expand Down

0 comments on commit ea6fe64

Please sign in to comment.