spotahome / redis-operator

Redis Operator creates/configures/manages high availability redis with sentinel automatic failover atop Kubernetes.
Apache License 2.0
1.5k stars 356 forks source link

Issue with `boolean` values as `string` in operator labels #548

Closed Kavinraja-G closed 1 year ago

Kavinraja-G commented 1 year ago

Expected behaviour

Adding labels: {"someKey": "true"} to values.yaml should render the helm templates and install the operator

Actual behaviour

Looks like we are using range to construct the labels from values.yaml on fly. But range doesn't preserve the dataType of what we pass it seems. So it fails to render the values as string even if we pass "true" or "false" consider them as bool and results in the below error

unable to decode "": json: cannot unmarshal bool into Go struct field ObjectMeta.metadata.labels of type string

Note: Labels only support string dataType for keys & values

Workaround

Modify the range and use toYaml functions which converts the values to string type as well

Steps to reproduce the behaviour

Describe step by step what you've have done to get to this point

Environment

How are the pieces configured?

Logs

Please, add the debugging logs. In order to be able to gather them, add -debug flag when running the operator.