Skip to content

Commit

Permalink
Allow to split the image registry and the repository
Browse files Browse the repository at this point in the history
  • Loading branch information
aacevedoosorio committed Oct 30, 2024
1 parent b8406fc commit aa8309b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/opentelemetry-collector/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: opentelemetry-collector
version: 0.108.0
version: 0.108.1
description: OpenTelemetry Collector Helm chart for Kubernetes
type: application
home: https://opentelemetry.io/
Expand Down
7 changes: 7 additions & 0 deletions charts/opentelemetry-collector/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,10 @@ Create ConfigMap checksum annotation if configMap.existingPath is defined, other
{{- end -}}
{{- end }}
{{- end }}

{{/*
Return the the image registry.
*/}}
{{- define "opentelemetry-collector.imageRegistry" -}}
{{ default .Values.image.registry (.Values.global).imageRegistry }}
{{- end }}
5 changes: 3 additions & 2 deletions charts/opentelemetry-collector/templates/_pod.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ containers:
{{- else -}}
{{- toYaml .Values.securityContext | nindent 6 }}
{{- end }}
{{- $imageRegistry := include "opentelemetry-collector.imageRegistry" . -}}
{{- if .Values.image.digest }}
image: "{{ ternary "" (print (.Values.global).imageRegistry "/") (empty (.Values.global).imageRegistry) }}{{ .Values.image.repository }}@{{ .Values.image.digest }}"
image: "{{ ternary "" (print $imageRegistry "/") (empty $imageRegistry) }}{{ .Values.image.repository }}@{{ .Values.image.digest }}"
{{- else }}
image: "{{ ternary "" (print (.Values.global).imageRegistry "/") (empty (.Values.global).imageRegistry) }}{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
image: "{{ ternary "" (print $imageRegistry "/") (empty $imageRegistry) }}{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
{{- end }}
imagePullPolicy: {{ .Values.image.pullPolicy }}

Expand Down
1 change: 1 addition & 0 deletions charts/opentelemetry-collector/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ config:
alternateConfig: {}

image:
registry: ""
# If you want to use the core image `otel/opentelemetry-collector`, you also need to change `command.name` value to `otelcol`.
repository: ""
pullPolicy: IfNotPresent
Expand Down

0 comments on commit aa8309b

Please sign in to comment.