Skip to content

Commit d194a94

Browse files
dpacheconrclaude
andcommitted
feat(Phase 3): add global.images.pullPolicy support across nri-bundle
Add support for cascading pullPolicy from global.images.pullPolicy setting: - Added pullPolicy helpers to newrelic-pixie _helpers.tpl - Added pullPolicy helpers to nr-ebpf-agent _helpers.tpl - Added pullPolicy helpers to newrelic-logging _helpers.tpl - Updated job.yaml files to use pullPolicy helpers - Updated daemonset imagePullPolicy declarations Configuration hierarchy for pullPolicy: 1. global.images.pullPolicy (highest priority) 2. Chart-level image.pullPolicy 3. Default: IfNotPresent Users can now configure pull policy globally: global: images: pullPolicy: Always 🤖 Generated with Claude Code Co-Authored-By: Claude <[email protected]>
1 parent 466a121 commit d194a94

File tree

6 files changed

+108
-5
lines changed

6 files changed

+108
-5
lines changed

charts/newrelic-logging/templates/_helpers.tpl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,4 +284,32 @@ If additionalEnvVariables is set, renames to extraEnv. Returns extraEnv.
284284
{{- end -}}
285285
{{- end -}}
286286

287+
{{/*
288+
Returns the pull policy for main image, respecting global.images.pullPolicy
289+
*/}}
290+
{{- define "newrelic-logging.imagePullPolicy" -}}
291+
{{- $globalPullPolicy := .Values.global.images.pullPolicy | default "" -}}
292+
{{- $chartPullPolicy := .Values.image.pullPolicy | default "" -}}
293+
{{- if $globalPullPolicy -}}
294+
{{- $globalPullPolicy -}}
295+
{{- else if $chartPullPolicy -}}
296+
{{- $chartPullPolicy -}}
297+
{{- else -}}
298+
IfNotPresent
299+
{{- end -}}
300+
{{- end -}}
287301

302+
{{/*
303+
Returns the pull policy for persistence init container, respecting global.images.pullPolicy
304+
*/}}
305+
{{- define "newrelic-logging.persistenceInitContainerImagePullPolicy" -}}
306+
{{- $globalPullPolicy := .Values.global.images.pullPolicy | default "" -}}
307+
{{- $chartPullPolicy := .Values.fluentBit.persistenceInitContainerImage.pullPolicy | default "" -}}
308+
{{- if $globalPullPolicy -}}
309+
{{- $globalPullPolicy -}}
310+
{{- else if $chartPullPolicy -}}
311+
{{- $chartPullPolicy -}}
312+
{{- else -}}
313+
IfNotPresent
314+
{{- end -}}
315+
{{- end -}}

charts/newrelic-pixie/templates/_helpers.tpl

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,36 @@ Returns imagePullSecrets for cluster wait init container
207207
{{- end }}
208208
{{- end -}}
209209

210+
{{/*
211+
Returns the pull policy for cluster registration wait image, respecting global.images.pullPolicy
212+
*/}}
213+
{{- define "newrelic-pixie.clusterWaitImagePullPolicy" -}}
214+
{{- $globalPullPolicy := .Values.global.images.pullPolicy | default "" -}}
215+
{{- $chartPullPolicy := .Values.clusterRegistrationWaitImage.pullPolicy | default "" -}}
216+
{{- if $globalPullPolicy -}}
217+
{{- $globalPullPolicy -}}
218+
{{- else if $chartPullPolicy -}}
219+
{{- $chartPullPolicy -}}
220+
{{- else -}}
221+
IfNotPresent
222+
{{- end -}}
223+
{{- end -}}
224+
225+
{{/*
226+
Returns the pull policy for main image, respecting global.images.pullPolicy
227+
*/}}
228+
{{- define "newrelic-pixie.imagePullPolicy" -}}
229+
{{- $globalPullPolicy := .Values.global.images.pullPolicy | default "" -}}
230+
{{- $chartPullPolicy := .Values.image.pullPolicy | default "" -}}
231+
{{- if $globalPullPolicy -}}
232+
{{- $globalPullPolicy -}}
233+
{{- else if $chartPullPolicy -}}
234+
{{- $chartPullPolicy -}}
235+
{{- else -}}
236+
IfNotPresent
237+
{{- end -}}
238+
{{- end -}}
239+
210240
{{/*
211241
Returns if the template should render, it checks if the required values
212242
licenseKey and cluster are set.

charts/newrelic-pixie/templates/job.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ spec:
3737
initContainers:
3838
- name: cluster-registration-wait
3939
image: "{{ include "newrelic-pixie.clusterRegistrationWaitImage" . }}:{{ (.Values.clusterRegistrationWaitImage).tag | default "1.0" }}"
40-
imagePullPolicy: "{{ (.Values.clusterRegistrationWaitImage).pullPolicy | default "IfNotPresent" }}"
40+
imagePullPolicy: {{ include "newrelic-pixie.clusterWaitImagePullPolicy" . }}
4141
command: ['sh', '-c', 'set -x;
4242
URL="https://${SERVICE_NAME}:${SERVICE_PORT}/readyz";
4343
until [ $(curl -m 0.5 -s -o /dev/null -w "%{http_code}" -k ${URL}) -eq 200 ]; do
@@ -54,7 +54,7 @@ spec:
5454
containers:
5555
- name: {{ template "newrelic-pixie.name" . }}
5656
image: "{{ include "newrelic-pixie.image" . }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
57-
imagePullPolicy: "{{ .Values.image.pullPolicy }}"
57+
imagePullPolicy: {{ include "newrelic-pixie.imagePullPolicy" . }}
5858
env:
5959
- name: CLUSTER_NAME
6060
value: {{ template "newrelic-pixie.cluster" . }}

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

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,51 @@ Pass environment variables to the agent container if tracing a specific protocol
124124
{{- end }}
125125
{{- end -}}
126126
127+
{{/*
128+
Returns the pull policy for kernel header installer, respecting global.images.pullPolicy
129+
*/}}
130+
{{- define "nr-ebpf-agent.kernelHeaderInstaller.imagePullPolicy" -}}
131+
{{- $globalPullPolicy := .Values.global.images.pullPolicy | default "" -}}
132+
{{- $chartPullPolicy := .Values.ebpfAgent.kernelHeaderInstaller.pullPolicy | default "" -}}
133+
{{- if $globalPullPolicy -}}
134+
{{- $globalPullPolicy -}}
135+
{{- else if $chartPullPolicy -}}
136+
{{- $chartPullPolicy -}}
137+
{{- else -}}
138+
IfNotPresent
139+
{{- end -}}
140+
{{- end -}}
141+
142+
{{/*
143+
Returns the pull policy for eBPF agent, respecting global.images.pullPolicy
144+
*/}}
145+
{{- define "nr-ebpf-agent.ebpfAgent.imagePullPolicy" -}}
146+
{{- $globalPullPolicy := .Values.global.images.pullPolicy | default "" -}}
147+
{{- $chartPullPolicy := .Values.ebpfAgent.image.pullPolicy | default "" -}}
148+
{{- if $globalPullPolicy -}}
149+
{{- $globalPullPolicy -}}
150+
{{- else if $chartPullPolicy -}}
151+
{{- $chartPullPolicy -}}
152+
{{- else -}}
153+
IfNotPresent
154+
{{- end -}}
155+
{{- end -}}
156+
157+
{{/*
158+
Returns the pull policy for OTel collector, respecting global.images.pullPolicy
159+
*/}}
160+
{{- define "nr-ebpf-agent.otelCollector.imagePullPolicy" -}}
161+
{{- $globalPullPolicy := .Values.global.images.pullPolicy | default "" -}}
162+
{{- $chartPullPolicy := .Values.otelCollector.image.pullPolicy | default "" -}}
163+
{{- if $globalPullPolicy -}}
164+
{{- $globalPullPolicy -}}
165+
{{- else if $chartPullPolicy -}}
166+
{{- $chartPullPolicy -}}
167+
{{- else -}}
168+
IfNotPresent
169+
{{- end -}}
170+
{{- end -}}
171+
127172
{{/*
128173
Generate environment variables for disabling protocols and setting sampling latency.
129174
*/}}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ spec:
4141
initContainers:
4242
- name: kernel-header-installer
4343
image: docker.io/newrelic/newrelic-ebpf-agent:agent-base-image-latest
44-
imagePullPolicy: IfNotPresent
44+
imagePullPolicy: {{ include "nr-ebpf-agent.kernelHeaderInstaller.imagePullPolicy" . }}
4545
command:
4646
- "/bin/bash"
4747
- "-c"
@@ -72,7 +72,7 @@ spec:
7272
containers:
7373
- name: nr-ebpf-agent
7474
image: {{ .Values.ebpfAgent.image.repository }}:{{ include "nr-ebpf-agent.imageTag" . }}
75-
imagePullPolicy: {{ .Values.ebpfAgent.image.pullPolicy }}
75+
imagePullPolicy: {{ include "nr-ebpf-agent.ebpfAgent.imagePullPolicy" . }}
7676
resources: {{ .Values.ebpfAgent.resources | toYaml | nindent 10 }}
7777
env:
7878
- name: VIZIER_PORT

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ spec:
5252
{{ else -}}
5353
{{ .Values.otelCollector.image.repository }}:nr-ebpf-otel-collector_0.0.1
5454
{{ end -}}
55-
imagePullPolicy: {{ .Values.otelCollector.image.pullPolicy }}
55+
imagePullPolicy: {{ include "nr-ebpf-agent.otelCollector.imagePullPolicy" . }}
5656
resources: {{- toYaml .Values.otelCollector.resources | nindent 10}}
5757
ports:
5858
- name: otlp

0 commit comments

Comments
 (0)