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 autoscaling SigNoz OtelCollector using KEDA prometheus trigger #161

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
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: 5 additions & 2 deletions charts/signoz/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@ dependencies:
- name: keycloak
repository: https://charts.bitnami.com/bitnami
version: 10.1.5
digest: sha256:7e783326354b1036fdf23d8a1f7b0a2aaaaf913e26a61e166b223a24e50398fd
generated: "2023-02-25T02:08:05.683026+05:30"
- name: keda
repository: https://kedacore.github.io/charts
version: 2.10.1
digest: sha256:f2d37726e7852762a95d8cd51212feb33b25d8663b51957a8e6630e75e8752ca
generated: "2023-03-15T23:34:34.121215+05:45"
4 changes: 4 additions & 0 deletions charts/signoz/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ dependencies:
repository: https://charts.bitnami.com/bitnami
condition: keycloak.enabled
version: 10.1.5
- name: keda
repository: https://kedacore.github.io/charts
condition: keda.enabled
version: 2.10.1
maintainers:
- name: SigNoz
email: [email protected]
Expand Down
Binary file added charts/signoz/charts/keda-2.10.1.tgz
Binary file not shown.
30 changes: 30 additions & 0 deletions charts/signoz/templates/otel-collector/keda-auth.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{- if and .Values.otelCollector.autoscaling.keda.enabled .Values.otelCollector.autoscaling.keda.auth.enabled }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "otelCollector.fullname" . }}-keda-secret
data:
customAuthHeader: {{ .Values.otelCollector.autoscaling.keda.auth.customHeaderName | b64enc }}
customAuthValue: {{ .Values.otelCollector.autoscaling.keda.auth.customHeaderValue | b64enc }}
{{- with .Values.otelCollector.autoscaling.keda.auth.customCA }}
ca: {{ . | b64enc }}
{{- end }}
---
apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
metadata:
name: {{ .Values.otelCollector.autoscaling.keda.auth.triggerAuth }}
spec:
secretTargetRef:
- parameter: customAuthHeader
name: {{ include "otelCollector.fullname" . }}-keda-secret
key: customAuthHeader
- parameter: customAuthValue
name: {{ include "otelCollector.fullname" . }}-keda-secret
key: customAuthValue
{{- if .Values.otelCollector.autoscaling.keda.auth.customCA }}
- parameter: ca
name: {{ include "otelCollector.fullname" . }}-keda-secret
key: ca
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ spec:
triggers:
{{- toYaml . | nindent 4 }}
{{ end }}
{{ end }}
{{- end }}
50 changes: 50 additions & 0 deletions charts/signoz/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -682,15 +682,24 @@ frontend:
autoscalingTemplate: []
keda:
enabled: false
# -- KEDA polling interval in seconds
pollingInterval: "30" # check 30sec periodically for metrics data
# -- KEDA cooldown period in seconds
cooldownPeriod: "300" # once the load decreased, it will wait for 5 min and downscale
# -- KEDA minReplicaCount for HPA to scale down
minReplicaCount: "1" # should be >= replicaCount specified in values.yaml
# -- KEDA maxReplicaCount for HPA to scale up
maxReplicaCount: "5"
# -- KEDA triggers for HPA.
# Ref: https://keda.sh/docs/2.0/scalers
# @default -- See `values.yaml` for defaults
triggers:
# memory type trigger to scale based on memory utilization
- type: memory
metadata:
type: Utilization
value: "80" # hpa make sure average Utilization <=80 by adding new pods
# cpu type trigger to scale based on cpu utilization
- type: cpu
metadata:
type: Utilization
Expand Down Expand Up @@ -1350,19 +1359,51 @@ otelCollector:
autoscalingTemplate: []
keda:
enabled: false
# -- KEDA polling interval in seconds
pollingInterval: "30" # check 30sec periodically for metrics data
# -- KEDA cooldown period in seconds
cooldownPeriod: "300" # once the load decreased, it will wait for 5 min and downscale
# -- KEDA minReplicaCount for HPA to scale down
minReplicaCount: "1" # should be >= replicaCount specified in values.yaml
# -- KEDA maxReplicaCount for HPA to scale up
maxReplicaCount: "5"
# KEDA custom authentication for HPA.
auth:
enabled: false
# -- KEDA trigger authentication name. This should match authentication ref name in prometheus trigger.
triggerAuth: signoz-keda-auth
# -- KEDA header name for authentication.
# In case of SigNoz, we set it to `SIGNOZ-API-KEY`.
customHeaderName: "SIGNOZ-API-KEY"
# -- KEDA header value for authentication.
# In case of SigNoz, we set it to personal access token of an user from SigNoz UI. (Enterprise)
customHeaderValue: "<personal-access-token>"
# might be required if you're using a custom CA
customCA: ""
# -- KEDA triggers for HPA.
# Ref: https://keda.sh/docs/2.0/scalers
# @default -- See `values.yaml` for defaults
triggers:
# memory type trigger to scale based on memory utilization
- type: memory
metadata:
type: Utilization
value: "80" # hpa make sure average Utilization <=80 by adding new pods
# cpu type trigger to scale based on cpu utilization
- type: cpu
metadata:
type: Utilization
value: "80" # hpa make sure average Utlization <=80 by adding new pods
# prometheus type trigger to scale based on prometheus metrics. Enable keda.auth.enabled to use this.
# - type: prometheus
# metadata:
# serverAddress: http://my-release-signoz-query-service.platform.svc.cluster.local:8080
# metricName: total_datapoints
# authModes: custom
# threshold: '10000' # threshold for total number of data points to consider for scaling
# query: sum(rate(otelcol_receiver_accepted_spans{signoz_k8s_component="otel-collector"}[5m]))+sum(rate(otelcol_receiver_accepted_metric_points{signoz_k8s_component="otel-collector"}[5m]))+sum(rate(otelcol_receiver_accepted_log_records{signoz_k8s_component="otel-collector"}[5m]))
# authenticationRef:
# name: signoz-keda-auth

# -- Configurations for OtelCollector
# @default -- See `values.yaml` for defaults
Expand Down Expand Up @@ -2497,3 +2538,12 @@ keycloak:

tls: true
selfSigned: false

###
###
### ---- KEDA ----
###
###
# @ignored
keda:
enabled: false
3 changes: 2 additions & 1 deletion ct.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ chart-repos:
- jetstack=https://charts.jetstack.io
- ingress-nginx=https://kubernetes.github.io/ingress-nginx
- minio=https://charts.min.io
- bitnami=https://charts.bitnami.com/bitnami
- bitnami=https://charts.bitnami.com/bitnami
- kedacore=https://kedacore.github.io/charts