Skip to content

Commit

Permalink
enable setting docker registry for all images (#70)
Browse files Browse the repository at this point in the history
Signed-off-by: Kenan Erdogan <[email protected]>
  • Loading branch information
bitnik authored Oct 7, 2021
1 parent 97300bd commit 3fcb0ee
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 5 deletions.
10 changes: 10 additions & 0 deletions charts/opensearch/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
### Security

---
## [1.0.5]
### Added
- In opensearch chart config to set the docker registry for images is added.
### Changed
### Deprecated
### Removed
### Fixed
### Security

---
## [1.0.4]
### Added
Expand Down
2 changes: 1 addition & 1 deletion charts/opensearch/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: 1.0.4
version: 1.0.5

# 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
Expand Down
1 change: 1 addition & 0 deletions charts/opensearch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ To delete/uninstall the chart with the release name `my-release`:
| `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 | `{}` |
| `opensearcjhJavaOpts` | Java options for OpenSearch. This is where you should configure the jvm heap size | `-Xmx1g -Xms1g` |
| `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`) | `""` |
| `global.dockerRegistry` | Set if you want to change the default docker registry, e.g. a private one. | `""` |
| `extraContainers` | Array of extra containers | `""` |
| `extraEnvs` | Extra environments variables to be passed to OpenSearch services | `[]` |
| `extraInitContainers` | Array of extra init containers | `[]` |
Expand Down
8 changes: 8 additions & 0 deletions charts/opensearch/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,11 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{- $version.Major }}
{{- end }}
{{- end }}

{{- define "opensearch.dockerRegistry" -}}
{{- if eq .Values.global.dockerRegistry "" -}}
{{- .Values.global.dockerRegistry -}}
{{- else -}}
{{- .Values.global.dockerRegistry | trimSuffix "/" | printf "%s/" -}}
{{- end -}}
{{- end -}}
8 changes: 4 additions & 4 deletions charts/opensearch/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ spec:
initContainers:
{{- if .Values.persistence.enabled }}
- name: fsgroup-volume
image: busybox
image: "{{ template "opensearch.dockerRegistry" . }}busybox:latest"
command: ['sh', '-c']
args:
- 'chown -R 1000:1000 /usr/share/opensearch/data'
Expand All @@ -227,7 +227,7 @@ spec:
{{- end }}
{{ if .Values.keystore }}
- name: keystore
image: "{{ .Values.image }}:{{ .Values.imageTag | default .Chart.AppVersion }}"
image: "{{ template "opensearch.dockerRegistry" . }}{{ .Values.image }}:{{ .Values.imageTag | default .Chart.AppVersion }}"
imagePullPolicy: "{{ .Values.imagePullPolicy }}"
command:
- sh
Expand Down Expand Up @@ -277,7 +277,7 @@ spec:
- name: "{{ template "opensearch.name" . }}"
securityContext:
{{ toYaml .Values.securityContext | indent 10 }}
image: "{{ .Values.image }}:{{ .Values.imageTag | default .Chart.AppVersion }}"
image: "{{ template "opensearch.dockerRegistry" . }}{{ .Values.image }}:{{ .Values.imageTag | default .Chart.AppVersion }}"
imagePullPolicy: "{{ .Values.imagePullPolicy }}"
ports:
- name: http
Expand Down Expand Up @@ -396,7 +396,7 @@ spec:
{{- if eq .Values.roles.master "true" }}
# This sidecar will prevent slow master re-election
- name: opensearch-master-graceful-termination-handler
image: "{{ .Values.image }}:{{ .Values.imageTag | default .Chart.AppVersion }}"
image: "{{ template "opensearch.dockerRegistry" . }}{{ .Values.image }}:{{ .Values.imageTag | default .Chart.AppVersion }}"
imagePullPolicy: "{{ .Values.imagePullPolicy }}"
command:
- "sh"
Expand Down
4 changes: 4 additions & 0 deletions charts/opensearch/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ minimumMasterNodes: 1
# if not set, falls back to parsing .Values.imageTag, then .Chart.appVersion.
majorVersion: ""

global:
# Set if you want to change the default docker registry, e.g. a private one.
dockerRegistry: ""

# Allows you to add any config files in {{ .Values.opensearchHome }}/config
opensearchHome: /usr/share/opensearch
# such as opensearch.yml and log4j2.properties
Expand Down

0 comments on commit 3fcb0ee

Please sign in to comment.