configMapGenerator / "kubectl create configmap" not adding quotes to large (>64-bit) hex numbers. #5432
Labels
kind/bug
Categorizes issue or PR as related to a bug.
triage/accepted
Indicates an issue or PR is ready to be actively worked on.
What happened?
Hi,
I'm using
configMapgenerator
with a .env file that contains a variable whose value is a 128-bit number in hex notation.I've discovered that
configMapGenerator
(and alsokubectl create configmap
) processes 64-bit and larger than 64-bit hex numbers differently, adding quotes to the generated output in the first case and not in the second.I would guess the root cause is that <=64-bit hex strings get parsed as an
int64
, but larger numbers remain uninterpreted strings. However, that is not true for the decimal representation of the same 64-bit and 128-bit numbers I tested in hex : in decimal they both appear to be parsed as numbers, and both get double quotes in the output ! More inconsistency here ...For context, I found this while debugging an issue with our manifest linter (Kubevious) : it balks at the 128-bit hex value in the ConfigMap because it expects a string but does parse it as a number (whereas Kubernetes doesn't).
What did you expect to happen?
I believe the current behaviour is confusing and Kustomize should treat all numeric values consistently.
I also can't think of a great workaround right now :
configMapgenerator
will add its own single quotes to the output, and that might break the application using it (via an env var in the Deployment loaded from CM withenvFrom
)I can see there has been a lot of discussion already around quotes (at least #5124, #4845 , #3440, #3412, #4570, #4525), hopefully this brings another useful data point.
How can we reproduce it (as minimally and precisely as possible)?
Expected output
Actual output
(notice how
B
andD
(same number, 2^64, with/without leading zeros) are unquoted, butF
(same number 2^64 in decimal) orC
(2^64-1, fits in 64 bits) do have quotes)Kustomize version
5.2.1
Operating system
MacOS
The text was updated successfully, but these errors were encountered: