Skip to content

Commit 946fab2

Browse files
kkhandelwal-nrburhan-nraayush-ap
authored
kkhandelwal/ebpf otlp port (#2001)
<!-- Thank you for contributing to New Relic's Helm charts. Before you submit this PR we'd like to make sure you are aware of our technical requirements: * https://github.com/newrelic-experimental/helm-charts/blob/master/CONTRIBUTING.md#technical-requirements For a quick overview across what we will look at reviewing your PR, please read our review guidelines: * https://github.com/newrelic-experimental/helm-charts/blob/master/REVIEW_GUIDELINES.md Following our best practices right from the start will accelerate the review process and help get your PR merged quicker. When updates to your PR are requested, please add new commits and do not squash the history. This will make it easier to identify new changes. The PR will be squashed anyways when it is merged. Thanks. For fast feedback, please @-mention maintainers that are listed in the Chart.yaml file. Please make sure you test your changes before you push them. Once pushed, a Github Action will run across your changes and do some initial checks and linting. These checks run very quickly. Please check the results. We would like these checks to pass before we even continue reviewing your changes. --> #### Is this a new chart No #### What this PR does / why we need it: - Introduce env to configure OTLP port. - Introduce 2 new env's - `APM_DATA_REPORTING` and `TCP_STATS_REPORTING` #### Which issue this PR fixes *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)* - fixes # #### Special notes for your reviewer: #### Checklist [Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.] - [ ] Chart Version bumped - [ ] Variables are documented in the README.md - [ ] Title of the PR starts with chart name (e.g. `[mychartname]`) # Release Notes to Publish (nr-k8s-otel-collector) If this PR contains changes in `nr-k8s-otel-collector`, please complete the following section. All other charts should ignore this section. <!--BEGIN-RELEASE-NOTES--> ## 🚀 What's Changed * Tell the world about the latest changes in the chart. <!--END-RELEASE-NOTES--> --------- Co-authored-by: bsanwarwala <bsanwarwala@newrelic.com> Co-authored-by: Aayush garg <agarg@newrelic.com>
1 parent 0cf4435 commit 946fab2

File tree

7 files changed

+31
-12
lines changed

7 files changed

+31
-12
lines changed

charts/nr-ebpf-agent/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type: application
1313
# This is the chart version. This version number should be incremented each time you make changes
1414
# to the chart and its templates, including the app version.
1515
# Versions are expected to follow Semantic Versioning (https://semver.org/)
16-
version: 0.4.0
16+
version: 0.5.0
1717

1818
dependencies:
1919
- name: common-library
@@ -23,7 +23,7 @@ dependencies:
2323
# incremented each time you make changes to the application. Versions are not expected to
2424
# follow Semantic Versioning. They should reflect the version the application is using.
2525
# It is recommended to use it with quotes.
26-
appVersion: "0.4.0"
26+
appVersion: "0.5.0"
2727
home: https://github.com/newrelic/helm-charts
2828
sources:
2929
- https://github.com/newrelic/

charts/nr-ebpf-agent/templates/_helpers.tpl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Return the cluster name
5959
Create otel collector receiver endpoint
6060
*/}}
6161
{{- define "nr-otel-collector-receiver.endpoint" -}}
62-
{{- printf "dns:///%s.%s.svc.%s:4317" (include "otel-collector.service.name" .) .Release.Namespace .Values.kubernetesClusterDomain }}
62+
{{- printf "dns:///%s.%s.svc.%s:%v" (include "otel-collector.service.name" .) .Release.Namespace .Values.kubernetesClusterDomain .Values.otelCollector.receiverPort }}
6363
{{- end }}
6464

6565
{{/*
@@ -108,6 +108,16 @@ Validate the user inputted value when sampling by error rate.
108108
{{- end -}}
109109
{{- end -}}
110110

111+
{{/*
112+
Validate that receiverPort is not less than 1024 (privileged port range).
113+
*/}}
114+
{{- define "validate.receiverPort" -}}
115+
{{- $port := .Values.otelCollector.receiverPort | int -}}
116+
{{- if lt $port 1025 -}}
117+
{{- fail (printf "Error: receiverPort must be > 1024 (got %d). Ports below 1024 are privileged ports and should not be used." $port) -}}
118+
{{- end -}}
119+
{{- end -}}
120+
111121
{{/*
112122
Pass environment variables to the agent container if tracing a specific protocol is to be disabled.
113123
*/}}

charts/nr-ebpf-agent/templates/nr-ebpf-agent-daemonset.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ spec:
144144
value: {{ include "nr-ebpf-agent.service.name" . }}
145145
- name: IS_INSECURE
146146
value: "True"
147+
- name: APM_DATA_REPORTING
148+
value: "{{ if hasKey .Values "apmDataReporting" }}{{ .Values.apmDataReporting }}{{ else }}true{{ end }}"
149+
- name: TCP_STATS_REPORTING
150+
value: "{{ if hasKey .Values "tcpStatsReporting" }}{{ .Values.tcpStatsReporting }}{{ else }}true{{ end }}"
147151
securityContext:
148152
privileged: true
149153
volumeMounts:

charts/nr-ebpf-agent/templates/otel-collector-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ data:
1111
otlp:
1212
protocols:
1313
grpc:
14-
endpoint: $RECEIVER_ENDPOINT:4317
14+
endpoint: $RECEIVER_ENDPOINT:$RECEIVER_PORT
1515
{{- if (hasKey .Values "tls") }}
1616
{{- if eq .Values.tls.enabled true }}
1717
tls:

charts/nr-ebpf-agent/templates/otel-collector-daemonset.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ spec:
5656
resources: {{- toYaml .Values.otelCollector.resources | nindent 10}}
5757
ports:
5858
- name: otlp
59-
containerPort: 4317
59+
containerPort: {{ .Values.otelCollector.receiverPort }}
6060
protocol: TCP
6161
volumeMounts:
6262
- name: data
@@ -81,6 +81,9 @@ spec:
8181
fieldRef:
8282
apiVersion: v1
8383
fieldPath: status.podIP
84+
{{- include "validate.receiverPort" . }}
85+
- name: RECEIVER_PORT
86+
value: "{{ .Values.otelCollector.receiverPort }}"
8487
- name: NEW_RELIC_LICENSE_KEY
8588
valueFrom:
8689
secretKeyRef:

charts/nr-ebpf-agent/templates/otel-collector-service.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ metadata:
88
component: otel-collector
99
{{- include "newrelic.common.labels" . | nindent 4 }}
1010
spec:
11-
# The OTel collector pod will use a service containing a clusterIP and port 4317 to interface via.
11+
# The OTel collector pod will use a service containing a clusterIP and the configured receiver port to interface via.
1212
type: ClusterIP
1313
selector:
1414
{{- include "newrelic.common.labels.selectorLabels" . | nindent 4 }}
1515
component: otel-collector
1616
ports:
1717
- name: otlp-grpc
18-
port: 4317
18+
port: {{ .Values.otelCollector.receiverPort }}
1919
protocol: TCP
20-
targetPort: 4317
20+
targetPort: {{ .Values.otelCollector.receiverPort }}

charts/nr-ebpf-agent/values.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ allowServiceNameRegex: ""
3535
dropDataForEntity: []
3636
# -- The primary lever to control RAM use of the eBPF agent. Specified in MiB.
3737
tableStoreDataLimitMB: "250"
38-
# -- The source connectors (and data export scripts) to enable.
39-
# Note that socket_tracer tracks http, mysql, redis, mongodb, amqp, cassandra, dns, and postgresql
40-
# while tcp_stats tracks TCP metrics.
41-
# stirlingSources: "socket_tracer,tcp_stats"
38+
# -- Enable APM data reporting. When enabled, the agent collects and reports application performance monitoring data
39+
apmDataReporting: true
40+
# -- Enable TCP statistics reporting. When enabled, the agent collects and reports low level tcp metrics and starts network monitoring
41+
tcpStatsReporting: true
4242

4343
# The protocols to enable for tracing in the socket_tracer. There is an ability to configure span export if it is enabled.
4444
# Each protocol has the flexibility to selectively enable the type of OTLP data to export.
@@ -166,6 +166,8 @@ otelCollector:
166166
podSecurityContext: {}
167167
# -- Sets otelCollector pod containerSecurityContext. Overrides `containerSecurityContext` and `global.securityContext.container`
168168
containerSecurityContext: {}
169+
# -- Port on which the OTLP receiver listens for gRPC connections.
170+
receiverPort: 4317
169171
collector:
170172
serviceAccount:
171173
# -- Annotations for the OTel collector service account.

0 commit comments

Comments
 (0)