Skip to content

Commit

Permalink
Allow overriding image registry at the global level (#542)
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Shaner <[email protected]>
  • Loading branch information
bens545 authored Mar 14, 2024
1 parent 2e10d52 commit 94cb97a
Show file tree
Hide file tree
Showing 16 changed files with 299 additions and 121 deletions.
2 changes: 1 addition & 1 deletion charts/jaeger/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ appVersion: 1.53.0
description: A Jaeger Helm chart for Kubernetes
name: jaeger
type: application
version: 1.0.2
version: 2.0.0
# CronJobs require v1.21
kubeVersion: ">= 1.21-0"
keywords:
Expand Down
5 changes: 4 additions & 1 deletion charts/jaeger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,10 @@ query:
oAuthSidecar:
enabled: true
resources: {}
image: quay.io/oauth2-proxy/oauth2-proxy:v7.3.0
image:
registry: quay.io
repository: oauth2-proxy/oauth2-proxy
tag: v7.3.0
pullPolicy: IfNotPresent
containerPort: 4180
args:
Expand Down
179 changes: 172 additions & 7 deletions charts/jaeger/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@ Create chart name and version as used by the chart label.
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create image tag value which defaults to .Chart.AppVersion.
*/}}
{{- define "jaeger.image.tag" -}}
{{- .Values.tag | default .Chart.AppVersion }}
{{- end -}}

{{/*
Common labels
*/}}
Expand Down Expand Up @@ -523,3 +516,175 @@ spec:
{{- include "common.tplvalues.render" (dict "value" .ComponentValues.networkPolicy.egressRules.customRules "context" $) | nindent 2 }}
{{- end }}
{{- end -}}

{{/*
Create image name value
If not tag is provided, it defaults to .Chart.AppVersion.
( dict "imageRoot" .Values.path.to.image "context" $ )
*/}}
{{- define "renderImage" -}}
{{- $image := merge .imageRoot (dict "tag" .context.Chart.AppVersion) -}}
{{- include "common.images.image" (dict "imageRoot" $image "global" .context.Values.Global) -}}
{{- end -}}

{{/*
Create image name for all in one image
*/}}
{{- define "allInOne.image" -}}
{{- include "renderImage" ( dict "imageRoot" .Values.allInOne.image "context" $ ) -}}
{{- end -}}

{{/*
Create pull secrets for all in one image
*/}}
{{- define "allInOne.imagePullSecrets" -}}
{{- include "common.images.renderPullSecrets" (dict "images" (list .Values.allInOne.image) "context" $) -}}
{{- end }}

{{/*
Create image name for schema image
*/}}
{{- define "schema.image" -}}
{{- include "renderImage" ( dict "imageRoot" .Values.schema.image "context" $ ) -}}
{{- end -}}

{{/*
Create pull secrets for schema image
*/}}
{{- define "schema.imagePullSecrets" -}}
{{- include "common.images.renderPullSecrets" (dict "images" (list .Values.schema.image) "context" $) -}}
{{- end }}

{{/*
Create image name for ingester image
*/}}
{{- define "ingester.image" -}}
{{- include "renderImage" ( dict "imageRoot" .Values.ingester.image "context" $ ) -}}
{{- end -}}

{{/*
Create pull secrets for ingester image
*/}}
{{- define "ingester.imagePullSecrets" -}}
{{- include "common.images.renderPullSecrets" (dict "images" (list .Values.ingester.image) "context" $) -}}
{{- end }}

{{/*
Create image name for agent image
*/}}
{{- define "agent.image" -}}
{{- include "renderImage" ( dict "imageRoot" .Values.agent.image "context" $ ) -}}
{{- end -}}

{{/*
Create pull secrets for agent image
*/}}
{{- define "agent.imagePullSecrets" -}}
{{- include "common.images.renderPullSecrets" (dict "images" (list .Values.agent.image) "context" $) -}}
{{- end }}


{{/*
Create image name for collector image
*/}}
{{- define "collector.image" -}}
{{- include "renderImage" ( dict "imageRoot" .Values.collector.image "context" $ ) -}}
{{- end -}}

