Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use 'true' and 'false' as label value #23251

Closed
ddysher opened this issue Mar 20, 2016 · 3 comments

Comments

@ddysher
Copy link
Contributor

commented Mar 20, 2016

It seems resources can't be created with label value set to 'true' or 'false'.

With the following yaml,

  template:
    metadata:
      labels:
        environment: test
        release: false
        tier: frontend

I'm getting error:

$ kubectl create -f replicaset.yaml
unable to decode "replicaset.yaml": [pos 341]: json: expect char '"' but got char 'f'

but change to

  template:
    metadata:
      labels:
        environment: test
        release: stable
        tier: frontend

No error:

$ kubectl create -f replicaset.yaml   
replicaset "replicaset" created

Label documentation doesn't mention this case.

Valid label values must be 63 characters or less and must be empty or begin and end with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between.

The use case for using 'true' as label value is to use "Exist", "NotExist" selector, where you don't have a meaningful label value.

I haven't tested yet, but if yaml parser convert it to typed boolean value before we even get the value, then it might not be easy to fix? If so and we don't want to support it, then I'd think we at least document it somehow.

@bgrant0607

This comment has been minimized.

Copy link
Member

commented Apr 6, 2016

Labels are strings.

@bgrant0607

This comment has been minimized.

Copy link
Member

commented Apr 6, 2016

Quote them.

@bgrant0607 bgrant0607 closed this Apr 6, 2016

@daikaixian

This comment has been minimized.

Copy link

commented Jul 28, 2016

follow @bgrant0607
fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.