Skip to content

Commit 433d5c3

Browse files
[nr-ebpf-agent] Changes for removing OTEL collector (#2015)
<!-- 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: This PR contains changes related to OTEL pod removal from eBPF agent helm chart. #### 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.] - [x] Chart Version bumped - [x] Variables are documented in the README.md - [x] 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: kkhandelwal <[email protected]>
1 parent 5f5c453 commit 433d5c3

11 files changed

+102
-514
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.5.0
16+
version: 1.0.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.5.0"
26+
appVersion: "1.0.0"
2727
home: https://github.com/newrelic/helm-charts
2828
sources:
2929
- https://github.com/newrelic/

charts/nr-ebpf-agent/README.md

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,35 @@ helm repo add newrelic https://helm-charts.newrelic.com
2222
helm upgrade nr-ebpf-agent newrelic/nr-ebpf-agent -f your-custom-values.yaml -n newrelic --create-namespace --install
2323
```
2424

25+
## Version Compatibility
26+
27+
Starting with chart version 1.0.0, version validation is automatically performed to ensure agent compatibility. Chart 1.0.0+ removed OpenTelemetry collector support and requires agent version >= 1.0.0.
28+
29+
**Default Behavior:**
30+
When no custom image tag is specified, the chart uses `Chart.AppVersion` (1.0.0 for chart 1.0.0), which is guaranteed to be compatible.
31+
32+
```yaml
33+
ebpfAgent:
34+
image:
35+
tag: "" # Uses Chart.AppVersion (1.0.0)
36+
```
37+
38+
**Custom Image Tag:**
39+
If you specify a custom image tag, ensure it contains an agent version >= 1.0.0:
40+
41+
```yaml
42+
ebpfAgent:
43+
image:
44+
tag: "1.0.0" # Or any version >= 1.0.0
45+
```
46+
47+
### Troubleshooting Version Validation
48+
49+
If you encounter version validation errors:
50+
51+
1. **Check your image tag:** Ensure `ebpfAgent.image.tag` is set to a version >= 1.0.0
52+
2. **Use default version:** Remove the custom tag to use the chart's default version (recommended)
53+
2554
## Source Code
2655

2756
* <https://github.com/newrelic/>
@@ -42,11 +71,6 @@ kubectl logs <ebpf-pod-name> -c nr-ebpf-client -n newrelic
4271
kubectl logs <ebpf-pod-name> -c nr-ebpf-agent -n newrelic
4372
```
4473
45-
### Check the logs of the OpenTelemetry collector pod:
46-
```
47-
kubectl logs <otel-pod-name> -n newrelic
48-
```
49-
5074
### Confirm data ingest to New Relic
5175
You should see data reporting into New Relic within a couple of seconds to the `Metric` and `Span` tables.
5276
```
@@ -86,7 +110,6 @@ Options that can be defined globally include `affinity`, `nodeSelector`, `tolera
86110
| logFilePath | string | `""` | To configure log file path of eBPF Agent. If logging to this path fails, logs will be directed to stdout. |
87111
| dnsConfig | object | `{}` | Sets pod's dnsConfig. Can be configured also with `global.dnsConfig` |
88112
| dropAPMEnabledPods | bool | `false` | Drop data from pods that are monitored by New Relic APM via auto attach. |
89-
| dropDataIpServiceNames | bool | `true` | Drop data when service names map to an IP address. |
90113
| dropDataNewRelic | bool | `true` | Drop data from the newrelic namespace and newrelic-bundle services. |
91114
| dropDataForEntity | list | `[]` | list entity to ignore the process monitoring based on `NEW_RELIC_APP_NAME` |
92115
| dropDataForNamespaces | list | `[]` | List of Kubernetes namespaces for which all data should be dropped by the agent. |
@@ -113,19 +136,6 @@ Options that can be defined globally include `affinity`, `nodeSelector`, `tolera
113136
| licenseKey | string | `""` | The license key to use. Can be configured with `global.licenseKey` |
114137
| nodeSelector | object | `{}` | Sets all pods' node selector. Can be configured also with `global.nodeSelector` |
115138
| nrStaging | bool | `false` | Endpoint to export data to via the otel collector. NR prod (otlp.nr-data.net:443) by default. Staging (staging-otlp.nr-data.net:443) otherwise. |
116-
| otelCollector.affinity | object | `{}` | Sets otelCollector pod affinities. Overrides `affinity` and `global.affinity` |
117-
| otelCollector.collector.serviceAccount.annotations | object | `{}` | Annotations for the OTel collector service account. |
118-
| otelCollector.containerSecurityContext | object | `{}` | Sets otelCollector pod containerSecurityContext. Overrides `containerSecurityContext` and `global.securityContext.container` |
119-
| otelCollector.image.pullPolicy | string | `"IfNotPresent"` | The pull policy is defaulted to IfNotPresent, which skips pulling an image if it already exists. If pullPolicy is defined without a specific value, it is set to Always. |
120-
| otelCollector.image.repository | string | `"docker.io/newrelic/newrelic-ebpf-agent"` | OpenTelemetry collector image to be deployed. |
121-
| otelCollector.image.tag | string | `"nr-ebpf-otel-collector_0.0.1"` | The tag of the OpenTelemetry collector image to be deployed. |
122-
| otelCollector.podAnnotations | object | `{}` | Sets otelCollector pod Annotations. Overrides `podAnnotations` and `global.podAnnotations` |
123-
| otelCollector.podSecurityContext | object | `{}` | Sets otelCollector pod podSecurityContext. Overrides `podSecurityContext` and `global.securityContext.pod` |
124-
| otelCollector.resources.limits.cpu | string | `"100m"` | Max CPU allocated to the container. |
125-
| otelCollector.resources.limits.memory | string | `"200Mi"` | Max memory allocated to the container. |
126-
| otelCollector.resources.requests.cpu | string | `"100m"` | Min CPU allocated to the container. |
127-
| otelCollector.resources.requests.memory | string | `"200Mi"` | Min memory allocated to the container. |
128-
| otelCollector.tolerations | list | `[]` | Sets otelCollector pod tolerations. Overrides `tolerations` and `global.tolerations` |
129139
| podLabels | object | `{}` | Additional labels for chart pods. |
130140
| podSecurityContext | object | `{}` | Sets all pods' podSecurityContext. Can be configured also with `global.securityContext.pod` |
131141
| priorityClassName | string | `""` | Sets pod's priorityClassName. Can be configured also with `global.priorityClassName` |
@@ -169,7 +179,6 @@ Options that can be defined globally include `affinity`, `nodeSelector`, `tolera
169179
| tls.enabled | bool | `true` | Enable TLS communication between the eBPF client and agent. |
170180
| tls.keyFile | string | `""` | Path to your own PEM-encoded private key. |
171181
| tolerations | list | `[]` | Sets all pods' tolerations to node taints. Can be configured also with `global.tolerations` |
172-
| verboseLog | bool | `false` | Sets the debug logs to this integration or all integrations if it is set globally. Can be configured also with `global.verboseLog` |
173182
174183
## Common Errors
175184

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

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,24 +64,60 @@ Create otel collector receiver endpoint
6464

6565
{{/*
6666
Validates that user-provided tags don't contain "agent-" prefix for chart version >= 0.4.0
67+
Also validates agent version compatibility for chart version >= 1.0.0
6768
*/}}
6869
{{- define "nr-ebpf-agent.imageTag" -}}
70+
{{- $imageTag := "" -}}
6971
{{- if .Values.ebpfAgent.image.tag -}}
7072
{{- if semverCompare ">=0.4.0" .Chart.Version -}}
7173
{{- if hasPrefix "agent-" .Values.ebpfAgent.image.tag -}}
7274
{{- fail (printf "Error: For chart version %s (>=0.4.0), the ebpfAgent.image.tag should not contain 'agent-' prefix. Please use image tags that do not contain the prefix." .Chart.Version) -}}
7375
{{- end -}}
74-
{{- .Values.ebpfAgent.image.tag -}}
76+
{{- $imageTag = .Values.ebpfAgent.image.tag -}}
7577
{{- else -}}
76-
{{- .Values.ebpfAgent.image.tag -}}
78+
{{- $imageTag = .Values.ebpfAgent.image.tag -}}
7779
{{- end -}}
7880
{{- else -}}
7981
{{- if semverCompare ">=0.4.0" .Chart.Version -}}
80-
{{- .Chart.AppVersion -}}
82+
{{- $imageTag = .Chart.AppVersion -}}
8183
{{- else -}}
82-
{{- printf "agent-%s" .Chart.AppVersion -}}
84+
{{- $imageTag = printf "agent-%s" .Chart.AppVersion -}}
8385
{{- end -}}
8486
{{- end -}}
87+
{{- if and (semverCompare ">=1.0.0" .Chart.Version) (not .Values.skipVersionValidation) -}}
88+
{{- include "nr-ebpf-agent.validateVersion" (dict "tag" $imageTag "chartVersion" .Chart.Version "appVersion" .Chart.AppVersion) -}}
89+
{{- end -}}
90+
{{- $imageTag -}}
91+
{{- end -}}
92+
93+
{{/*
94+
Validate agent version compatibility at template rendering time
95+
For chart version >= 1.0.0, ensure agent version >= 1.0.0
96+
Extracts version from image tag and compares using semver
97+
*/}}
98+
{{- define "nr-ebpf-agent.validateVersion" -}}
99+
{{- $tag := .tag -}}
100+
{{- $chartVersion := .chartVersion -}}
101+
{{- $appVersion := .appVersion -}}
102+
{{- $minVersion := "1.0.0" -}}
103+
{{- $agentVersion := "" -}}
104+
105+
{{- /* Try to extract semantic version from tag */ -}}
106+
{{- if regexMatch "^v?[0-9]+\\.[0-9]+\\.[0-9]+" $tag -}}
107+
{{- /* Extract X.Y.Z from patterns like "0.5.0", "v0.5.0", "0.5.0-beta", etc */ -}}
108+
{{- $agentVersion = regexFind "^v?([0-9]+\\.[0-9]+\\.[0-9]+)" $tag | trimPrefix "v" -}}
109+
{{- else if eq $tag $appVersion -}}
110+
{{- /* If tag equals appVersion, use appVersion directly */ -}}
111+
{{- $agentVersion = $appVersion -}}
112+
{{- else -}}
113+
{{- /* Cannot parse version from custom tag - fail with helpful message */ -}}
114+
{{- fail (printf "\nError: Chart version %s requires agent version >= %s.\n\nCannot determine agent version from image tag '%s'.\n\nRESOLUTION:\n 1. Use a semantic version tag (e.g., '1.0.0', '0.7.0')\n 2. Remove the image tag to use Chart.AppVersion (%s)\n\nFor more information:\n https://github.com/newrelic/helm-charts/tree/master/charts/nr-ebpf-agent\n" $chartVersion $minVersion $tag $appVersion) -}}
115+
{{- end -}}
116+
117+
{{- /* Validate extracted version is >= minimum required version */ -}}
118+
{{- if not (semverCompare (printf ">=%s" $minVersion) $agentVersion) -}}
119+
{{- fail (printf "\n================================================================================\nERROR: INCOMPATIBLE AGENT VERSION\n================================================================================\n\nChart Version: %s\nAgent Version: %s (from tag: %s)\nRequired Version: >= %s\n\nChart version %s removed OpenTelemetry collector support and requires\nagent version >= %s.\n\nRESOLUTION:\n 1. Update ebpfAgent.image.tag to version >= %s\n OR\n 2. Remove custom image tag to use Chart.AppVersion (%s)\n\nFor more information:\n https://github.com/newrelic/helm-charts/tree/master/charts/nr-ebpf-agent\n\n================================================================================\n" $chartVersion $agentVersion $tag $minVersion $chartVersion $minVersion $minVersion $appVersion) -}}
120+
{{- end -}}
85121
{{- end -}}
86122
87123
{{/*

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

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
{{- $region := include "newrelic.common.region" . }}
23
apiVersion: apps/v1
34
kind: DaemonSet
45
metadata:
@@ -129,7 +130,13 @@ spec:
129130
fieldRef:
130131
fieldPath: status.hostIP
131132
- name: OTLP_ENDPOINT
132-
value: {{ include "nr-otel-collector-receiver.endpoint" .}}
133+
{{- if eq $region "Staging" }}
134+
value: "staging-otlp.nr-data.net:443"
135+
{{- else if eq $region "EU" }}
136+
value: "otlp.eu01.nr-data.net:443"
137+
{{- else }}
138+
value: "otlp.nr-data.net:443"
139+
{{- end }}
133140
{{- include "generateClientScriptEnvVars" . | nindent 10 }}
134141
{{- if (hasKey .Values.protocols.http "spans") }}
135142
{{- if .Values.protocols.http.spans.samplingErrorRate}}
@@ -142,12 +149,20 @@ spec:
142149
value: {{ .Release.Namespace }}
143150
- name: AGENT_SERVICE_NAME
144151
value: {{ include "nr-ebpf-agent.service.name" . }}
145-
- name: IS_INSECURE
146-
value: "True"
147152
- name: APM_DATA_REPORTING
148153
value: "{{ if hasKey .Values "apmDataReporting" }}{{ .Values.apmDataReporting }}{{ else }}true{{ end }}"
149154
- name: TCP_STATS_REPORTING
150155
value: "{{ if hasKey .Values "tcpStatsReporting" }}{{ .Values.tcpStatsReporting }}{{ else }}true{{ end }}"
156+
- name: DROP_DATA_NEW_RELIC
157+
value: "{{ if hasKey .Values "dropDataNewRelic" }}{{ .Values.dropDataNewRelic }}{{ else }}true{{ end }}"
158+
- name: DROP_APM_ENABLED_PODS
159+
value: "{{ if hasKey .Values "dropAPMEnabledPods" }}{{ .Values.dropAPMEnabledPods }}{{ else }}false{{ end }}"
160+
- name: DROP_DATA_FOR_NAMESPACES
161+
value: "{{ .Values.dropDataForNamespaces | join "," }}"
162+
- name: DROP_SERVICE_NAME_REGEX
163+
value: {{ .Values.dropDataServiceNameRegex }}
164+
- name: ALLOW_SERVICE_NAME_REGEX
165+
value: {{ .Values.allowServiceNameRegex }}
151166
securityContext:
152167
privileged: true
153168
volumeMounts:
@@ -168,6 +183,7 @@ spec:
168183
hostNetwork: true
169184
hostPID: true
170185
restartPolicy: Always
186+
serviceAccountName: {{ include "nr-ebpf-agent.service.name" . }}
171187
volumes:
172188
- name: host-root-volume
173189
hostPath:

charts/nr-ebpf-agent/templates/otel-collector-rbac.yaml renamed to charts/nr-ebpf-agent/templates/nr-ebpf-agent-rbac.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: rbac.authorization.k8s.io/v1
22
kind: ClusterRole
33
metadata:
4-
name: {{ include "nr-ebpf-agent.otelcollector.name" . }}
4+
name: {{ include "nr-ebpf-agent.service.name" . }}
55
labels:
66
{{- include "newrelic.common.labels" . | nindent 4 }}
77
rules:
@@ -29,14 +29,14 @@ rules:
2929
apiVersion: rbac.authorization.k8s.io/v1
3030
kind: ClusterRoleBinding
3131
metadata:
32-
name: {{ include "nr-ebpf-agent.otelcollector.name" . }}
32+
name: {{ include "nr-ebpf-agent.service.name" . }}
3333
labels:
3434
{{- include "newrelic.common.labels" . | nindent 4 }}
3535
roleRef:
3636
apiGroup: rbac.authorization.k8s.io
3737
kind: ClusterRole
38-
name: {{ include "nr-ebpf-agent.otelcollector.name" . }}
38+
name: {{ include "nr-ebpf-agent.service.name" . }}
3939
subjects:
4040
- kind: ServiceAccount
41-
name: {{ include "nr-ebpf-agent.collector.name" . }}
41+
name: {{ include "nr-ebpf-agent.service.name" . }}
4242
namespace: '{{ .Release.Namespace }}'

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
apiVersion: v1
33
kind: ServiceAccount
44
metadata:
5-
name: {{ include "nr-ebpf-agent.collector.name" . }}
5+
name: {{ include "nr-ebpf-agent.service.name" . }}
66
labels:
77
{{- include "newrelic.common.labels" . | nindent 4 }}
88
annotations:
9-
{{- toYaml .Values.otelCollector.collector.serviceAccount.annotations | nindent 4 }}
9+
{{- toYaml .Values.ebpfAgent.serviceAccount.annotations | nindent 4 }}
1010
{{- end }}

0 commit comments

Comments
 (0)