<p>I want to parse the following structure using go:</p>
<pre><code>---
prjA:
  user1:
    metadata:
      namespace: prj-ns
    spec:
      containers:
        - image: some-contaner:latest
          name: containerssh-client-image
          resources:
            limits:
              ephemeral-storage: 4Gi
            requests:
              ephemeral-storage: 2Gi
      securityContext:
        runAsGroup: 1000
        runAsNonRoot: true
        runAsUser: 1000
      imagePullSecrets:
        - docker-registry-secret
</code></pre>
<p>I'm using <code>sigs.k8s.io/yaml</code> to unmarshal YAML:</p>
<pre><code>var userConfig map[string]map[string]kubernetes.PodConfig
err = yaml.UnmarshalStrict(yamlFile, &amp;userConfig)
</code></pre>
<p>where kubernetes is imported from <code>github.com/containerssh/kubernetes</code>. Everything works fine - except the <code>immagePullSecrets</code> which gives the following error:</p>
<pre><code>ERROR unmarshal user config file; error [error unmarshaling JSON: while decoding JSON: json: cannot unmarshal string into Go struct field PodSpec.spec.imagePullSecrets of type v1.LocalObjectReference]
</code></pre>
<p>What is the correct way to specify / parse an <code>imagePullSecrets</code> in go?</p>

<p>This is a problem with the input - and maybe not a very clear error message.</p>
<p>The <code>imagePullSecrets</code> must be specified using the key <code>name</code> like:</p>
<pre><code>imagePullSecrets:
  - name: docker-registry-secret
</code></pre>
<p>I leave the question as it might help other people who run in the same problem.</p>
