Skip to content

Commit

Permalink
fix: Avoid error when no keystore files to import (#434)
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Hobbs <timothy.hobbs@servicelayers.com>
  • Loading branch information
hobti01 committed Jun 20, 2023
1 parent 086c522 commit 4e4f826
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
12 changes: 11 additions & 1 deletion charts/opensearch/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
### Security
---
## [2.13.2]
### Added
### Changed
### Deprecated
### Removed
### Fixed
- Avoid CrashLoop when keystore secret has no data
### Security
---
## [2.13.1]
### Added
- Support string type for extraObjects
Expand Down Expand Up @@ -284,7 +293,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Security


[Unreleased]: https://github.com/opensearch-project/helm-charts/compare/opensearch-2.13.1...HEAD
[Unreleased]: https://github.com/opensearch-project/helm-charts/compare/opensearch-2.13.2...HEAD
[2.13.2]: https://github.com/opensearch-project/helm-charts/compare/opensearch-2.13.1...opensearch-2.13.2
[2.13.1]: https://github.com/opensearch-project/helm-charts/compare/opensearch-2.13.0...opensearch-2.13.1
[2.13.0]: https://github.com/opensearch-project/helm-charts/compare/opensearch-2.12.0...opensearch-2.13.0
[2.12.0]: https://github.com/opensearch-project/helm-charts/compare/opensearch-2.11.5...opensearch-2.12.0
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: 2.13.1
version: 2.13.2

# 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
14 changes: 7 additions & 7 deletions charts/opensearch/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,8 @@ spec:
- 'chown -R 1000:1000 /usr/share/opensearch/data'
securityContext:
runAsUser: 0
resources:
resources:
{{- toYaml .Values.initResources | nindent 10 }}

volumeMounts:
- name: "{{ template "opensearch.uname" . }}"
mountPath: {{ .Values.opensearchHome }}/data
Expand All @@ -267,7 +266,7 @@ spec:
resources:
{{- toYaml .Values.initResources | nindent 10 }}
{{- end }}
{{ if .Values.keystore }}
{{- if .Values.keystore }}
- name: keystore
image: "{{ template "opensearch.dockerRegistry" . }}{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: "{{ .Values.image.pullPolicy }}"
Expand All @@ -281,6 +280,7 @@ spec:
{{ .Values.opensearchHome }}/bin/opensearch-keystore create
for i in /tmp/keystoreSecrets/*/*; do
[ -f "$file" ] || continue
key=$(basename $i)
echo "Adding file $i to keystore key $key"
{{ .Values.opensearchHome }}/bin/opensearch-keystore add-file "$key" "$i"
Expand All @@ -296,15 +296,15 @@ spec:
env: {{ toYaml .Values.extraEnvs | nindent 10 }}
envFrom: {{ toYaml .Values.envFrom | nindent 10 }}
resources:
{{ toYaml .Values.initResources | nindent 10 }}
{{- toYaml .Values.initResources | nindent 10 }}
volumeMounts:
- name: keystore
mountPath: /tmp/keystore
{{- range .Values.keystore }}
- name: keystore-{{ .secretName }}
mountPath: /tmp/keystoreSecrets/{{ .secretName }}
{{- end }}
{{ end }}
{{- end }}
{{- if .Values.extraInitContainers }}
# Currently some extra blocks accept strings
# to continue with backwards compatibility this is being kept
Expand Down Expand Up @@ -361,7 +361,7 @@ spec:
- name: metrics
containerPort: {{ .Values.metricsPort }}
resources:
{{ toYaml .Values.resources | indent 10 }}
{{- toYaml .Values.resources | nindent 10 }}
env:
- name: node.name
valueFrom:
Expand Down Expand Up @@ -517,7 +517,7 @@ spec:
sleep infinity &
wait $!
resources:
{{ toYaml .Values.sidecarResources | indent 10 }}
{{- toYaml .Values.sidecarResources | nindent 10 }}
env:
- name: NODE_NAME
valueFrom:
Expand Down

0 comments on commit 4e4f826

Please sign in to comment.