Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 1.x] Avoid CrashLoop when keystore secret has no data #443

Merged
merged 1 commit into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions charts/opensearch/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
### Security
---
## [1.20.3]
### Added
- Avoid CrashLoop when keystore secret has no data
### Changed
### Deprecated
### Removed
### Fixed
### Security
---
## [1.20.2]
### Added
- Support string type for extraObjects
Expand Down Expand Up @@ -307,7 +316,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Deprecated
### Removed
### Fixed
- Fixed `image.pullPolicy` Helm value not setting the `imagePullPolicy` for the "opensearch" container
- Fixed `image.pullPolicy` Helm value not setting the `imagePullPolicy` for the "opensearch" container
### Security
---
## [1.7.0]
Expand Down Expand Up @@ -600,7 +609,8 @@ config:
### Fixed
### Security

[Unreleased]: https://github.com/opensearch-project/helm-charts/compare/opensearch-1.20.2...HEAD
[Unreleased]: https://github.com/opensearch-project/helm-charts/compare/opensearch-1.20.3...HEAD
[1.20.3]: https://github.com/opensearch-project/helm-charts/compare/opensearch-1.20.2...opensearch-1.20.3
[1.20.2]: https://github.com/opensearch-project/helm-charts/compare/opensearch-1.20.1...opensearch-1.20.2
[1.20.1]: https://github.com/opensearch-project/helm-charts/compare/opensearch-1.20.0...opensearch-1.20.1
[1.20.0]: https://github.com/opensearch-project/helm-charts/compare/opensearch-1.19.2...opensearch-1.20.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: 1.20.2
version: 1.20.3

# 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
23 changes: 12 additions & 11 deletions charts/opensearch/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ spec:
- name: keystore-{{ .secretName }}
secret: {{ toYaml . | nindent 12 }}
{{- end }}
{{ end }}
{{- end }}
{{- if .Values.extraVolumes }}
# Currently some extra blocks accept strings
# to continue with backwards compatibility this is being kept
Expand Down Expand Up @@ -237,8 +237,8 @@ spec:
- 'chown -R 1000:1000 /usr/share/opensearch/data'
securityContext:
runAsUser: 0
resources:
{{ toYaml .Values.initResources | nindent 10 }}
resources:
{{- toYaml .Values.initResources | nindent 10 }}
volumeMounts:
- name: "{{ template "opensearch.uname" . }}"
mountPath: {{ .Values.opensearchHome }}/data
Expand All @@ -261,9 +261,9 @@ spec:
runAsUser: 0
privileged: true
resources:
{{ toYaml .Values.initResources | nindent 10 }}
{{- 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 @@ -277,6 +277,7 @@ spec:
{{ .Values.opensearchHome }}/bin/opensearch-keystore create

for i in /tmp/keystoreSecrets/*/*; do
[ -f "$i" ] || continue
key=$(basename $i)
echo "Adding file $i to keystore key $key"
{{ .Values.opensearchHome }}/bin/opensearch-keystore add-file "$key" "$i"
Expand All @@ -291,16 +292,16 @@ spec:
cp -a {{ .Values.opensearchHome }}/config/opensearch.keystore /tmp/keystore/
env: {{ toYaml .Values.extraEnvs | nindent 10 }}
envFrom: {{ toYaml .Values.envFrom | nindent 10 }}
resources:
{{ toYaml .Values.initResources | nindent 10 }}
resources:
{{- 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 @@ -330,7 +331,7 @@ spec:

bash opensearch-docker-entrypoint.sh
{{- end }}

image: "{{ template "opensearch.dockerRegistry" . }}{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: "{{ .Values.image.pullPolicy }}"
readinessProbe:
Expand All @@ -357,7 +358,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 @@ -513,7 +514,7 @@ spec:
sleep infinity &
wait $!
resources:
{{ toYaml .Values.sidecarResources | indent 10 }}
{{- toYaml .Values.sidecarResources | nindent 10 }}
env:
- name: NODE_NAME
valueFrom:
Expand Down
Loading