<p>I am trying to deploy my Kubernetes app and it keeps throwing the error:</p>
<pre><code>Exception while processing templates/deployment.yaml
ERROR   2021-06-17 14:57:05    Invalid Kubernetes YAML Spec. mapping values are not allowed here
ERROR   2021-06-17 14:57:05     in 'string', line 27, column 24:
ERROR   2021-06-17 14:57:05                      valueFrom:
</code></pre>
<p>From this error, I can at least narrow it down to my deployment.yaml file.  Further with the &quot;valueFrom&quot; error, I can follow it down to &quot;env:&quot; section.  From there I believe it to be a formatting issue.</p>
<p>Deployment.yaml</p>
<pre><code>{{- if .Values.env.config}}
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{.Values.name}}
data:
{{.Values.env.config | toYaml | indent 2}}
---
{{- end}}

{{- if .Values.env.secrets}}
apiVersion: v1
kind: Secret
metadata:
  name: {{.Values.name}}
stringData:
{{.Values.env.secrets | toYaml | indent 2}}
---
{{- end}}

{{- if .Values.dockercfg}}
apiVersion: v1
kind: Secret
metadata:
  name: {{.Values.name}}-dockercfg
  annotations:
    harness.io/skip-versioning: true
data:
  .dockercfg: {{.Values.dockercfg}}
type: kubernetes.io/dockercfg
---
{{- end}}

apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{.Values.name}}-deployment
spec:
  replicas: {{int .Values.replicas}}
  selector:
    matchLabels:
      app: {{.Values.name}}
  template:
    metadata:
      labels:
        app: {{.Values.name}}
        tags.datadoghq.com/env: {{.Values.environment_name}}
        tags.datadoghq.com/service: {{.Values.name}}
        tags.datadoghq.com/version: &quot;{{.Values.version}}&quot;
    spec:
      {{- if .Values.dockercfg}}
      imagePullSecrets:
      - name: {{.Values.name}}-dockercfg
      {{- end}}
      serviceAccountName: {{.Values.name}}-service-account
      containers:
      - name: {{.Values.name}}
        image: {{.Values.image}}
        env:
          - name: FILE_SYSTEM_ID
              valueFrom:
                configMapKeyRef:
                  name: efs-provisioner
                  key: file.system.id
          - name: AWS_REGION
              valueFrom:
                configMapKeyRef:
                  name: efs-provisioner
                  key: aws.region
          - name: PROVISIONER_NAME
              valueFrom:
                configMapKeyRef:
                  name: efs-provisioner
                  key: provisioner.name
          - name: DD_AGENT_HOST
            valueFrom:
              fieldRef:
                fieldPath: status.hostIP
          volumeMounts:
            - name: pv-volume
              mountPath: /usr/local/share/mapserver
      volumes:
        - name: pv-volume
          nfs:
            server: {{.Values.EFS_ID}}.efs.{{.Values.AWS_REGION}}.amazonaws.com
            path: /
        {{- if or .Values.env.config .Values.env.secrets}}
        envFrom:
        {{- if .Values.env.config}}
        - configMapRef:
            name: {{.Values.name}}
        {{- end}}
        {{- if .Values.env.secrets}}
        - secretRef:
            name: {{.Values.name}}
        {{- end}}
        {{- end}}
</code></pre>
<p>I am new to using Kubernetes and YAML.  I believe this to be a formatting issue, however whereever I look the formatting looks correct.</p>

sd-gallowaystorm
<p>Looks like this is an indentation issue:</p>
<pre><code>- name: FILE_SYSTEM_ID
    valueFrom:
      configMapKeyRef:
</code></pre>
<p>should be</p>
<pre><code>- name: FILE_SYSTEM_ID
  valueFrom:
    configMapKeyRef:
</code></pre>
