Search code examples
kuberneteskubernetes-helm

How to solve Error: YAML to JSON: yaml: line 118: did not find expected key


Started working on deploying a node using a helm chart. I am attempting to do some helm deployments with a makefile that has upgrade attributed to helm upgrade $(name) . --namespace name. So I run make upgrade and I got an error as shown:

walk.go:74: found symbolic link in path: /Users/samuelarogbonlo/Desktop/mina/helm/generic-node/Makefile resolves to /Users/samuelarogbonlo/Desktop/mina/helm/common/Makefile
Error: UPGRADE FAILED: YAML parse error on generic-node/templates/generic-node.yaml: error converting YAML to JSON: yaml: line 118: did not find expected key
make: *** [upgrade] Error 1

I have attempted to remove | quote but it did not change the situation and I have some guesses that it has to do with the brackets but all trials have failed.

My rendered yaml file is shown thus:


        - name: SECRET_USERNAME
          valueFrom:
            secretKeyRef:
              name: source-libp2p-keys
              key: key
        - name: SECRET_PASSWORD
          valueFrom:
            secretKeyRef:
              name: source-libp2p-keys
              key: "some-libp2p-key"
         - name: SECRET_USERNAME
          valueFrom:
            secretKeyRef:
              name: private-keys
              key: key
        - name: SECRET_PASSWORD
          valueFrom:
            secretKeyRef:
              name: private-keys
              key: ""
 

Error: YAML parse error on generic-node/templates/generic-node.yaml: error converting YAML to JSON: yaml: line 118: did not find expected key
helm.go:88: [debug] error converting YAML to JSON: yaml: line 118: did not find expected key
YAML parse error on generic-node/templates/generic-node.yaml
helm.sh/helm/v3/pkg/releaseutil.(*manifestFile).sort
        helm.sh/helm/v3/pkg/releaseutil/manifest_sorter.go:146
helm.sh/helm/v3/pkg/releaseutil.SortManifests
        helm.sh/helm/v3/pkg/releaseutil/manifest_sorter.go:106
helm.sh/helm/v3/pkg/action.(*Configuration).renderResources

I really need help on how to sort this out because even my values.yaml file has the values of graphql referenced as well.

Thanks.


Solution

  • The error is here:

            - name: SECRET_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: source-libp2p-keys
                  key: "some-libp2p-key"
             - name: SECRET_USERNAME
              valueFrom:
                secretKeyRef:
                  name: private-keys
                  key: key
    

    The line - name SECRET_USERNAME is indented one space too much. Put it at the same indentation as the previous - name: SECRET_PASSWORD.