{{/*
Create pull secrets for collector image
*/}}
{{- define "collector.imagePullSecrets" -}}
{{- include "common.images.renderPullSecrets" (dict "images" (list .Values.collector.image) "context" $) -}}
{{- end }}

{{/*
Create image name for query image
*/}}
{{- define "query.image" -}}
{{- include "renderImage" ( dict "imageRoot" .Values.query.image "context" $ ) -}}
{{- end -}}

{{/*
Create pull secrets for query image
*/}}
{{- define "query.imagePullSecrets" -}}
{{- include "common.images.renderPullSecrets" (dict "images" (list .Values.query.image .Values.query.oAuthSidecar.image) "context" $) -}}
{{- end }}

{{/*
Create image name for oAuthSidecar image
*/}}
{{- define "oAuthSidecar.image" -}}
{{- include "common.images.image" (dict "imageRoot" .Values.query.oAuthSidecar.image "global" .Values.global) -}}
{{- end -}}

{{/*
Create image name for spark image
*/}}
{{- define "spark.image" -}}
{{- include "common.images.image" (dict "imageRoot" .Values.spark.image "global" .Values.global) -}}
{{- end -}}

{{/*
Create pull secrets for spark image
*/}}
{{- define "spark.imagePullSecrets" -}}
{{- include "common.images.renderPullSecrets" (dict "images" (list .Values.spark.image) "context" $) -}}
{{- end }}

{{/*
Create image name for esIndexCleaner image
*/}}
{{- define "esIndexCleaner.image" -}}
{{- include "renderImage" ( dict "imageRoot" .Values.esIndexCleaner.image "context" $ ) -}}
{{- end -}}

{{/*
Create pull secrets for esIndexCleaner image
*/}}
{{- define "esIndexCleaner.imagePullSecrets" -}}
{{- include "common.images.renderPullSecrets" (dict "images" (list .Values.esIndexCleaner.image) "context" $) -}}
{{- end }}

{{/*
Create image name for esRollover image
*/}}
{{- define "esRollover.image" -}}
{{- include "renderImage" ( dict "imageRoot" .Values.esRollover.image "context" $ ) -}}
{{- end -}}

{{/*
Create pull secrets for esRollover image
*/}}
{{- define "esRollover.imagePullSecrets" -}}
{{- include "common.images.renderPullSecrets" (dict "images" (list .Values.esRollover.image) "context" $) -}}
{{- end }}

{{/*
Create image name for esLookback image
*/}}
{{- define "esLookback.image" -}}
{{- include "renderImage" ( dict "imageRoot" .Values.esLookback.image "context" $ ) -}}
{{- end -}}

{{/*
Create pull secrets for esLookback image
*/}}
{{- define "esLookback.imagePullSecrets" -}}
{{- include "common.images.renderPullSecrets" (dict "images" (list .Values.esLookback.image) "context" $) -}}
{{- end }}

{{/*
Create image name for hotrod image
*/}}
{{- define "hotrod.image" -}}
{{- include "renderImage" ( dict "imageRoot" .Values.hotrod.image "context" $ ) -}}
{{- end -}}

