Skip to content

Commit 3fcb0ee

Browse files
authored
enable setting docker registry for all images (#70)
Signed-off-by: Kenan Erdogan <[email protected]>
1 parent 97300bd commit 3fcb0ee

File tree

6 files changed

+28
-5
lines changed

6 files changed

+28
-5
lines changed

charts/opensearch/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
### Fixed
1414
### Security
1515

16+
---
17+
## [1.0.5]
18+
### Added
19+
- In opensearch chart config to set the docker registry for images is added.
20+
### Changed
21+
### Deprecated
22+
### Removed
23+
### Fixed
24+
### Security
25+
1626
---
1727
## [1.0.4]
1828
### Added

charts/opensearch/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 1.0.4
18+
version: 1.0.5
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to

charts/opensearch/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ To delete/uninstall the chart with the release name `my-release`:
4444
| `config` | Allows you to add any config files in `/usr/share/opensearch/config/` such as `opensearch.yml` and `log4j2.properties`. See [values.yaml][] for an example of the formatting | `{}` |
4545
| `opensearcjhJavaOpts` | Java options for OpenSearch. This is where you should configure the jvm heap size | `-Xmx1g -Xms1g` |
4646
| `majorVersion` | Used to set major version specific configuration. If you are using a custom image and not running the default OpenSearch version you will need to set this to the version you are running (e.g. `majorVersion: 1`) | `""` |
47+
| `global.dockerRegistry` | Set if you want to change the default docker registry, e.g. a private one. | `""` |
4748
| `extraContainers` | Array of extra containers | `""` |
4849
| `extraEnvs` | Extra environments variables to be passed to OpenSearch services | `[]` |
4950
| `extraInitContainers` | Array of extra init containers | `[]` |

charts/opensearch/templates/_helpers.tpl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,11 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
5959
{{- $version.Major }}
6060
{{- end }}
6161
{{- end }}
62+
63+
{{- define "opensearch.dockerRegistry" -}}
64+
{{- if eq .Values.global.dockerRegistry "" -}}
65+
{{- .Values.global.dockerRegistry -}}
66+
{{- else -}}
67+
{{- .Values.global.dockerRegistry | trimSuffix "/" | printf "%s/" -}}
68+
{{- end -}}
69+
{{- end -}}

charts/opensearch/templates/statefulset.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ spec:
215215
initContainers:
216216
{{- if .Values.persistence.enabled }}
217217
- name: fsgroup-volume
218-
image: busybox
218+
image: "{{ template "opensearch.dockerRegistry" . }}busybox:latest"
219219
command: ['sh', '-c']
220220
args:
221221
- 'chown -R 1000:1000 /usr/share/opensearch/data'
@@ -227,7 +227,7 @@ spec:
227227
{{- end }}
228228
{{ if .Values.keystore }}
229229
- name: keystore
230-
image: "{{ .Values.image }}:{{ .Values.imageTag | default .Chart.AppVersion }}"
230+
image: "{{ template "opensearch.dockerRegistry" . }}{{ .Values.image }}:{{ .Values.imageTag | default .Chart.AppVersion }}"
231231
imagePullPolicy: "{{ .Values.imagePullPolicy }}"
232232
command:
233233
- sh
@@ -277,7 +277,7 @@ spec:
277277
- name: "{{ template "opensearch.name" . }}"
278278
securityContext:
279279
{{ toYaml .Values.securityContext | indent 10 }}
280-
image: "{{ .Values.image }}:{{ .Values.imageTag | default .Chart.AppVersion }}"
280+
image: "{{ template "opensearch.dockerRegistry" . }}{{ .Values.image }}:{{ .Values.imageTag | default .Chart.AppVersion }}"
281281
imagePullPolicy: "{{ .Values.imagePullPolicy }}"
282282
ports:
283283
- name: http
@@ -396,7 +396,7 @@ spec:
396396
{{- if eq .Values.roles.master "true" }}
397397
# This sidecar will prevent slow master re-election
398398
- name: opensearch-master-graceful-termination-handler
399-
image: "{{ .Values.image }}:{{ .Values.imageTag | default .Chart.AppVersion }}"
399+
image: "{{ template "opensearch.dockerRegistry" . }}{{ .Values.image }}:{{ .Values.imageTag | default .Chart.AppVersion }}"
400400
imagePullPolicy: "{{ .Values.imagePullPolicy }}"
401401
command:
402402
- "sh"

charts/opensearch/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ minimumMasterNodes: 1
2020
# if not set, falls back to parsing .Values.imageTag, then .Chart.appVersion.
2121
majorVersion: ""
2222

23+
global:
24+
# Set if you want to change the default docker registry, e.g. a private one.
25+
dockerRegistry: ""
26+
2327
# Allows you to add any config files in {{ .Values.opensearchHome }}/config
2428
opensearchHome: /usr/share/opensearch
2529
# such as opensearch.yml and log4j2.properties

0 commit comments

Comments
 (0)