krane icon indicating copy to clipboard operation
krane copied to clipboard

Error applying a ConfigMap which contains a string with numbers and multiple commas

Open davidcaste opened this issue 4 years ago • 0 comments

Bug report

I have a minimal ConfigMap with the following contents:

apiVersion: v1
data:
  SPECIAL_PHONE_NUMBERS: 799999990,799999991,799999992,799999993,799999994,799999995,799999996,799999997,799999998
kind: ConfigMap
metadata:
  name: foo-bkk2tbth72

krane is not able to deploy it and throws the following error:

➜ kustomize build --enable_alpha_plugins . | krane deploy --no-prune default STAGE-ES -f -
[INFO][2020-08-03 13:59:24 +0200]	
[INFO][2020-08-03 13:59:24 +0200]	------------------------------------Phase 1: Initializing deploy------------------------------------
[WARN][2020-08-03 13:59:29 +0200]	You're deploying to protected namespace default, which cannot be pruned.
[WARN][2020-08-03 13:59:29 +0200]	Existing resources can only be removed manually with kubectl. Removing templates from the set deployed will have no effect.
[WARN][2020-08-03 13:59:29 +0200]	***Please do not deploy to default unless you really know what you are doing.***
[INFO][2020-08-03 13:59:30 +0200]	All required parameters and files are present
[INFO][2020-08-03 13:59:30 +0200]	Discovering resources:
[INFO][2020-08-03 13:59:32 +0200]	  - ConfigMap/foo-bkk2tbth72
[INFO][2020-08-03 13:59:34 +0200]	
[INFO][2020-08-03 13:59:34 +0200]	----------------------------Phase 2: Checking initial resource statuses-----------------------------
[INFO][2020-08-03 13:59:35 +0200]	ConfigMap/foo-bkk2tbth72                          Not Found
[INFO][2020-08-03 13:59:35 +0200]	
[INFO][2020-08-03 13:59:35 +0200]	------------------------------Phase 3: Predeploying priority resources------------------------------
[INFO][2020-08-03 13:59:38 +0200]	Deploying ConfigMap/foo-bkk2tbth72 (timeout: 30s)
[INFO][2020-08-03 13:59:39 +0200]	
[INFO][2020-08-03 13:59:39 +0200]	------------------------------------------Result: FAILURE-------------------------------------------
[FATAL][2020-08-03 13:59:39 +0200]	Command failed: apply -f /tmp/d20200803-90604-wq4lry
[FATAL][2020-08-03 13:59:39 +0200]	
[FATAL][2020-08-03 13:59:39 +0200]	WARNING: Any resources not mentioned in the error(s) below were likely created/updated. You may wish to roll back this deploy.
[FATAL][2020-08-03 13:59:39 +0200]	
[FATAL][2020-08-03 13:59:39 +0200]	Invalid template: ConfigMap-foo-bkk2tbth7220200803-90604-15kbc6f.yml
[FATAL][2020-08-03 13:59:39 +0200]	> Error message:
[FATAL][2020-08-03 13:59:39 +0200]	    Error from server (BadRequest): error when creating "/tmp/d20200803-90604-wq4lry/ConfigMap-foo-bkk2tbth7220200803-90604-15kbc6f.yml": ConfigMap in version "v1" cannot be handled as a ConfigMap: v1.ConfigMap.Data: ReadString: expects " or n, but found 7, error found in #10 byte of ...|NUMBERS":7.999999908|..., bigger context ...|apiVersion":"v1","data":{"SPECIAL_PHONE_NUMBERS":7.999999908e+80},"kind":"ConfigMap","metadata":{"an|...
[FATAL][2020-08-03 13:59:39 +0200]	> Template content:
[FATAL][2020-08-03 13:59:39 +0200]	    ---
[FATAL][2020-08-03 13:59:39 +0200]	    apiVersion: v1
[FATAL][2020-08-03 13:59:39 +0200]	    data:
[FATAL][2020-08-03 13:59:39 +0200]	      SPECIAL_PHONE_NUMBERS: 799999990799999991799999992799999993799999994799999995799999996799999997799999998
[FATAL][2020-08-03 13:59:39 +0200]	    kind: ConfigMap
[FATAL][2020-08-03 13:59:39 +0200]	    metadata:
[FATAL][2020-08-03 13:59:39 +0200]	      name: foo-bkk2tbth72
[FATAL][2020-08-03 13:59:39 +0200]

It seems like it got confused with the first comma, and it tried to parse the value as a Number instead of just a String.

Expected behavior: Apply the manifest without complains.

Actual behavior: It fails with the error above.

Version(s) affected: krane 1.1.4

davidcaste avatar Aug 03 '20 12:08 davidcaste