{{/*
Create pull secrets for hotrod image
*/}}
{{- define "hotrod.imagePullSecrets" -}}
{{- include "common.images.renderPullSecrets" (dict "images" (list .Values.hotrod.image) "context" $) -}}
{{- end }}
9 changes: 3 additions & 6 deletions charts/jaeger/templates/agent-ds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ spec:
priorityClassName: {{ . }}
{{- end }}
serviceAccountName: {{ template "jaeger.agent.serviceAccountName" . }}
{{- with .Values.agent.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- include "agent.imagePullSecrets" . | nindent 6 }}
{{- if .Values.agent.initContainers }}
initContainers:
{{- toYaml .Values.agent.initContainers | nindent 8 }}
Expand All @@ -54,8 +51,8 @@ spec:
- name: {{ template "jaeger.agent.name" . }}
securityContext:
{{- toYaml .Values.agent.securityContext | nindent 10 }}
image: {{ .Values.agent.image }}:{{- .Values.agent.tag | default (include "jaeger.image.tag" .) }}
imagePullPolicy: {{ .Values.agent.pullPolicy }}
image: {{ include "agent.image" . }}
imagePullPolicy: {{ .Values.agent.image.pullPolicy }}
args:
{{ include "extra.cmdArgs" ( dict "cmdlineParams" .Values.agent.cmdlineParams ) | nindent 10 }}
env:
Expand Down
9 changes: 3 additions & 6 deletions charts/jaeger/templates/allinone-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ spec:
prometheus.io/port: "14269"
prometheus.io/scrape: "true"
spec:
{{- with .Values.allInOne.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- include "allInOne.imagePullSecrets" . | nindent 6 }}
containers:
- env:
{{- if .Values.allInOne.extraEnv }}
Expand All @@ -54,8 +51,8 @@ spec:
{{- with .Values.allInOne.envFrom }}
envFrom: {{- toYaml . | nindent 12 }}
{{- end }}
image: {{ .Values.allInOne.image }}:{{- .Values.allInOne.tag | default (include "jaeger.image.tag" .) }}
imagePullPolicy: {{ .Values.allInOne.pullPolicy }}
image: {{ include "allInOne.image" . }}
imagePullPolicy: {{ .Values.allInOne.image.pullPolicy }}
name: jaeger
args:
{{- range $arg := .Values.allInOne.args }}
Expand Down
9 changes: 3 additions & 6 deletions charts/jaeger/templates/cassandra-schema-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,11 @@ spec:
securityContext:
{{- toYaml .Values.schema.podSecurityContext | nindent 8 }}
serviceAccountName: {{ template "jaeger.cassandraSchema.serviceAccountName" . }}
{{- with .Values.schema.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- include "schema.imagePullSecrets" . | nindent 6 }}
containers:
- name: {{ include "jaeger.fullname" . }}-cassandra-schema
image: {{ .Values.schema.image }}:{{- include "jaeger.image.tag" . }}
imagePullPolicy: {{ .Values.schema.pullPolicy }}
image: {{ include "schema.image" . }}
imagePullPolicy: {{ .Values.schema.image.pullPolicy }}
securityContext:
{{- toYaml .Values.schema.securityContext | nindent 10 }}
env:
Expand Down
9 changes: 3 additions & 6 deletions charts/jaeger/templates/collector-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ spec:
securityContext:
{{- toYaml .Values.collector.podSecurityContext | nindent 8 }}
serviceAccountName: {{ template "jaeger.collector.serviceAccountName" . }}
{{- with .Values.collector.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- include "collector.imagePullSecrets" . | nindent 6 }}
{{- if .Values.collector.initContainers }}
initContainers:
{{- toYaml .Values.collector.initContainers | nindent 8 }}
Expand All @@ -50,8 +47,8 @@ spec:
- name: {{ template "jaeger.collector.name" . }}
securityContext:
{{- toYaml .Values.collector.securityContext | nindent 10 }}
image: {{ .Values.collector.image }}:{{- .Values.collector.tag | default (include "jaeger.image.tag" .) }}
imagePullPolicy: {{ .Values.collector.pullPolicy }}
image: {{ include "collector.image" . }}
imagePullPolicy: {{ .Values.collector.image.pullPolicy }}
args:
{{ include "extra.cmdArgs" ( dict "cmdlineParams" .Values.collector.cmdlineParams ) | nindent 10 }}
{{- if not .Values.ingester.enabled -}}
Expand Down
9 changes: 3 additions & 6 deletions charts/jaeger/templates/es-index-cleaner-cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,15 @@ spec:
{{- end }}
spec:
serviceAccountName: {{ template "jaeger.esIndexCleaner.serviceAccountName" . }}
{{- with .Values.esIndexCleaner.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- include "esIndexCleaner.imagePullSecrets" . | nindent 12 }}
securityContext:
{{- toYaml .Values.esIndexCleaner.podSecurityContext | nindent 12 }}
containers:
- name: {{ include "jaeger.fullname" . }}-es-index-cleaner
securityContext:
{{- toYaml .Values.esIndexCleaner.securityContext | nindent 14 }}
image: {{ .Values.esIndexCleaner.image }}:{{- .Values.esIndexCleaner.tag | default (include "jaeger.image.tag" .) }}
imagePullPolicy: {{ .Values.esIndexCleaner.pullPolicy }}
image: {{ include "esIndexCleaner.image" . }}
imagePullPolicy: {{ .Values.esIndexCleaner.image.pullPolicy }}
args:
- {{ .Values.esIndexCleaner.numberOfDays | quote }}
- {{ include "elasticsearch.client.url" . }}
Expand Down
9 changes: 3 additions & 6 deletions charts/jaeger/templates/es-lookback-cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ spec:
{{- end }}
spec:
serviceAccountName: {{ template "jaeger.esLookback.serviceAccountName" . }}
{{- with .Values.esLookback.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- include "esLookback.imagePullSecrets" . | nindent 12 }}
securityContext:
{{- toYaml .Values.esLookback.podSecurityContext | nindent 12 }}
restartPolicy: OnFailure
Expand All @@ -62,8 +59,8 @@ spec:
- name: {{ include "jaeger.fullname" . }}-es-lookback
securityContext:
{{- toYaml .Values.esLookback.securityContext | nindent 14 }}
image: "{{ .Values.esLookback.image }}:{{- include "jaeger.image.tag" . }}"
imagePullPolicy: {{ .Values.esLookback.pullPolicy }}
image: {{ include "esLookback.image" . }}
imagePullPolicy: {{ .Values.esLookback.image.pullPolicy }}
args:
- lookback
- {{ include "elasticsearch.client.url" . }}
Expand Down
9 changes: 3 additions & 6 deletions charts/jaeger/templates/es-rollover-cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ spec:
{{- end }}
spec:
serviceAccountName: {{ template "jaeger.esRollover.serviceAccountName" . }}
{{- with .Values.esRollover.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- include "esRollover.imagePullSecrets" . | nindent 10 }}
securityContext:
{{- toYaml .Values.esRollover.podSecurityContext | nindent 12 }}
restartPolicy: OnFailure
Expand All @@ -62,8 +59,8 @@ spec:
- name: {{ include "jaeger.fullname" . }}-es-rollover
securityContext:
{{- toYaml .Values.esRollover.securityContext | nindent 14 }}
image: "{{ .Values.esRollover.image }}:{{- include "jaeger.image.tag" . }}"
imagePullPolicy: {{ .Values.esRollover.pullPolicy }}
image: {{ include "esRollover.image" . }}
imagePullPolicy: {{ .Values.esRollover.image.pullPolicy }}
args:
- rollover
- {{ include "elasticsearch.client.url" . }}
Expand Down
8 changes: 3 additions & 5 deletions charts/jaeger/templates/es-rollover-hook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ spec:
{{- end }}
spec:
serviceAccountName: {{ template "jaeger.esRollover.serviceAccountName" . }}
{{- with .Values.esRollover.imagePullSecrets }}
imagePullSecrets: {{- toYaml . | nindent 8 }}
{{- end }}
{{- include "esRollover.imagePullSecrets" . | nindent 6 }}
securityContext: {{- toYaml .Values.esRollover.podSecurityContext | nindent 8 }}
restartPolicy: OnFailure
{{- with .Values.esRollover.nodeSelector }}
Expand All @@ -51,8 +49,8 @@ spec:
containers:
- name: {{ include "jaeger.fullname" . }}-es-rollover-init
securityContext: {{- toYaml .Values.esRollover.securityContext | nindent 12 }}
image: "{{ .Values.esRollover.image }}:{{ .Values.esRollover.tag }}"
imagePullPolicy: {{ .Values.esRollover.pullPolicy }}
image: {{ include "esRollover.image" . }}
imagePullPolicy: {{ .Values.esRollover.image.pullPolicy }}
args:
- init
- {{ include "elasticsearch.client.url" . }}
Expand Down
Loading

0 comments on commit 94cb97a

Please sign in to comment.