Skip to content

Commit ac983dd

Browse files
[nr-ebpf-agent] Unified image for eBPF agent and client (#1985)
<!-- 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 the following changes: - Support to deploy unified image for eBPF agent. - Update init container image to use `agent-base-image-latest`. - Introduced new env `vizierPort` to configure the vizier port. - Support for backward compatibility for older images. #### 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 <[email protected]>
1 parent f9f1294 commit ac983dd

File tree

5 files changed

+58
-90
lines changed

5 files changed

+58
-90
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.3.1
16+
version: 0.4.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.3.0"
26+
appVersion: "0.4.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: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,28 @@ Create otel collector receiver endpoint
6262
{{- printf "dns:///%s.%s.svc.%s:4317" (include "otel-collector.service.name" .) .Release.Namespace .Values.kubernetesClusterDomain }}
6363
{{- end }}
6464

65+
{{/*
66+
Validates that user-provided tags don't contain "agent-" prefix for chart version >= 0.4.0
67+
*/}}
68+
{{- define "nr-ebpf-agent.imageTag" -}}
69+
{{- if .Values.ebpfAgent.image.tag -}}
70+
{{- if semverCompare ">=0.4.0" .Chart.Version -}}
71+
{{- if hasPrefix "agent-" .Values.ebpfAgent.image.tag -}}
72+
{{- 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) -}}
73+
{{- end -}}
74+
{{- .Values.ebpfAgent.image.tag -}}
75+
{{- else -}}
76+
{{- .Values.ebpfAgent.image.tag -}}
77+
{{- end -}}
78+
{{- else -}}
79+
{{- if semverCompare ">=0.4.0" .Chart.Version -}}
80+
{{- .Chart.AppVersion -}}
81+
{{- else -}}
82+
{{- printf "agent-%s" .Chart.AppVersion -}}
83+
{{- end -}}
84+
{{- end -}}
85+
{{- end -}}
86+
6587
{{/*
6688
Validate the user inputted quantile when sampling by latency.
6789
*/}}

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

Lines changed: 26 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ spec:
4040
{{- end }}
4141
initContainers:
4242
- name: kernel-header-installer
43-
image: docker.io/newrelic/newrelic-ebpf-agent:agent-0.3.0
43+
image: docker.io/newrelic/newrelic-ebpf-agent:agent-base-image-latest
44+
imagePullPolicy: IfNotPresent
4445
command:
4546
- "/bin/bash"
4647
- "-c"
@@ -70,14 +71,12 @@ spec:
7071

7172
containers:
7273
- name: nr-ebpf-agent
73-
image: {{- if .Values.ebpfAgent.image.tag }}
74-
{{ .Values.ebpfAgent.image.repository }}:{{ .Values.ebpfAgent.image.tag }}
75-
{{- else }}
76-
docker.io/newrelic/newrelic-ebpf-agent:agent-0.3.0
77-
{{- end }}
74+
image: {{ .Values.ebpfAgent.image.repository }}:{{ include "nr-ebpf-agent.imageTag" . }}
7875
imagePullPolicy: {{ .Values.ebpfAgent.image.pullPolicy }}
7976
resources: {{ .Values.ebpfAgent.resources | toYaml | nindent 10 }}
8077
env:
78+
- name: VIZIER_PORT
79+
value: "{{ .Values.ebpfAgent.vizierPort | default "12345" }}"
8180
- name: PL_HOST_PATH
8281
value: "/host"
8382
- name: PL_STIRLING_SOURCES
@@ -89,6 +88,16 @@ spec:
8988
value: "{{ .Values.logLevel }}"
9089
- name: NEW_RELIC_LOG_FILE_PATH
9190
value: "{{ .Values.logFilePath }}"
91+
- name: NEW_RELIC_LICENSE_KEY
92+
valueFrom:
93+
secretKeyRef:
94+
{{- if (include "newrelic.common.license._licenseKey" .) }}
95+
key: NEW_RELIC_LICENSE_KEY
96+
name: nr-ebpf-agent-secrets
97+
{{- else }}
98+
key: {{ include "newrelic.common.license._customSecretKey" . }}
99+
name: {{ include "newrelic.common.license._customSecretName" . }}
100+
{{- end }}
92101
- name: TABLE_STORE_DATA_LIMIT_MB
93102
value: "{{ .Values.tableStoreDataLimitMB }}"
94103
- name: TLS_ENABLED
@@ -113,32 +122,6 @@ spec:
113122
- name: DISTRO_KERNEL_HEADERS_PATH
114123
value: "{{ .Values.ebpfAgent.distroKernelHeadersPath }}"
115124
{{- end }}
116-
117-
securityContext:
118-
privileged: true
119-
volumeMounts:
120-
- name: host-root-volume
121-
mountPath: /host
122-
readOnly: true
123-
- name: sys-volume
124-
mountPath: /sys
125-
readOnly: true
126-
{{- if (hasKey .Values "tls") }}
127-
{{- if eq .Values.tls.enabled true }}
128-
- name: cert
129-
mountPath: "{{ .Values.tls.certPath }}/"
130-
readOnly: true
131-
{{- end }}
132-
{{- end }}
133-
- name: nr-ebpf-client
134-
image: {{- if .Values.ebpfClient.image.tag }}
135-
{{ .Values.ebpfClient.image.repository }}:{{ .Values.ebpfClient.image.tag }}
136-
{{- else }}
137-
docker.io/newrelic/newrelic-ebpf-agent:client-0.3.0
138-
{{- end }}
139-
imagePullPolicy: {{ .Values.ebpfClient.image.pullPolicy }}
140-
resources: {{ .Values.ebpfClient.resources | toYaml | nindent 10 }}
141-
env:
142125
- name: DEPLOYMENT_NAME
143126
value: {{ .Values.cluster }}
144127
- name: HOST_IP
@@ -147,8 +130,6 @@ spec:
147130
fieldPath: status.hostIP
148131
- name: OTLP_ENDPOINT
149132
value: {{ include "nr-otel-collector-receiver.endpoint" .}}
150-
- name: PL_STIRLING_SOURCES
151-
value: "{{ .Values.stirlingSources | default "socket_tracer,tcp_stats" }}"
152133
{{- include "generateClientScriptEnvVars" . | nindent 10 }}
153134
{{- if (hasKey .Values.protocols.http "spans") }}
154135
{{- if .Values.protocols.http.spans.samplingErrorRate}}
@@ -157,44 +138,27 @@ spec:
157138
value: "{{ .Values.protocols.http.spans.samplingErrorRate | default "0"}}"
158139
{{- end }}
159140
{{- end }}
160-
- name: KUBERNETES_CLUSTER_DOMAIN
161-
value: "{{ .Values.kubernetesClusterDomain }}"
162141
- name: NAMESPACE
163142
value: {{ .Release.Namespace }}
164143
- name: AGENT_SERVICE_NAME
165144
value: {{ include "nr-ebpf-agent.service.name" . }}
166-
# TODO(kpattaswamy): Once we implement TLS, we should make this configurable again
167145
- name: IS_INSECURE
168146
value: "True"
169-
- name: NEW_RELIC_LOG_LEVEL
170-
value: "{{ .Values.logLevel }}"
171-
- name: NEW_RELIC_LOG_FILE_PATH
172-
value: "{{ .Values.logFilePath }}"
173-
- name: NEW_RELIC_LICENSE_KEY
174-
valueFrom:
175-
secretKeyRef:
176-
{{- if (include "newrelic.common.license._licenseKey" .) }}
177-
key: NEW_RELIC_LICENSE_KEY
178-
name: nr-ebpf-agent-secrets
179-
{{- else }}
180-
key: {{ include "newrelic.common.license._customSecretKey" . }}
181-
name: {{ include "newrelic.common.license._customSecretName" . }}
182-
{{- end }}
183-
- name: TLS_ENABLED
184-
{{- if (hasKey .Values "tls") }}
185-
{{- if eq .Values.tls.enabled true }}
186-
value: "true"
187-
{{- else }}
188-
value: "false"
189-
{{- end }}
190-
{{- if eq .Values.tls.enabled true }}
191-
- name: TLS_CERT_PATH
192-
value: "{{ .Values.tls.certPath }}/"
147+
securityContext:
148+
privileged: true
193149
volumeMounts:
150+
- name: host-root-volume
151+
mountPath: /host
152+
readOnly: true
153+
- name: sys-volume
154+
mountPath: /sys
155+
readOnly: true
156+
{{- if (hasKey .Values "tls") }}
157+
{{- if eq .Values.tls.enabled true }}
194158
- name: cert
195159
mountPath: "{{ .Values.tls.certPath }}/"
196160
readOnly: true
197-
{{- end }}
161+
{{- end }}
198162
{{- end }}
199163
dnsPolicy: ClusterFirstWithHostNet
200164
hostNetwork: true

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ spec:
4747
securityContext:
4848
{{- . | nindent 12 }}
4949
{{- end }}
50-
image: {{- if .Values.otelCollector.image.tag }}
50+
image: {{ if .Values.otelCollector.image.tag -}}
5151
{{ .Values.otelCollector.image.repository }}:{{ .Values.otelCollector.image.tag }}
52-
{{- else }}
53-
docker.io/newrelic/newrelic-ebpf-agent:nr-ebpf-otel-collector_0.0.1
54-
{{- end }}
52+
{{ else -}}
53+
{{ .Values.otelCollector.image.repository }}:nr-ebpf-otel-collector_0.0.1
54+
{{ end -}}
5555
imagePullPolicy: {{ .Values.otelCollector.image.pullPolicy }}
5656
resources: {{- toYaml .Values.otelCollector.resources | nindent 10}}
5757
ports:

