Kubernetes: Quoted YAML required when none needed

Created on 14 Sep 2016  ·  3Comments  ·  Source: kubernetes/kubernetes

Is this a request for help?

no

What keywords did you search in Kubernetes issues before filing this one?

yaml quote quotes

Is this a BUG REPORT or FEATURE REQUEST? (choose one):

Kubernetes version (use kubectl version): 1.3.6

Environment:

  • Cloud provider or hardware configuration: GCE
  • OS (e.g. from /etc/os-release): Alpine Linux 3.4.0
  • Kernel (e.g. uname -a): Linux kash-api-4080102595-t21vs 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2 (2016-04-08) x86_64 Linux
  • Install tools: apk
  • Others:

What happened: When creating secrets/configmaps, it seems to be fairly random when values are expected to be surrounded by quotes or not. Sometimes it's numbers, other times it's string, and not always because of starting with non standard characters.

We use NodeJS to generate our configurations, and (surprisingly) none of the libraries have support for forcing quotes around values, and are generating valid YAML for all our other use cases. We're resorting to some post-generated 'sed' /magic/ to add the quotes, but this is not ideal.

Is it possible that the YAML validation kubectl uses is too strict/broken when requiring values to be quoted or not?

What you expected to happen: To not require manually adding quotes after using a valid YAML generator

How to reproduce it (as minimally and precisely as possible):
here's a configmap value that requires quoting

dbconnectiontimeout: '60'

or

remoteip: 'some-host-here'

Anything else do we need to know:

arekubectl siapi-machinery

All 3 comments

@theothermike hi, this seems like a known issue and there seems no real fix for it. i.e. you must specify type correctly.. I would suggest to look at the discussion here https://github.com/kubernetes/kubernetes/issues/2763 Lots of good comments from @liggitt This was another similar issue reported and closed https://github.com/kubernetes/kubernetes/issues/28974 If you are okay with it we should close this issue. Thanks! @liggitt makes sense?

I'm able to use numbers without quoting by prefixing values with !!integer. But !!int is not working though. (Using Kubernetes 1.8)

Ex:

apiVersion: v1
kind: ConfigMap
metadata:
 name: identity-config
data:
  TC_HOST: 192.168.1.10
  TC_PORT: !!integer 8080

Agree with spzala, the type must be specified correctly as a string. Yaml only requires number and boolean values to be quoted (alpha values are inferred to be strings), but you can quote all configmap data values if it makes it easier

Was this page helpful?
0 / 5 - 0 ratings

Related issues

arun-gupta picture arun-gupta  ·  3Comments

ddysher picture ddysher  ·  3Comments

jadhavnitind picture jadhavnitind  ·  3Comments

cooligc picture cooligc  ·  3Comments

errordeveloper picture errordeveloper  ·  3Comments