Skip to content
Open
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
22 changes: 20 additions & 2 deletions charts/k8s-agents-operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,29 @@ Returns if the template should render, it checks if the required values are set.
{{- and (or $licenseKey)}}
{{- end -}}

{{- define "k8s-agents-operator.manager.imagePullPolicy" -}}
{{- $globalPullPolicy := .Values.global.images.pullPolicy | default "" -}}
{{- $chartPullPolicy := .Values.controllerManager.manager.image.pullPolicy | default "" -}}
{{- if $globalPullPolicy -}}
{{- $globalPullPolicy -}}
{{- else if $chartPullPolicy -}}
{{- $chartPullPolicy -}}
{{- else -}}
IfNotPresent
{{- end -}}
{{- end -}}

{{- define "k8s-agents-operator.manager.image" -}}
{{- $managerRepository := .Values.controllerManager.manager.image.repository -}}
{{- $defaultRepository := "newrelic/k8s-agents-operator" -}}
{{- $registry := include "newrelic.common.images.registry" ( dict "imageRoot" (dict "repository" $defaultRepository) "defaultRegistry" "" "context" . ) -}}
{{- if and $registry (eq $managerRepository $defaultRepository) -}}
{{- $managerRepository = printf "%s/%s" $registry $defaultRepository -}}
{{- end -}}
{{- $managerVersion := .Values.controllerManager.manager.image.version | default .Chart.AppVersion -}}
{{- if eq (substr 0 7 $managerVersion) "sha256:" -}}
{{- printf "%s@%s" .Values.controllerManager.manager.image.repository $managerVersion -}}
{{- printf "%s@%s" $managerRepository $managerVersion -}}
{{- else -}}
{{- printf "%s:%s" .Values.controllerManager.manager.image.repository $managerVersion -}}
{{- printf "%s:%s" $managerRepository $managerVersion -}}
{{- end -}}
{{- end -}}
10 changes: 9 additions & 1 deletion charts/k8s-agents-operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ spec:
hostNetwork: {{ .Values.hostNetwork }}
{{- end }}
serviceAccountName: {{ include "newrelic.common.serviceAccount.name" . }}
{{- $globalPullSecrets := .Values.global.images.pullSecrets | default list }}
{{- $chartPullSecrets := .Values.controllerManager.manager.image.pullSecrets | default list }}
{{- if or $globalPullSecrets $chartPullSecrets }}
{{- with include "newrelic.common.images.renderPullSecrets" ( dict "pullSecrets" (concat $globalPullSecrets $chartPullSecrets) "context" .) }}
imagePullSecrets:
{{- . | nindent 8 }}
{{- end }}
{{- end }}
{{- with include "newrelic.common.securityContext.pod" . }}
securityContext:
{{- . | nindent 8 }}
Expand Down Expand Up @@ -64,7 +72,7 @@ spec:
- name: ENABLE_WEBHOOKS
value: "true"
image: {{ include "k8s-agents-operator.manager.image" . }}
imagePullPolicy: {{ .Values.controllerManager.manager.image.pullPolicy | default "Always" }}
imagePullPolicy: {{ include "k8s-agents-operator.manager.imagePullPolicy" . }}
livenessProbe:
httpGet:
path: /healthz
Expand Down
3 changes: 3 additions & 0 deletions charts/k8s-agents-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,13 @@ controllerManager:
logLevel: info
image:
# -- Sets the repository and image to use for the manager. Please ensure you're using trusted New Relic images.
# -- Defaults to newrelic/k8s-agents-operator. If global.images.registry is set, it will be used instead.
repository: newrelic/k8s-agents-operator
# -- Sets the manager image version to retrieve. Could be a tag i.e. "v0.17.0" or a SHA digest i.e. "sha256:e2399e70e99ac370ca6a3c7e5affa9655da3b246d0ada77c40ed155b3726ee2e"
version:
pullPolicy:
# -- The secrets that are needed to pull images from a custom registry. Can be configured also with `global.images.pullSecrets`
pullSecrets: []
resources:
limits:
cpu: 500m
Expand Down
Loading