Export configmap should convert numerical and boolean values to string first · Issue #718 · configu/configu · GitHub
More Web Proxy on the site http://driver.im/
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi team, thanks for the nice project and we are trying to use configu to manage our configs in k8s deployments! However, we start seeing some issues when trying to adopt configu and this is a major one
Kubenetes config maps expect all values to be string, but configu has some type conversion to make numerical string into number and booleanic string to Boolean, but as the formatter is just putting the values as it is, so it will output config map with non string value. I could not find a way to stop this type convertion.
I have also try some work around - export to dotenv and use kubectl to create configmap from dotenv file, but this does not work. Reusing the same example, configu eval | configu export --format dotenv > my.env will give
Looks like it can solve the above two points, have name and all values are string, but the value of STRING_SPACE now got extra quotes. It is due to k8s considers the quote in env file as part of the literal, and maintainer expects the env to have the quotes removed at the first place instead of assuming k8s will remove it. (Maybe can also consider removing the extra quotes in dotenv export?)
However this workaround will leads to extra quote when outputting in other format, which I dont think is a proper way to solve the problem. So to really make the configmap export work nicely, I think configu need to convert the values to string before putting them into the yaml file, as no one would expect number and boolean value in a config map.
I have a quick implementation for this, will submit PR shortly.
Motivation
No response
Context
No response
The text was updated successfully, but these errors were encountered:
Thanks for bringing this up @dipsywong98! I totally agree we should standardize the config-map formatter, and we'll address this ASAP. I reviewed your PR (#719)—thanks for submitting! While it provides a quick fix, I'd suggest involving the official Kubernetes SDK to ensure full alignment with the Kubernetes specification.
Meanwhile, as a workaround, you can leverage Configu’s built-in export --template feature to control exactly how your ConfigMaps are formatted.
Suggestion
Hi team, thanks for the nice project and we are trying to use configu to manage our configs in k8s deployments! However, we start seeing some issues when trying to adopt configu and this is a major one
Kubenetes config maps expect all values to be string, but configu has some type conversion to make numerical string into number and booleanic string to Boolean, but as the formatter is just putting the values as it is, so it will output config map with non string value. I could not find a way to stop this type convertion.
For example with this
example.cfgu.yaml
and run
configu eval | configu export --format config-map
, I will expect it to givebut actually, it is
I have also try some work around - export to dotenv and use kubectl to create configmap from dotenv file, but this does not work. Reusing the same example,
configu eval | configu export --format dotenv > my.env
will giveThen convert to config map using
kubectl create configmap my-config --from-env-file=my.env --dry-run -o yaml
Looks like it can solve the above two points, have name and all values are string, but the value of STRING_SPACE now got extra quotes. It is due to k8s considers the quote in env file as part of the literal, and maintainer expects the env to have the quotes removed at the first place instead of assuming k8s will remove it. (Maybe can also consider removing the extra quotes in dotenv export?)
kubernetes-sigs/kustomize#4525 (comment)
https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#create-configmaps-from-files
So the only "working" workaround for putting bool/number value to configmap is putting extra quotes
can give
However this workaround will leads to extra quote when outputting in other format, which I dont think is a proper way to solve the problem. So to really make the configmap export work nicely, I think configu need to convert the values to string before putting them into the yaml file, as no one would expect number and boolean value in a config map.
I have a quick implementation for this, will submit PR shortly.
Motivation
No response
Context
No response
The text was updated successfully, but these errors were encountered: