Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support for metricRelabelings to Pod and Service monitors #603

Merged
merged 2 commits into from
Jan 29, 2024
Merged
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
7 changes: 6 additions & 1 deletion keda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ their default values.
| `logging.operator.level` | string | `"info"` | Logging level for KEDA Operator. allowed values: `debug`, `info`, `error`, or an integer value greater than 0, specified as string |
| `logging.operator.timeEncoding` | string | `"rfc3339"` | Logging time encoding for KEDA Operator. allowed values are `epoch`, `millis`, `nano`, `iso8601`, `rfc3339` or `rfc3339nano` |
| `operator.affinity` | object | `{}` | [Affinity] for pod scheduling for KEDA operator. Takes precedence over the `affinity` field |
| `operator.disableCompression` | bool | `true` | Disable response compression for k8s restAPI in client-go. Disabling compression simply means that turns off the process of making data smaller for K8s restAPI in client-go for faster transmission. |
| `operator.disableCompression` | bool | `true` | Disable response compression for k8s restAPI in client-go. Disabling compression simply means that turns off the process of making data smaller for K8s restAPI in client-go for faster transmission. |
| `operator.livenessProbe` | object | `{"failureThreshold":3,"initialDelaySeconds":25,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":1}` | Liveness probes for operator ([docs](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/)) |
| `operator.name` | string | `"keda-operator"` | Name of the KEDA operator |
| `operator.readinessProbe` | object | `{"failureThreshold":3,"initialDelaySeconds":20,"periodSeconds":3,"successThreshold":1,"timeoutSeconds":1}` | Readiness probes for operator ([docs](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-readiness-probes)) |
Expand Down Expand Up @@ -184,6 +184,7 @@ their default values.
| `prometheus.metricServer.podMonitor.additionalLabels` | object | `{}` | Additional labels to add for metric server using podMonitor crd (prometheus operator) |
| `prometheus.metricServer.podMonitor.enabled` | bool | `false` | Enables PodMonitor creation for the Prometheus Operator |
| `prometheus.metricServer.podMonitor.interval` | string | `""` | Scraping interval for metric server using podMonitor crd (prometheus operator) |
| `prometheus.metricServer.podMonitor.metricRelabelings` | list | `[]` | List of expressions that define custom metric relabeling rules for metric server PodMonitor crd after scrape has happened (prometheus operator). [RelabelConfig Spec] |
| `prometheus.metricServer.podMonitor.namespace` | string | `""` | Scraping namespace for metric server using podMonitor crd (prometheus operator) |
| `prometheus.metricServer.podMonitor.relabelings` | list | `[]` | List of expressions that define custom relabeling rules for metric server podMonitor crd (prometheus operator) |
| `prometheus.metricServer.podMonitor.scrapeTimeout` | string | `""` | Scraping timeout for metric server using podMonitor crd (prometheus operator) |
Expand All @@ -193,6 +194,7 @@ their default values.
| `prometheus.metricServer.serviceMonitor.enabled` | bool | `false` | Enables ServiceMonitor creation for the Prometheus Operator |
| `prometheus.metricServer.serviceMonitor.interval` | string | `""` | Interval at which metrics should be scraped If not specified Prometheus’ global scrape interval is used. |
| `prometheus.metricServer.serviceMonitor.jobLabel` | string | `""` | JobLabel selects the label from the associated Kubernetes service which will be used as the job label for all metrics. [ServiceMonitor Spec] |
| `prometheus.metricServer.serviceMonitor.metricRelabelings` | list | `[]` | List of expressions that define custom metric relabeling rules for metric server ServiceMonitor crd after scrape has happened (prometheus operator). [RelabelConfig Spec] |
| `prometheus.metricServer.serviceMonitor.podTargetLabels` | list | `[]` | PodTargetLabels transfers labels on the Kubernetes `Pod` onto the created metrics |
| `prometheus.metricServer.serviceMonitor.port` | string | `"metrics"` | Name of the service port this endpoint refers to. Mutually exclusive with targetPort |
| `prometheus.metricServer.serviceMonitor.relabelings` | list | `[]` | List of expressions that define custom relabeling rules for metric server ServiceMonitor crd (prometheus operator). [RelabelConfig Spec] |
Expand All @@ -206,6 +208,7 @@ their default values.
| `prometheus.operator.podMonitor.additionalLabels` | object | `{}` | Additional labels to add for KEDA Operator using podMonitor crd (prometheus operator) |
| `prometheus.operator.podMonitor.enabled` | bool | `false` | Enables PodMonitor creation for the Prometheus Operator |
| `prometheus.operator.podMonitor.interval` | string | `""` | Scraping interval for KEDA Operator using podMonitor crd (prometheus operator) |
| `prometheus.operator.podMonitor.metricRelabelings` | list | `[]` | List of expressions that define custom metric relabeling rules for metric server PodMonitor crd after scrape has happened (prometheus operator). [RelabelConfig Spec] |
| `prometheus.operator.podMonitor.namespace` | string | `""` | Scraping namespace for KEDA Operator using podMonitor crd (prometheus operator) |
| `prometheus.operator.podMonitor.relabelings` | list | `[]` | List of expressions that define custom relabeling rules for KEDA Operator podMonitor crd (prometheus operator) |
| `prometheus.operator.podMonitor.scrapeTimeout` | string | `""` | Scraping timeout for KEDA Operator using podMonitor crd (prometheus operator) |
Expand All @@ -218,6 +221,7 @@ their default values.
| `prometheus.operator.serviceMonitor.enabled` | bool | `false` | Enables ServiceMonitor creation for the Prometheus Operator |
| `prometheus.operator.serviceMonitor.interval` | string | `""` | Interval at which metrics should be scraped If not specified Prometheus’ global scrape interval is used. |
| `prometheus.operator.serviceMonitor.jobLabel` | string | `""` | JobLabel selects the label from the associated Kubernetes service which will be used as the job label for all metrics. [ServiceMonitor Spec] |
| `prometheus.operator.serviceMonitor.metricRelabelings` | list | `[]` | List of expressions that define custom metric relabeling rules for metric server ServiceMonitor crd after scrape has happened (prometheus operator). [RelabelConfig Spec] |
| `prometheus.operator.serviceMonitor.podTargetLabels` | list | `[]` | PodTargetLabels transfers labels on the Kubernetes `Pod` onto the created metrics |
| `prometheus.operator.serviceMonitor.port` | string | `"metrics"` | Name of the service port this endpoint refers to. Mutually exclusive with targetPort |
| `prometheus.operator.serviceMonitor.relabelings` | list | `[]` | List of expressions that define custom relabeling rules for metric server ServiceMonitor crd (prometheus operator). [RelabelConfig Spec] |
Expand All @@ -237,6 +241,7 @@ their default values.
| `prometheus.webhooks.serviceMonitor.enabled` | bool | `false` | Enables ServiceMonitor creation for the Prometheus webhooks |
| `prometheus.webhooks.serviceMonitor.interval` | string | `""` | Interval at which metrics should be scraped If not specified Prometheus’ global scrape interval is used. |
| `prometheus.webhooks.serviceMonitor.jobLabel` | string | `""` | jobLabel selects the label from the associated Kubernetes service which will be used as the job label for all metrics. [ServiceMonitor Spec] |
| `prometheus.webhooks.serviceMonitor.metricRelabelings` | list | `[]` | List of expressions that define custom metric relabeling rules for metric server ServiceMonitor crd after scrape has happened (prometheus operator). [RelabelConfig Spec] |
| `prometheus.webhooks.serviceMonitor.podTargetLabels` | list | `[]` | PodTargetLabels transfers labels on the Kubernetes `Pod` onto the created metrics |
| `prometheus.webhooks.serviceMonitor.port` | string | `"metrics"` | Name of the service port this endpoint refers to. Mutually exclusive with targetPort |
| `prometheus.webhooks.serviceMonitor.relabelings` | list | `[]` | List of expressions that define custom relabeling rules for metric server ServiceMonitor crd (prometheus operator). [RelabelConfig Spec] |
Expand Down
4 changes: 4 additions & 0 deletions keda/templates/manager/podmonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ spec:
relabelings:
{{ toYaml . | indent 4 }}
{{- end }}
{{- with .Values.prometheus.operator.podMonitor.metricRelabelings }}
metricRelabelings:
{{- toYaml . | nindent 4 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
Expand Down
4 changes: 4 additions & 0 deletions keda/templates/manager/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ spec:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- end}}
{{- with .Values.prometheus.operator.serviceMonitor.metricRelabelings }}
metricRelabelings:
{{- toYaml . | nindent 6 }}
{{- end }}
scheme: {{ .Values.prometheus.operator.serviceMonitor.scheme }}
{{- with .Values.prometheus.operator.serviceMonitor.tlsConfig }}
tlsConfig:
Expand Down
4 changes: 4 additions & 0 deletions keda/templates/metrics-server/podmonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ spec:
relabelings:
{{ toYaml . | indent 4 }}
{{- end }}
{{- with .Values.prometheus.metricServer.podMonitor.metricRelabelings }}
metricRelabelings:
{{- toYaml . | nindent 4 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
Expand Down
4 changes: 4 additions & 0 deletions keda/templates/metrics-server/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ spec:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- end}}
{{- with .Values.prometheus.metricServer.serviceMonitor.metricRelabelings }}
metricRelabelings:
{{- toYaml . | nindent 6 }}
{{- end }}
scheme: {{ .Values.prometheus.metricServer.serviceMonitor.scheme }}
{{- with .Values.prometheus.metricServer.serviceMonitor.tlsConfig }}
tlsConfig:
Expand Down
4 changes: 4 additions & 0 deletions keda/templates/webhooks/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ spec:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- end}}
{{- with .Values.prometheus.webhooks.serviceMonitor.metricRelabelings }}
metricRelabelings:
{{- toYaml . | nindent 6 }}
{{- end }}
scheme: {{ .Values.prometheus.webhooks.serviceMonitor.scheme }}
{{- with .Values.prometheus.webhooks.serviceMonitor.tlsConfig }}
tlsConfig:
Expand Down
16 changes: 13 additions & 3 deletions keda/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ operator:
# You can run multiple replicas, but they will not improve the performance of KEDA, it could only reduce downtime during a failover.
# Learn more in [our documentation](https://keda.sh/docs/latest/operate/cluster/#high-availability).
replicaCount: 1
# --Disable response compression for k8s restAPI in client-go.
# --Disable response compression for k8s restAPI in client-go.
# Disabling compression simply means that turns off the process of making data smaller for K8s restAPI in client-go for faster transmission.
disableCompression: true
disableCompression: true
# -- [Affinity] for pod scheduling for KEDA operator. Takes precedence over the `affinity` field
affinity: {}
# podAntiAffinity:
Expand Down Expand Up @@ -574,6 +574,8 @@ prometheus:
relabellings: []
# -- List of expressions that define custom relabeling rules for metric server ServiceMonitor crd (prometheus operator). [RelabelConfig Spec]
relabelings: []
# -- List of expressions that define custom metric relabeling rules for metric server ServiceMonitor crd after scrape has happened (prometheus operator). [RelabelConfig Spec]
metricRelabelings: []
# -- Additional labels to add for metric server using ServiceMonitor crd (prometheus operator)
additionalLabels: {}
# -- HTTP scheme used for scraping. Defaults to `http`
Expand All @@ -597,6 +599,8 @@ prometheus:
additionalLabels: {}
# -- List of expressions that define custom relabeling rules for metric server podMonitor crd (prometheus operator)
relabelings: []
# -- List of expressions that define custom metric relabeling rules for metric server PodMonitor crd after scrape has happened (prometheus operator). [RelabelConfig Spec]
metricRelabelings: []
operator:
# -- Enable KEDA Operator prometheus metrics expose
enabled: false
Expand Down Expand Up @@ -624,6 +628,8 @@ prometheus:
relabellings: []
# -- List of expressions that define custom relabeling rules for metric server ServiceMonitor crd (prometheus operator). [RelabelConfig Spec]
relabelings: []
# -- List of expressions that define custom metric relabeling rules for metric server ServiceMonitor crd after scrape has happened (prometheus operator). [RelabelConfig Spec]
metricRelabelings: []
# -- Additional labels to add for metric server using ServiceMonitor crd (prometheus operator)
additionalLabels: {}
# -- HTTP scheme used for scraping. Defaults to `http`
Expand All @@ -647,6 +653,8 @@ prometheus:
additionalLabels: {}
# -- List of expressions that define custom relabeling rules for KEDA Operator podMonitor crd (prometheus operator)
relabelings: []
# -- List of expressions that define custom metric relabeling rules for metric server PodMonitor crd after scrape has happened (prometheus operator). [RelabelConfig Spec]
metricRelabelings: []
prometheusRules:
# -- Enables PrometheusRules creation for the Prometheus Operator
enabled: false
Expand Down Expand Up @@ -690,6 +698,8 @@ prometheus:
relabellings: []
# -- List of expressions that define custom relabeling rules for metric server ServiceMonitor crd (prometheus operator). [RelabelConfig Spec]
relabelings: []
# -- List of expressions that define custom metric relabeling rules for metric server ServiceMonitor crd after scrape has happened (prometheus operator). [RelabelConfig Spec]
metricRelabelings: []
# -- Additional labels to add for metric server using ServiceMonitor crd (prometheus operator)
additionalLabels: {}
# -- HTTP scheme used for scraping. Defaults to `http`
Expand Down Expand Up @@ -765,4 +775,4 @@ extraObjects: []
# provider: aws-eks

# -- Capability to turn on/off ASCII art in Helm installation notes
asciiArt: true
asciiArt: true
Loading