Helm: mimir-distributed value `externalConfigVersion` must be quoted when rendered
Describe the bug
The default externalConfigVersion value is '0', which suggests that numeric values as strings should work correctly, however the value is rendered unquoted by the template helper, resulting in the following output:
annotations:
checksum/config: 0
Annotation values must be strings.
To Reproduce
- Deploy
mimir-distributedhelm chart withuseExternalConfig: true. - Deployment is rejected due to malformed annotations.
Expected behavior
The externalConfigVersion value should be rendered enclosed in quotes:
annotations:
checksum/config: "0"
Environment
- Infrastructure: Kubernetes
- Deployment tool: helm
Additional Context
Helm error:
failed to create resource: Deployment in version "v1" cannot be handled as a Deployment: json: cannot unmarshal number into Go struct field ObjectMeta.spec.template.metadata.annotations of type string
Facing the same issue here. Is there any work around ?
Yes, you can use a value that can only be interpreted as stringish, ie - aaa instead of '0'
But checksum/config is autogenerated. So will have to modify the templates, right ?
This issue only applies when you have useExternalConfig enabled, in which case the value of externalConfigVersion is used verbatim in the annotation. Otherwise, the annotation contains a hash of the config contents, which should be a long string value, though quoting the hash wouldn't hurt either.
Ohhh...Thanks indeed for that ! I quoted the externalConfigVersion with some strings and it works ! Appreciate your help !
+1
I am not convinced this should be a concern of the mimir-distributed chart. This is a general rule for kubernetes annotations (See first Note in docs). I don't think you should get different validation for annotations on an nginx deployed via this chart vs an nginx deployed via any other chart or an nginx deployed without helm.
@dimitarvdimitrov you misunderstand the problem - when a string value is provided that contains content that can be interpreted as a number, it is rendered as numeric, not as the original string.
thanks for clarifying; i opened a PR to fix this https://github.com/grafana/mimir/pull/6407