What is the YAML interface syntax. Error while decoding JSON: json: cannot unmarshal string into Go value of type map[string]interface {} Redis

Viewed 24

In this values file there is a setting that says you can list out other namespaces to give access to Redis cluster.

I am running this command

helm upgrade --install -f .\redis-cluster-values.yml redis-mqtt-stream bitnami/redis-cluster --create-namespace -n $NAMESPACE_REDIS_EMQX

I am getting this error

Error: failed to parse .\redis-cluster-values.yml: error unmarshaling JSON: while decoding JSON: json: cannot unmarshal string into Go value of type map[string]interface {}

The values below Are what I changed the value.yaml file to. I am not understanding the proper way to right the values in the values.yaml file.

Values Yaml

 networkPolicy:
 ## Altered 1
 enabled: true
 ## When set to false, only pods with the correct
 ## client label will have network access to the port Redis® is listening
 ## on. When true, Redis® will accept connections from any source
 ## (with the correct destination port).
 ##
 allowExternal: true
 ingressNSMatchLabels: {
   "kubernetes.io/metadata.name": "some-value",
   "name": "some-value"
 }

The original syntax is this

 networkPolicy:
 ## Altered 1
 enabled: true
 ## When set to false, only pods with the correct
 ## client label will have network access to the port Redis® is listening
 ## on. When true, Redis® will accept connections from any source
 ## (with the correct destination port).
 ##
 allowExternal: true
 ingressNSMatchLabels: {}

What are you supposed to do with this syntax >> someSyntax: {} in a yaml file being processed by go / helm?

Why would my above try result in error? It appears to be either a starter block i.e. this block is empty or an interface but I can't tell because it is being processed by helm.

The example from the repository shows this

 networkPolicy:
   enabled: true
   ingressNSMatchLabels:
     redis: external
   ingressNSPodMatchLabels:
     redis-client: true

but I can't even get that exact syntax to work in the yaml file processed by helm. How should I write the value for the parameter the correct way?

Also, is there specific documentation for this. It's the second time I have delt with such a file and got the same error.

As well, the example / sample illustration of this doesn't make sense. There are specific values in a config or kubernetes file so I don't understand why the instruction's can't be more clear.

With networkPolicy.ingressNSMatchLabels pods from other namespaces can connect to redis. Set networkPolicy.ingressNSPodMatchLabels to match pod labels in matched namespace. For example, for a namespace labeled redis=external and pods in that namespace labeled redis-client=true the fields should be set:

 kind: Namespace
   apiVersion: v1
   metadata:
     name: some-value
     uid: some-value
     resourceVersion: '33033'
     creationTimestamp: '2022-09-08T04:39:34Z'
     labels:
       kubernetes.io/metadata.name: some-value
       name: some-value

Do you want the labels or do you want the name???

0 Answers
Related