Skip to content
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
5 changes: 5 additions & 0 deletions .changeset/PR-80.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"helm-charts": patch
---

feat: support set replica and resources for otel-collector
12 changes: 11 additions & 1 deletion charts/hdx-oss-v2/templates/otel-collector-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
{{- include "hdx-oss.labels" . | nindent 4 }}
app: otel-collector
spec:
replicas: 1
replicas: {{ .Values.otel.replicas | default 1 }}
selector:
matchLabels:
{{- include "hdx-oss.selectorLabels" . | nindent 6 }}
Expand All @@ -17,6 +17,12 @@ spec:
labels:
{{- include "hdx-oss.selectorLabels" . | nindent 8 }}
app: otel-collector
annotations:
{{- if .Values.otel.annotations }}
{{- with .Values.otel.annotations }}
{{- toYaml . | nindent 8 }}
{{- end -}}
{{- end }}
spec:
{{- if .Values.otel.nodeSelector }}
nodeSelector:
Expand All @@ -36,6 +42,10 @@ spec:
- containerPort: {{ .Values.otel.grpcPort }}
- containerPort: {{ .Values.otel.httpPort }}
- containerPort: {{ .Values.otel.healthPort }}
{{- if .Values.otel.resources }}
resources:
{{- toYaml .Values.otel.resources | nindent 12 }}
{{- end }}
env:
- name: CLICKHOUSE_ENDPOINT
value: "{{ .Values.otel.clickhouseEndpoint | default (printf "tcp://%s-clickhouse:%v?dial_timeout=10s" (include "hdx-oss.fullname" .) .Values.clickhouse.nativePort) }}"
Expand Down
175 changes: 174 additions & 1 deletion charts/hdx-oss-v2/tests/otel-collector_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ tests:
- documentIndex: 1
isKind:
of: Service

- it: should not render otel collector when disabled
set:
otel:
Expand Down Expand Up @@ -513,3 +513,176 @@ tests:
path: spec.template.spec.containers[0].env
content:
name: CUSTOM_VAR

- it: should use default replica count 1 when not specified
set:
otel:
enabled: true
image:
repository: hyperdx/hyperdx-otel-collector
tag: 2-beta
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.replicas
value: 1

- it: should use custom replica count when specified
set:
otel:
enabled: true
replicas: 5
image:
repository: hyperdx/hyperdx-otel-collector
tag: 2-beta
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.replicas
value: 5

- it: should not render resources when not specified
set:
otel:
enabled: true
image:
repository: hyperdx/hyperdx-otel-collector
tag: 2-beta
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
isNull:
path: spec.template.spec.containers[0].resources

- it: should render resources when specified
set:
otel:
enabled: true
image:
repository: hyperdx/hyperdx-otel-collector
tag: 2-beta
resources:
limits:
memory: "512Mi"
cpu: "500m"
requests:
memory: "256Mi"
cpu: "250m"
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[0].resources
value:
limits:
memory: "512Mi"
cpu: "500m"
requests:
memory: "256Mi"
cpu: "250m"

- it: should render only limits when requests not specified
set:
otel:
enabled: true
image:
repository: hyperdx/hyperdx-otel-collector
tag: 2-beta
resources:
limits:
memory: "1Gi"
cpu: "1000m"
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[0].resources
value:
limits:
memory: "1Gi"
cpu: "1000m"

- it: should render only requests when limits not specified
set:
otel:
enabled: true
image:
repository: hyperdx/hyperdx-otel-collector
tag: 2-beta
resources:
requests:
memory: "128Mi"
cpu: "100m"
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.containers[0].resources
value:
requests:
memory: "128Mi"
cpu: "100m"

- it: should render annotations when specified
set:
otel:
enabled: true
image:
repository: hyperdx/hyperdx-otel-collector
tag: 2-beta
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "8888"
prometheus.io/path: "/metrics"
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.metadata.annotations
value:
prometheus.io/scrape: "true"
prometheus.io/port: "8888"
prometheus.io/path: "/metrics"

- it: should render multiple annotations correctly
set:
otel:
enabled: true
image:
repository: hyperdx/hyperdx-otel-collector
tag: 2-beta
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "8888"
checksum/config: "abcdef1234567890"
deployment.kubernetes.io/revision: "1"
sidecar.istio.io/inject: "false"
asserts:
- documentIndex: 0
isKind:
of: Deployment
- documentIndex: 0
isSubset:
path: spec.template.metadata.annotations
content:
prometheus.io/scrape: "true"
prometheus.io/port: "8888"
checksum/config: "abcdef1234567890"
deployment.kubernetes.io/revision: "1"
sidecar.istio.io/inject: "false"
20 changes: 16 additions & 4 deletions charts/hdx-oss-v2/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ hyperdx:
# Endpoint to send hyperdx logs/traces/metrics to.Defaults to the chart's otel collector endpoint.
otelExporterEndpoint: http://{{ include "hdx-oss.fullname" . }}-otel-collector:{{ .Values.otel.httpPort }}
mongoUri: mongodb://{{ include "hdx-oss.fullname" . }}-mongodb:{{ .Values.mongodb.port }}/hyperdx

# Pod-level annotations (applied to the deployment pods)
annotations: {}
# myAnnotation: "myValue"
# Pod-level labels (applied to the deployment pods)

# Pod-level labels (applied to the deployment pods)
labels: {}
# myLabel: "myValue"
env: []
Expand Down Expand Up @@ -238,7 +238,7 @@ clickhouse:
# operator: "Equal"
# value: "value1"
# effect: "NoSchedule"

# Service configuration
service:
type: ClusterIP # Use ClusterIP for security. For external access, use ingress with proper TLS and authentication
Expand Down Expand Up @@ -275,6 +275,18 @@ otel:
repository: docker.hyperdx.io/hyperdx/hyperdx-otel-collector
tag:
pullPolicy: IfNotPresent
replicas: 1
resources: {}
# Example:
# requests:
# memory: "127Mi"
# cpu: "100m"
# limits:
# memory: "256Mi"
# cpu: "200m"
# Pod-level annotations (applied to the deployment pods)
annotations: {}
# myAnnotation: "myValue"
# Add nodeSelector and tolerations for otel-collector service
nodeSelector: {}
# Example:
Expand Down