charts/nr-ebpf-agent/values.yaml

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ ebpfAgent:
124124
podSecurityContext: {}
125125
# -- Sets ebpfAgent pod containerSecurityContext. Overrides `containerSecurityContext` and `global.securityContext.container`
126126
containerSecurityContext: {}
127+
# Vizier server port on which agent receives pxl scripts from the client. Default to 12345
128+
vizierPort: ""
127129
# Sets the absolute path of the complete directory where the required linux headers are manually downloaded and placed for the eBPF agent to use.
128130
# This is useful under restricted environments where agent is not able to download required linux headers. The required headers are identified by the agent based on the kernel version.
129131
# The absolute path in case of K8s should also be prepended with /host when necessary.
@@ -134,26 +136,6 @@ ebpfAgent:
134136
# ---- USE ONLY AFTER NEW RELIC SUPPORT RECOMMENDATION. ----
135137
distroKernelHeadersPath: ""
136138

137-
138-
# Configuration to apply on the eBPF client daemonset.
139-
ebpfClient:
140-
image:
141-
# -- eBPF client image to be deployed.
142-
repository: docker.io/newrelic/newrelic-ebpf-agent
143-
# -- 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.
144-
pullPolicy: IfNotPresent
145-
# -- The tag of the eBPF client image to be deployed.
146-
tag: ""
147-
resources:
148-
limits:
149-
# -- Max memory allocated to the container.
150-
memory: 100Mi
151-
requests:
152-
# -- Min CPU allocated to the container.
153-
cpu: 50m
154-
# -- Min memory allocated to the container.
155-
memory: 50Mi
156-
157139
# Configuration to apply on the OpenTelemetry collector daemonset.
158140
otelCollector:
159141
image:
@@ -166,9 +148,9 @@ otelCollector:
166148
resources:
167149
limits:
168150
# -- Max CPU allocated to the container.
169-
cpu: 100m
151+
cpu: 200m
170152
# -- Max memory allocated to the container.
171-
memory: 200Mi
153+
memory: 500Mi
172154
requests:
173155
# -- Min CPU allocated to the container.
174156
cpu: 100m

0 commit comments

Comments
 (0)