From fed7f3104d5fd7544c85b6651501851a762f311a Mon Sep 17 00:00:00 2001 From: Prudhvi Godithi Date: Tue, 6 Feb 2024 19:45:03 -0800 Subject: [PATCH] Bug Fix configMap Read-only file system error Signed-off-by: Prudhvi Godithi --- charts/opensearch/CHANGELOG.md | 12 ++++++- charts/opensearch/Chart.yaml | 2 +- charts/opensearch/templates/statefulset.yaml | 37 ++++++++++++++++---- 3 files changed, 42 insertions(+), 9 deletions(-) diff --git a/charts/opensearch/CHANGELOG.md b/charts/opensearch/CHANGELOG.md index df75f452..535eb257 100644 --- a/charts/opensearch/CHANGELOG.md +++ b/charts/opensearch/CHANGELOG.md @@ -13,6 +13,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed ### Security +--- +## [2.17.3] +### Added +### Changed +### Deprecated +### Removed +### Fixed +- Bug `opensearch.yml` configMap Read-only file system error. +### Security --- ## [2.17.2] ### Added @@ -375,7 +384,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.17.2...HEAD +[Unreleased]: https://github.com/opensearch-project/helm-charts/compare/opensearch-2.17.3...HEAD +[2.17.3]: https://github.com/opensearch-project/helm-charts/compare/opensearch-2.17.2...opensearch-2.17.3 [2.17.2]: https://github.com/opensearch-project/helm-charts/compare/opensearch-2.17.1...opensearch-2.17.2 [2.17.1]: https://github.com/opensearch-project/helm-charts/compare/opensearch-2.17.0...opensearch-2.17.1 [2.17.0]: https://github.com/opensearch-project/helm-charts/compare/opensearch-2.16.1...opensearch-2.17.0 diff --git a/charts/opensearch/Chart.yaml b/charts/opensearch/Chart.yaml index b40f6979..1387b071 100644 --- a/charts/opensearch/Chart.yaml +++ b/charts/opensearch/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: 2.17.2 +version: 2.17.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 diff --git a/charts/opensearch/templates/statefulset.yaml b/charts/opensearch/templates/statefulset.yaml index ce26175a..72e14976 100644 --- a/charts/opensearch/templates/statefulset.yaml +++ b/charts/opensearch/templates/statefulset.yaml @@ -156,6 +156,13 @@ spec: {{- end }} terminationGracePeriodSeconds: {{ .Values.terminationGracePeriod }} volumes: + {{- if .Values.config }} + - name: config + configMap: + name: {{ template "opensearch.uname" . }}-config + - emptyDir: {} + name: config-emptydir + {{- end }} {{- range .Values.secretMounts }} - name: {{ .name | required "secretMount .name is required" }} secret: @@ -164,11 +171,6 @@ spec: defaultMode: {{ .defaultMode }} {{- end }} {{- end }} - {{- if .Values.config }} - - name: config - configMap: - name: {{ template "opensearch.uname" . }}-config - {{- end }} {{- if and .Values.securityConfig.config.data .Values.securityConfig.config.securityConfigSecret }} {{ fail "Only one of .Values.securityConfig.config.data and .Values.securityConfig.config.securityConfigSecret may be defined. Please see the comment in values.yaml describing usage." }} {{- end }} @@ -238,7 +240,7 @@ spec: {{- if .Values.hostAliases }} hostAliases: {{ toYaml .Values.hostAliases | nindent 8 }} {{- end }} - {{- if or (.Values.extraInitContainers) (.Values.keystore) (.Values.persistence.enabled) (.Values.sysctlInit.enabled) }} + {{- if or (.Values.extraInitContainers) (.Values.keystore) (.Values.persistence.enabled) (.Values.sysctlInit.enabled) (.Values.config) }} initContainers: {{- if and .Values.persistence.enabled .Values.persistence.enableInitChown }} - name: fsgroup-volume @@ -275,6 +277,27 @@ spec: resources: {{- toYaml .Values.initResources | nindent 10 }} {{- end }} +{{- if .Values.config }} + - name: configfile + image: "{{ template "opensearch.dockerRegistry" . }}{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: "{{ .Values.image.pullPolicy }}" + command: + - sh + - -c + - | + #!/usr/bin/env bash + cp -r /tmp/configfolder/* /tmp/config/ + resources: + {{- toYaml .Values.initResources | nindent 10 }} + volumeMounts: + - mountPath: /tmp/config/ + name: config-emptydir + {{- range $path, $config := .Values.config }} + - name: config + mountPath: /tmp/configfolder/{{ $path }} + subPath: {{ $path }} + {{- end -}} +{{- end }} {{- if .Values.keystore }} - name: keystore image: "{{ template "opensearch.dockerRegistry" . }}{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" @@ -470,7 +493,7 @@ spec: {{- end }} {{- end }} {{- range $path, $config := .Values.config }} - - name: config + - name: config-emptydir mountPath: {{ $.Values.opensearchHome }}/config/{{ $path }} subPath: {{ $path }} {{- end -}}