cncf / demo

Demo of CNCF technologies
https://cncf.io
Apache License 2.0
77 stars 39 forks source link

Boolean values in YAML lead to unexpected behaviour #115

Closed namliz closed 8 years ago

namliz commented 8 years ago
kubectl label nodes <nodename> echo=true

rc.yaml:

spec:
   nodeSelector:
      echo: true
   containers:
$ kubectl create -f rc.yaml --validate
unable to decode "rc.yaml": [pos 434]: json: expect char '"' but got char 't'

The same thing happens if true is set to yes. When set to anything else like foo it succeeds with no complaints. Kind of surprising if you try yes first.

namliz commented 8 years ago

Labels are strings. So quoting them disambiguates it for the parser:

nodeSelector:
  echo: "yes"

However you don't need to quote 'yes' when you label a node. And yes is not as expected a truthy value as 'true'. So leaving this issue up for anybody googling.