似乎无法在标签值设置为“true”或“false”的情况下创建资源。
使用以下 yaml,
template:
metadata:
labels:
environment: test
release: false
tier: frontend
我收到错误:
$ kubectl create -f replicaset.yaml
unable to decode "replicaset.yaml": [pos 341]: json: expect char '"' but got char 'f'
但改为
template:
metadata:
labels:
environment: test
release: stable
tier: frontend
没有错误:
$ kubectl create -f replicaset.yaml
replicaset "replicaset" created
标签文档没有提到这种情况。
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.
使用“true”作为标签值的用例是使用“Exist”、“NotExist”选择器,其中没有有意义的标签值。
我还没有测试过,但是如果 yaml 解析器在我们得到值之前将它转换为类型化的布尔值,那么它可能不容易修复? 如果是这样并且我们不想支持它,那么我认为我们至少以某种方式记录它。
标签是字符串。
引用它们。
关注@bgrant0607
固定的。
最有用的评论
引用它们。