From 162865acd0de3fb85b9642e592e7cbac2b95ebf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20H=C3=B8ydahl?= Date: Tue, 10 Dec 2024 10:03:26 +0100 Subject: [PATCH] Add configurable global.dockerRegistry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan Høydahl --- charts/data-prepper/CHANGELOG.md | 6 +++++- charts/data-prepper/Chart.yaml | 2 +- charts/data-prepper/README.md | 1 + charts/data-prepper/templates/_helpers.tpl | 11 +++++++++++ charts/data-prepper/templates/deployment.yaml | 2 +- charts/data-prepper/values.yaml | 4 ++++ 6 files changed, 23 insertions(+), 3 deletions(-) diff --git a/charts/data-prepper/CHANGELOG.md b/charts/data-prepper/CHANGELOG.md index d0b61260..4c5888b4 100644 --- a/charts/data-prepper/CHANGELOG.md +++ b/charts/data-prepper/CHANGELOG.md @@ -4,7 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [0.2.0] +### Added +- Added configurable `global.dockerRegistry` + +## [0.1.0] ### Added - Create initial version of data-prepper helm chart diff --git a/charts/data-prepper/Chart.yaml b/charts/data-prepper/Chart.yaml index dd53bd76..dfeeea98 100644 --- a/charts/data-prepper/Chart.yaml +++ b/charts/data-prepper/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.0 +version: 0.2.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/data-prepper/README.md b/charts/data-prepper/README.md index d35c92f7..40c87464 100644 --- a/charts/data-prepper/README.md +++ b/charts/data-prepper/README.md @@ -85,6 +85,7 @@ We welcome contributions! Please read our [CONTRIBUTING.md](../../CONTRIBUTING.m | config."log4j2-rolling.properties" | string | `"#\n# Copyright OpenSearch Contributors\n# SPDX-License-Identifier: Apache-2.0\n#\n\nstatus = error\ndest = err\nname = PropertiesConfig\n\nproperty.filename = log/data-prepper/data-prepper.log\n\nappender.console.type = Console\nappender.console.name = STDOUT\nappender.console.layout.type = PatternLayout\nappender.console.layout.pattern = %d{ISO8601} [%t] %-5p %40C - %m%n\n\nappender.rolling.type = RollingFile\nappender.rolling.name = RollingFile\nappender.rolling.fileName = ${filename}\nappender.rolling.filePattern = logs/data-prepper.log.%d{MM-dd-yy-HH}-%i.gz\nappender.rolling.layout.type = PatternLayout\nappender.rolling.layout.pattern = %d{ISO8601} [%t] %-5p %40C - %m%n\nappender.rolling.policies.type = Policies\nappender.rolling.policies.time.type = TimeBasedTriggeringPolicy\nappender.rolling.policies.time.interval = 1\nappender.rolling.policies.time.modulate = true\nappender.rolling.policies.size.type = SizeBasedTriggeringPolicy\nappender.rolling.policies.size.size=100MB\nappender.rolling.strategy.type = DefaultRolloverStrategy\nappender.rolling.strategy.max = 168\n\nrootLogger.level = warn\nrootLogger.appenderRef.stdout.ref = STDOUT\nrootLogger.appenderRef.file.ref = RollingFile\n\nlogger.pipeline.name = org.opensearch.dataprepper.pipeline\nlogger.pipeline.level = info\n\nlogger.parser.name = org.opensearch.dataprepper.parser\nlogger.parser.level = info\n\nlogger.plugins.name = org.opensearch.dataprepper.plugins\nlogger.plugins.level = info\n"` | Log4j2 configuration for Data Prepper logging | | extraEnvs | list | `[]` | Extra environment variables to pass to the Data Prepper container | | fullnameOverride | string | `""` | Override the default fullname for the deployment | +| global.dockerRegistry | string | `""` | Set if you want to change the default docker registry, e.g. a private one. | | image.pullPolicy | string | `"IfNotPresent"` | The image tag to pull. Default: IfNotPresent | | image.repository | string | `"opensearchproject/data-prepper"` | The image repository from which to pull the Data Prepper image | | image.tag | string | `""` | Overrides the image tag whose default is the chart appVersion. | diff --git a/charts/data-prepper/templates/_helpers.tpl b/charts/data-prepper/templates/_helpers.tpl index e5e11945..4f808c76 100644 --- a/charts/data-prepper/templates/_helpers.tpl +++ b/charts/data-prepper/templates/_helpers.tpl @@ -60,3 +60,14 @@ Create the name of the service account to use {{- default "default" .Values.serviceAccount.name }} {{- end }} {{- end }} + +{{/* +Create the dockerRegistry prefix if defined +*/}} +{{- define "data-prepper.dockerRegistry" -}} +{{- if eq .Values.global.dockerRegistry "" -}} + {{- .Values.global.dockerRegistry -}} +{{- else -}} + {{- .Values.global.dockerRegistry | trimSuffix "/" | printf "%s/" -}} +{{- end -}} +{{- end -}} diff --git a/charts/data-prepper/templates/deployment.yaml b/charts/data-prepper/templates/deployment.yaml index 3db562c7..61327d85 100644 --- a/charts/data-prepper/templates/deployment.yaml +++ b/charts/data-prepper/templates/deployment.yaml @@ -44,7 +44,7 @@ spec: {{- end }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + image: "{{ template "data-prepper.dockerRegistry" . }}{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} ports: {{- range .Values.ports }} diff --git a/charts/data-prepper/values.yaml b/charts/data-prepper/values.yaml index b63cf837..d74efa25 100644 --- a/charts/data-prepper/values.yaml +++ b/charts/data-prepper/values.yaml @@ -7,6 +7,10 @@ replicaCount: 1 +global: + # Set if you want to change the default docker registry, e.g. a private one. + dockerRegistry: "" + image: # -- The image repository from which to pull the Data Prepper image repository: opensearchproject/data-prepper