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

Support profiling for keda components #549

Merged
merged 5 commits into from
Nov 2, 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
28 changes: 11 additions & 17 deletions keda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,17 @@ their default values.
| `prometheus.webhooks.serviceMonitor.targetLabels` | list | `[]` | TargetLabels transfers labels from the Kubernetes `Service` onto the created metrics |
| `prometheus.webhooks.serviceMonitor.targetPort` | string | `""` | 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 |

### Troubleshooting

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `profiling.metricsServer.enabled` | bool | `false` | Enable profiling for KEDA metrics server |
| `profiling.metricsServer.port` | int | `8083` | Expose profiling on a specific port |
| `profiling.operator.enabled` | bool | `false` | Enable profiling for KEDA operator |
| `profiling.operator.port` | int | `8082` | Expose profiling on a specific port |
| `profiling.webhooks.enabled` | bool | `false` | Enable profiling for KEDA admission webhook |
| `profiling.webhooks.port` | int | `8084` | Expose profiling on a specific port |

### Admission Webhooks

| Parameter | Type | Default | Description |
Expand All @@ -244,23 +255,6 @@ their default values.
| `podDisruptionBudget.webhooks` | object | `{}` | Capability to configure [Pod Disruption Budget] |
| `podLabels.webhooks` | object | `{}` | Pod labels for KEDA Admission webhooks |
| `podSecurityContext.webhooks` | object | [See below](#KEDA-is-secure-by-default) | [Pod security context] of the KEDA admission webhooks |
| `prometheus.webhooks.enabled` | bool | `false` | Enable KEDA admission webhooks prometheus metrics expose |
zroubalik marked this conversation as resolved.
Show resolved Hide resolved
| `prometheus.webhooks.port` | int | `8080` | Port used for exposing KEDA admission webhooks prometheus metrics |
| `prometheus.webhooks.prometheusRules.additionalLabels` | object | `{}` | Additional labels to add for KEDA admission webhooks using prometheusRules crd (prometheus operator) |
| `prometheus.webhooks.prometheusRules.alerts` | list | `[]` | Additional alerts to add for KEDA admission webhooks using prometheusRules crd (prometheus operator) |
| `prometheus.webhooks.prometheusRules.enabled` | bool | `false` | Enables PrometheusRules creation for the Prometheus Operator |
| `prometheus.webhooks.prometheusRules.namespace` | string | `""` | Scraping namespace for KEDA admission webhooks using prometheusRules crd (prometheus operator) |
| `prometheus.webhooks.serviceMonitor.additionalLabels` | object | `{}` | Additional labels to add for metric server using ServiceMonitor crd (prometheus operator) |
| `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.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] |
| `prometheus.webhooks.serviceMonitor.relabellings` | list | `[]` | DEPRECATED. List of expressions that define custom relabeling rules for metric server ServiceMonitor crd (prometheus operator). [RelabelConfig Spec] |
| `prometheus.webhooks.serviceMonitor.scrapeTimeout` | string | `""` | 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.targetLabels` | list | `[]` | TargetLabels transfers labels from the Kubernetes `Service` onto the created metrics |
| `prometheus.webhooks.serviceMonitor.targetPort` | string | `""` | 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 |
| `resources.webhooks` | object | `{"limits":{"cpu":"50m","memory":"100Mi"},"requests":{"cpu":"10m","memory":"10Mi"}}` | Manage [resource request & limits] of KEDA admission webhooks pod |
| `securityContext.webhooks` | object | [See below](#KEDA-is-secure-by-default) | [Security context] of the admission webhooks container |
| `topologySpreadConstraints.webhooks` | list | `[]` | [Pod Topology Constraints] of KEDA admission webhooks pod |
Expand Down
16 changes: 13 additions & 3 deletions keda/README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ their default values.
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
{{- range .Values }}
{{- if and (or (contains "operator" .Key) (contains "keda" .Key)) (not (or (contains "opentelemetry" .Key) (contains "prometheus" .Key))) }}
{{- if and (or (contains "operator" .Key) (contains "keda" .Key)) (not (or (contains "opentelemetry" .Key) (contains "prometheus" .Key) (contains "profiling" .Key))) }}
| `{{ .Key }}` | {{ .Type }} | {{ if .Default }}{{ .Default }}{{ else }}{{ .AutoDefault }}{{ end }} | {{ if .Description }}{{ .Description }}{{ else }}{{ .AutoDescription }}{{ end }} |
{{- end }}
{{- end }}
Expand All @@ -79,7 +79,7 @@ their default values.
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
{{- range .Values }}
{{- if and (or (contains "metricServer" .Key) (contains "metricsServer" .Key) (contains "metricsApiServer" .Key) (contains "metricsAdapter" .Key) (hasPrefix "service." .Key)) (not (or (contains "opentelemetry" .Key) (contains "prometheus" .Key)))}}
{{- if and (or (contains "metricServer" .Key) (contains "metricsServer" .Key) (contains "metricsApiServer" .Key) (contains "metricsAdapter" .Key) (hasPrefix "service." .Key)) (not (or (contains "opentelemetry" .Key) (contains "prometheus" .Key) (contains "profiling" .Key)))}}
| `{{ .Key }}` | {{ .Type }} | {{ if .Default }}{{ .Default }}{{ else }}{{ .AutoDefault }}{{ end }} | {{ if .Description }}{{ .Description }}{{ else }}{{ .AutoDescription }}{{ end }} |
{{- end }}
{{- end }}
Expand All @@ -94,12 +94,22 @@ their default values.
{{- end }}
{{- end }}

### Troubleshooting

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
{{- range .Values }}
{{- if (contains "profiling" .Key) }}
| `{{ .Key }}` | {{ .Type }} | {{ if .Default }}{{ .Default }}{{ else }}{{ .AutoDefault }}{{ end }} | {{ if .Description }}{{ .Description }}{{ else }}{{ .AutoDescription }}{{ end }} |
{{- end }}
{{- end }}

### Admission Webhooks

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
{{- range .Values }}
{{- if contains "webhooks" .Key }}
{{- if and (contains "webhooks" .Key) (not (or (contains "opentelemetry" .Key) (contains "prometheus" .Key) (contains "profiling" .Key))) }}
| `{{ .Key }}` | {{ .Type }} | {{ if .Default }}{{ .Default }}{{ else }}{{ .AutoDefault }}{{ end }} | {{ if .Description }}{{ .Description }}{{ else }}{{ .AutoDescription }}{{ end }} |
{{- end }}
{{- end }}
Expand Down
3 changes: 3 additions & 0 deletions keda/templates/manager/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ spec:
{{- if .Values.opentelemetry.operator.enabled }}
- "--enable-opentelemetry-metrics={{ .Values.opentelemetry.operator.enabled}}"
{{- end }}
{{- if .Values.profiling.operator.enabled }}
- "--profiling-bind-address=:{{ .Values.profiling.operator.port }}"
{{- end }}
{{- range $key, $value := .Values.extraArgs.keda }}
- "--{{ $key }}={{ $value }}"
{{- end }}
Expand Down
5 changes: 5 additions & 0 deletions keda/templates/manager/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,10 @@ spec:
port: {{ .Values.prometheus.operator.port }}
targetPort: {{ .Values.prometheus.operator.port }}
{{- end }}
{{- if .Values.profiling.operator.enabled }}
- name: profiling
port: {{ .Values.profiling.operator.port }}
targetPort: {{ .Values.profiling.operator.port }}
{{- end }}
selector:
app: {{ .Values.operator.name }}
3 changes: 3 additions & 0 deletions keda/templates/metrics-server/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ spec:
- --tls-private-key-file={{ .Values.certificates.mountPath }}/tls.key
- --cert-dir={{ .Values.certificates.mountPath }}
- --v={{ .Values.logging.metricServer.level }}
{{- if .Values.profiling.metricsServer.enabled }}
- "--profiling-bind-address=:{{ .Values.profiling.metricsServer.port }}"
{{- end }}
{{- range $key, $value := .Values.extraArgs.metricsAdapter }}
- --{{ $key }}={{ $value }}
{{- end }}
Expand Down
6 changes: 6 additions & 0 deletions keda/templates/metrics-server/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,11 @@ spec:
port: {{ .Values.prometheus.metricServer.port }}
targetPort: {{ .Values.prometheus.metricServer.port }}
protocol: TCP
{{- if .Values.profiling.metricsServer.enabled }}
- name: profiling
port: {{ .Values.profiling.metricsServer.port }}
targetPort: {{ .Values.profiling.metricsServer.port }}
protocol: TCP
{{- end }}
selector:
app: {{ .Values.operator.name }}-metrics-apiserver
3 changes: 3 additions & 0 deletions keda/templates/webhooks/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ spec:
- "--port={{ .Values.webhooks.port }}"
{{- end }}
- --metrics-bind-address=:{{ .Values.prometheus.webhooks.port }}
{{- if .Values.profiling.webhooks.enabled }}
- "--profiling-bind-address=:{{ .Values.profiling.webhooks.port }}"
{{- end }}
{{- range $key, $value := .Values.extraArgs.webhooks }}
- --{{ $key }}={{ $value }}
{{- end }}
Expand Down
5 changes: 5 additions & 0 deletions keda/templates/webhooks/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ spec:
port: {{ .Values.prometheus.webhooks.port }}
targetPort: {{ .Values.prometheus.webhooks.port }}
{{- end }}
{{- if .Values.profiling.webhooks.enabled }}
- name: profiling
port: {{ .Values.profiling.webhooks.port }}
targetPort: {{ .Values.profiling.webhooks.port }}
{{- end }}
selector:
app: {{ .Values.webhooks.name }}
{{- end }}
21 changes: 21 additions & 0 deletions keda/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,27 @@ http:
# -- The minimum TLS version to use for all scalers that use raw HTTP clients (some scalers use SDKs to access target services. These have built-in HTTP clients, and this value does not necessarily apply to them)
minTlsVersion: TLS12

## This setting lets you enable profiling for all of the components of KEDA and in the specific port you choose
## This can be useful when trying to investigate errors like memory leaks or CPU or even look at goroutines to understand better
## This setting is disabled by default
profiling:
operator:
# -- Enable profiling for KEDA operator
enabled: false
# -- Expose profiling on a specific port
port: 8082
metricsServer:
# -- Enable profiling for KEDA metrics server
enabled: false
# -- Expose profiling on a specific port
port: 8083
webhooks:
# -- Enable profiling for KEDA admission webhook
enabled: false
# -- Expose profiling on a specific port
port: 8084


## Extra KEDA Operator and Metrics Adapter container arguments
extraArgs:
# -- Additional KEDA Operator container arguments
Expand Down
Loading