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 hpa for tracing #3159

Merged
merged 2 commits into from
Jul 24, 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
1 change: 1 addition & 0 deletions .changelog/3159.changed.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
feat: add hpa for traces-gateway and otelcol-instrumentation
12 changes: 11 additions & 1 deletion deploy/helm/sumologic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,12 @@ The following table lists the configurable parameters of the Sumo Logic chart an
| `opentelemetry-operator.instrumentationJobImage.image.tag` | Name of the image tag used to apply Instrumentation resource | `2.14.0` |
| `opentelemetry-operator.admissionWebhooks` | Admission webhooks make sure only requests with correctly formatted rules will get into the Operator. They also enable the sidecar injection for OpenTelemetryCollector and Instrumentation CR's. | See [values.yaml] |
| `opentelemetry-operator.manager.env` | Additional environment variables for opentelemetry-operator helm chart. | `Nil` |
| `otelcolInstrumentation.enabled` | Enables Sumo OTel Distro Collector StatefulSet to collect telemetry data. [See docs for more information.](/docs/opentelemetry-collector.md#traces) | `true` |
| `otelcolInstrumentation.enabled` | Enables Sumo Otel Distro Collector StatefulSet to collect telemetry data. [See docs for more information.](/docs/opentelemetry-collector.md#traces) | `true` |
| `otelcolInstrumentation.autoscaling.enabled` | Option to turn autoscaling on for Sumo Otel Distro Collector StatefulSet and specify params for HPA. Autoscaling needs metrics-server to access cpu metrics. | `false` |
| `otelcolInstrumentation.autoscaling.minReplicas` | Default min replicas for autoscaling. | `3` |
| `otelcolInstrumentation.autoscaling.maxReplicas` | Default max replicas for autoscaling | `10` |
| `otelcolInstrumentation.autoscaling.targetCPUUtilizationPercentage` | The desired target CPU utilization for autoscaling. | `100` |
| `otelcolInstrumentation.autoscaling.targetMemoryUtilizationPercentage` | The desired target memory utilization for autoscaling. | `50` |
| `otelcolInstrumentation.statefulset.replicaCount` | Set the number of otelcol-instrumentation replicasets. | `3` |
| `otelcolInstrumentation.statefulset.nodeSelector` | Node selector for otelcol-instrumentation statefulset. [See docs/best-practices.md for more information.](/docs/best-practices.md) | `{}` |
| `otelcolInstrumentation.statefulset.priorityClassName` | Priority class name for otelcol-instrumentation pods. | If not provided then set to `RELEASE-NAME-sumologic-priorityclass`. |
Expand Down Expand Up @@ -477,6 +482,11 @@ The following table lists the configurable parameters of the Sumo Logic chart an
| `otelcolInstrumentation.statefulset.containers.otelcol.readinessProbe` | Readiness probe settings for the otelcol-instrumentation container. | `{"initialDelaySeconds": 5, "periodSeconds": 10, "timeoutSeconds": 3, "failureThreshold": 3}` |
| `otelcolInstrumentation.statefulset.containers.otelcol.securityContext` | The securityContext configuration for the otelcol-instrumentation container. | `{}` |
| `tracesGateway.enabled` | Flag to control deploying traces-gateway. [See docs for more information.](/docs/opentelemetry-collector.md#traces) | `true` |
| `tracesGateway.autoscaling.enabled` | Option to turn autoscaling on for traces-gateway and specify params for HPA. Autoscaling needs metrics-server to access cpu metrics. | `false` |
| `tracesGateway.autoscaling.minReplicas` | Default min replicas for autoscaling. | `3` |
| `tracesGateway.autoscaling.maxReplicas` | Default max replicas for autoscaling | `10` |
| `tracesGateway.autoscaling.targetCPUUtilizationPercentage` | The desired target CPU utilization for autoscaling. | `100` |
| `tracesGateway.autoscaling.targetMemoryUtilizationPercentage` | The desired target memory utilization for autoscaling. | `50` |
| `tracesGateway.deployment.replicas` | Set the number of OpenTelemetry Collector replicas. | `1` |
| `tracesGateway.deployment.nodeSelector` | Node selector for otelcol deployment. [See docs/best-practices.md for more information.](/docs/best-practices.md) | `{}` |
| `tracesGateway.deployment.priorityClassName` | Priority class name for OpenTelemetry Collector log pods. | `Nil` |
Expand Down
16 changes: 16 additions & 0 deletions deploy/helm/sumologic/templates/_helpers/_traces.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
{{- template "sumologic.labels.app.otelcolinstrumentation" . }}
{{- end -}}

{{- define "sumologic.labels.app.otelcolinstrumentation.hpa" -}}
{{- template "sumologic.labels.app.otelcolinstrumentation" . }}
{{- end -}}

{{- define "sumologic.labels.app.otelcolinstrumentation.service" -}}
{{- template "sumologic.labels.app.otelcolinstrumentation" . }}
{{- end -}}
Expand All @@ -62,6 +66,10 @@
{{- template "sumologic.labels.app.tracesgateway" . }}
{{- end -}}

{{- define "sumologic.labels.app.tracesgateway.hpa" -}}
{{- template "sumologic.labels.app.tracesgateway" . }}
{{- end -}}

{{- define "sumologic.labels.app.tracesgateway.service" -}}
{{- template "sumologic.labels.app.tracesgateway" . }}
{{- end -}}
Expand Down Expand Up @@ -118,6 +126,10 @@
{{ template "sumologic.metadata.name.otelcolinstrumentation" . }}
{{- end -}}

{{- define "sumologic.metadata.name.otelcolinstrumentation.hpa" -}}
{{ template "sumologic.metadata.name.otelcolinstrumentation" . }}
{{- end -}}

{{- define "sumologic.metadata.name.tracesgateway" -}}
{{ template "sumologic.fullname" . }}-traces-gateway
{{- end -}}
Expand All @@ -134,6 +146,10 @@
{{ template "sumologic.metadata.name.tracesgateway" . }}
{{- end -}}

{{- define "sumologic.metadata.name.tracesgateway.hpa" -}}
{{ template "sumologic.metadata.name.tracesgateway" . }}
{{- end -}}

{{- define "sumologic.labels.instrumentation.component" -}}
sumologic.com/component: instrumentation
{{- end -}}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{{ $otelcolInstrumentation := .Values.otelcolInstrumentation }}
{{ $tracesEnabled := .Values.sumologic.traces.enabled }}
{{- if and $tracesEnabled $otelcolInstrumentation.enabled $otelcolInstrumentation.autoscaling.enabled }}
{{- if and (eq .Capabilities.KubeVersion.Major "1") (lt (int (include "kubernetes.minor" .)) 23) }}
apiVersion: autoscaling/v2beta2
{{- else }}
apiVersion: autoscaling/v2
{{- end }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ template "sumologic.metadata.name.otelcolinstrumentation.hpa" . }}
namespace: {{ template "sumologic.namespace" . }}
labels:
app: {{ template "sumologic.labels.app.otelcolinstrumentation.hpa" . }}
{{- include "sumologic.labels.common" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: StatefulSet
name: {{ template "sumologic.metadata.name.otelcolinstrumentation.statefulset" . }}
minReplicas: {{ $otelcolInstrumentation.autoscaling.minReplicas }}
maxReplicas: {{ $otelcolInstrumentation.autoscaling.maxReplicas }}
metrics:
{{- if $otelcolInstrumentation.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ $otelcolInstrumentation.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ $otelcolInstrumentation.autoscaling.targetCPUUtilizationPercentage }}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ spec:
app: {{ template "sumologic.labels.app.otelcolinstrumentation.pod" . }}
serviceName: {{ template "sumologic.metadata.name.otelcolinstrumentation.service" . }}
podManagementPolicy: "Parallel"
{{- if not $otelcolInstrumentation.autoscaling.enabled }}
replicas: {{ $otelcolInstrumentation.statefulset.replicaCount }}
{{- end }}
template:
metadata:
annotations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ metadata:
{{- include "sumologic.labels.common" . | nindent 4 }}
spec:
minReadySeconds: 5
{{- if not $tracesGateway.autoscaling.enabled }}
replicas: {{ $tracesGateway.deployment.replicas }}
{{- end }}
selector:
matchLabels:
app: {{ template "sumologic.labels.app.tracesgateway.pod" . }}
Expand Down
Loading
Loading