Skip to content

[BUG][OpenSearch] Incorrect indentation for extraEnvs in statefulset.yaml #64

@mprimeaux

Description

@mprimeaux

Describe the bug
The Stateful Set template specifies an incorrect indentation of 10 for extraEnvs. The correct value should be 8.

Error

Error: INSTALLATION FAILED: YAML parse error on logging/charts/opensearch/templates/statefulset.yaml: error converting YAML to JSON: yaml: line 122: did not find expected key
make: *** [install] Error 1

To Reproduce
Steps to reproduce the behavior:

Specify values for the extraEnvs stanza in the values.yaml file for the OpenSearch chart. For example,

extraEnvs Example

extraEnvs:
  - name: NODE_TLS_REJECT_UNAUTHORIZED
    value: "0"

Expected behavior
The expected behavior is for the chart to install.

Chart Name
Specify the Chart which is affected? OpenSearch

Screenshots
None

Host/Environment (please complete the following information):

  • Helm Version: v3.7.0
  • Kubernetes Version: 1.21 (Amazon EKS)

Additional context

I have a fix for this defect already so will plan to submit a PR.

diff

diff --git a/charts/opensearch/templates/statefulset.yaml b/charts/opensearch/templates/statefulset.yaml
index 5087527..535d821 100644
--- a/charts/opensearch/templates/statefulset.yaml
+++ b/charts/opensearch/templates/statefulset.yaml
@@ -251,7 +251,7 @@ spec:
           fi

           cp -a {{ .Values.opensearchHome }}/config/opensearch.keystore /tmp/keystore/
-        env: {{ toYaml .Values.extraEnvs | nindent 10 }}
+        env: {{ toYaml .Values.extraEnvs | nindent 8 }}
         envFrom: {{ toYaml .Values.envFrom | nindent 10 }}
         resources: {{ toYaml .Values.initResources | nindent 10 }}
         volumeMounts:
@@ -318,11 +318,11 @@ spec:
           value: "{{ $enabled }}"
         {{- end }}
 {{- if .Values.extraEnvs }}
-{{ toYaml .Values.extraEnvs | indent 10 }}
+{{ toYaml .Values.extraEnvs | indent 8 }}
 {{- end }}
 {{- if .Values.envFrom }}
         envFrom:
-{{ toYaml .Values.envFrom | indent 10 }}
+{{ toYaml .Values.envFrom | indent 8 }}
 {{- end }}
         volumeMounts:
         {{- if .Values.persistence.enabled }}

After making this change, the chart deploys as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinguntriagedIssues that have not yet been triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions