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

Fix servicemonitor relabeling #456

Merged
merged 2 commits into from
Jun 8, 2023
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
23 changes: 19 additions & 4 deletions .github/workflows/ci-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:

- name: Helm install
uses: Azure/setup-helm@v3

- name: Create k8s ${{ matrix.kubernetesVersion }} Kind Cluster
uses: helm/kind-action@main
with:
Expand All @@ -88,9 +88,9 @@ jobs:
image:
keda:
tag: main
metricsApiServer:
metricsApiServer:
tag: main
webhooks:
webhooks:
tag: main
podIdentity:
azureWorkload:
Expand All @@ -99,7 +99,7 @@ jobs:
clientId: ${{ matrix.clientId }}
podDisruptionBudget:
operator:
maxUnavailable: 1
maxUnavailable: 1
metricServer:
maxUnavailable: 1
webhooks:
Expand All @@ -109,10 +109,25 @@ jobs:
enabled: true
podMonitor:
enabled: true
serviceMonitor:
enabled: true
relabelings:
- regex: (go_.*)
action: drop
webhooks:
enabled: true
serviceMonitor:
enabled: true
relabelings:
- regex: (go_.*)
action: drop
metricServer:
enabled: true
serviceMonitor:
enabled: true
relabelings:
- regex: (go_.*)
action: drop
webhooks:
failurePolicy: Fail
certificates:
Expand Down
9 changes: 6 additions & 3 deletions keda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ their default values.
| `prometheus.metricServer.serviceMonitor.targetPort` | Name or number of the target port of the Pod behind the Service, the port must be specified with container port property. Mutually exclusive with port | `` |
| `prometheus.metricServer.serviceMonitor.interval` | Interval at which metrics should be scraped If not specified Prometheus’ global scrape interval is used. | `` |
| `prometheus.metricServer.serviceMonitor.scrapeTimeout` | Timeout after which the scrape is ended If not specified, the Prometheus global scrape timeout is used unless it is less than Interval in which the latter is used | `` |
| `prometheus.metricServer.serviceMonitor.relabellings` | List of expressions that define custom relabeling rules for metric server ServiceMonitor crd (prometheus operator). [RelabelConfig Spec](https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#monitoring.coreos.com/v1.RelabelConfig) | `[]` |
| `prometheus.metricServer.serviceMonitor.relabellings` | DEPRECATED. List of expressions that define custom relabeling rules for metric server ServiceMonitor crd (prometheus operator). [RelabelConfig Spec](https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#monitoring.coreos.com/v1.RelabelConfig) | `[]` |
| `prometheus.metricServer.serviceMonitor.relabelings` | List of expressions that define custom relabeling rules for metric server ServiceMonitor crd (prometheus operator). [RelabelConfig Spec](https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#monitoring.coreos.com/v1.RelabelConfig) | `[]` |
| `prometheus.metricServer.serviceMonitor.additionalLabels` | Additional labels to add for metric server using ServiceMonitor crd (prometheus operator) | `{}` |
| `prometheus.operator.enabled` | Enable KEDA Operator prometheus metrics expose | `false` |
| `prometheus.operator.port` | Port used for exposing KEDA Operator prometheus metrics | `8080` |
Expand All @@ -180,7 +181,8 @@ their default values.
| `prometheus.operator.serviceMonitor.targetPort` | Name or number of the target port of the Pod behind the Service, the port must be specified with container port property. Mutually exclusive with port | `` |
| `prometheus.operator.serviceMonitor.interval` | Interval at which metrics should be scraped If not specified Prometheus’ global scrape interval is used. | `` |
| `prometheus.operator.serviceMonitor.scrapeTimeout` | Timeout after which the scrape is ended If not specified, the Prometheus global scrape timeout is used unless it is less than Interval in which the latter is used | `` |
| `prometheus.operator.serviceMonitor.relabellings` | List of expressions that define custom relabeling rules for metric server ServiceMonitor crd (prometheus operator). [RelabelConfig Spec](https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#monitoring.coreos.com/v1.RelabelConfig) | `[]` |
| `prometheus.operator.serviceMonitor.relabellings` | DEPRECATED. List of expressions that define custom relabeling rules for metric server ServiceMonitor crd (prometheus operator). [RelabelConfig Spec](https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#monitoring.coreos.com/v1.RelabelConfig) | `[]` |
| `prometheus.operator.serviceMonitor.relabelings` | List of expressions that define custom relabeling rules for metric server ServiceMonitor crd (prometheus operator). [RelabelConfig Spec](https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#monitoring.coreos.com/v1.RelabelConfig) | `[]` |
| `prometheus.operator.serviceMonitor.additionalLabels` | Additional labels to add for metric server using ServiceMonitor crd (prometheus operator) | `{}` |
| `prometheus.operator.prometheusRules.enabled` | Enable monitoring for KEDA Operator using prometheusRules crd (prometheus operator) | `false` |
| `prometheus.operator.prometheusRules.namespace` | Scraping namespace for KEDA Operator using prometheusRules crd (prometheus operator) | `` |
Expand All @@ -197,7 +199,8 @@ their default values.
| `prometheus.webhooks.serviceMonitor.targetPort` | Name or number of the target port of the Pod behind the Service, the port must be specified with container port property. Mutually exclusive with port | `` |
| `prometheus.webhooks.serviceMonitor.interval` | Interval at which metrics should be scraped If not specified Prometheus’ global scrape interval is used. | `` |
| `prometheus.webhooks.serviceMonitor.scrapeTimeout` | Timeout after which the scrape is ended If not specified, the Prometheus global scrape timeout is used unless it is less than Interval in which the latter is used | `` |
| `prometheus.webhooks.serviceMonitor.relabellings` | List of expressions that define custom relabeling rules for metric server ServiceMonitor crd (prometheus operator). [RelabelConfig Spec](https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#monitoring.coreos.com/v1.RelabelConfig) | `[]` |
| `prometheus.webhooks.serviceMonitor.relabellings` | DEPRECATED. List of expressions that define custom relabeling rules for metric server ServiceMonitor crd (prometheus operator). [RelabelConfig Spec](https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#monitoring.coreos.com/v1.RelabelConfig) | `[]` |
| `prometheus.webhooks.serviceMonitor.relabelings` | List of expressions that define custom relabeling rules for metric server ServiceMonitor crd (prometheus operator). [RelabelConfig Spec](https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#monitoring.coreos.com/v1.RelabelConfig) | `[]` |
| `prometheus.webhooks.serviceMonitor.additionalLabels` | Additional labels to add for metric server using ServiceMonitor crd (prometheus operator) | `{}` |
| `prometheus.webhooks.prometheusRules.enabled` | Enable monitoring for KEDA admission webhooks using prometheusRules crd (prometheus operator) | `false` |
| `prometheus.webhooks.prometheusRules.namespace` | Scraping namespace for KEDA admission webhooks using prometheusRules crd (prometheus operator) | `` |
Expand Down
15 changes: 11 additions & 4 deletions keda/templates/manager/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ spec:
{{- end }}
{{- with .Values.prometheus.operator.serviceMonitor.targetLabels }}
targetLabels:
{{ toYaml . | indent 4 }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.prometheus.operator.serviceMonitor.podTargetLabels }}
podTargetLabels:
{{ toYaml . | indent 4 }}
{{- toYaml . | nindent 4 }}
{{- end }}
endpoints:
- port: {{ .Values.prometheus.operator.serviceMonitor.port }}
Expand All @@ -38,10 +38,17 @@ spec:
{{- with .Values.prometheus.operator.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
{{- with .Values.prometheus.operator.serviceMonitor.relabellings }}
{{- if .Values.prometheus.metricServer.serviceMonitor.relabelings}}
{{- with .Values.prometheus.metricServer.serviceMonitor.relabelings }}
relabelings:
{{ toYaml . | indent 6 }}
{{- toYaml . | nindent 6 }}
{{- end }}
{{- else }}
{{- with .Values.prometheus.metricServer.serviceMonitor.relabellings }}
relabelings:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- end}}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
Expand Down
13 changes: 10 additions & 3 deletions keda/templates/metrics-server/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ spec:
{{- end }}
{{- with .Values.prometheus.metricServer.serviceMonitor.targetLabels }}
targetLabels:
{{ toYaml . | indent 4 }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.prometheus.metricServer.serviceMonitor.podTargetLabels }}
podTargetLabels:
{{ toYaml . | indent 4 }}
{{- toYaml . | nindent 4 }}
{{- end }}
endpoints:
- port: {{ .Values.prometheus.metricServer.portName }}
Expand All @@ -38,10 +38,17 @@ spec:
{{- with .Values.prometheus.metricServer.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
{{- if .Values.prometheus.metricServer.serviceMonitor.relabelings}}
{{- with .Values.prometheus.metricServer.serviceMonitor.relabelings }}
relabelings:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- else }}
{{- with .Values.prometheus.metricServer.serviceMonitor.relabellings }}
relabelings:
{{ toYaml . | indent 6 }}
{{- toYaml . | nindent 6 }}
{{- end }}
{{- end}}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
Expand Down
17 changes: 12 additions & 5 deletions keda/templates/webhooks/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ spec:
{{- end }}
{{- with .Values.prometheus.webhooks.serviceMonitor.targetLabels }}
targetLabels:
{{ toYaml . | indent 4 }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.prometheus.webhooks.serviceMonitor.podTargetLabels }}
podTargetLabels:
{{ toYaml . | indent 4 }}
{{- toYaml . | nindent 4 }}
{{- end }}
endpoints:
- port: {{ .Values.prometheus.webhooks.serviceMonitor.port }}
Expand All @@ -39,15 +39,22 @@ spec:
{{- with .Values.prometheus.webhooks.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
{{- with .Values.prometheus.webhooks.serviceMonitor.relabellings }}
{{- if .Values.prometheus.metricServer.serviceMonitor.relabelings}}
{{- with .Values.prometheus.metricServer.serviceMonitor.relabelings }}
relabelings:
{{ toYaml . | indent 6 }}
{{- toYaml . | nindent 6 }}
{{- end }}
{{- else }}
{{- with .Values.prometheus.metricServer.serviceMonitor.relabellings }}
relabelings:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- end}}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
app.kubernetes.io/name: {{ .Values.webhooks.name }}
{{- end }}
{{- end }}
{{- end }}
9 changes: 6 additions & 3 deletions keda/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,8 @@ prometheus:
targetPort:
interval:
scrapeTimeout:
relabellings: []
relabellings: [] # DEPRECATED, use relabelings
relabelings: []
additionalLabels: {}
podMonitor:
# Enables PodMonitor creation for the Prometheus Operator
Expand All @@ -398,7 +399,8 @@ prometheus:
targetPort:
interval:
scrapeTimeout:
relabellings: []
relabellings: [] # DEPRECATED, use relabelings
relabelings: []
additionalLabels: {}
podMonitor:
# Enables PodMonitor creation for the Prometheus Operator
Expand Down Expand Up @@ -435,7 +437,8 @@ prometheus:
targetPort:
interval:
scrapeTimeout:
relabellings: []
relabellings: [] # DEPRECATED, use relabelings
relabelings: []
additionalLabels: {}
prometheusRules:
# Enables PrometheusRules creation for the Prometheus Operator
Expand Down