Kubernetes 使用kubectl生成yaml输出会导致线分裂

Kubernetes 使用kubectl生成yaml输出会导致线分裂,kubernetes,yaml,output,kubectl,configmap,Kubernetes,Yaml,Output,Kubectl,Configmap,我正在尝试使用kubectl生成yaml输出——干运行 当我运行这个 $ kubectl create configmap my-config-map -o yaml --dry-run=client | kubectl annotate -f- --dry-run=client -o yaml --local this-is-my-target-directory='{{ template "This.is.long.path.for.some.value" . }}'

我正在尝试使用kubectl生成yaml输出——干运行

当我运行这个

$ kubectl create configmap my-config-map  -o yaml --dry-run=client | kubectl annotate -f- --dry-run=client -o yaml --local this-is-my-target-directory='{{ template "This.is.long.path.for.some.value" . }}'
我得到以下输出,其中注释被分成两行

apiVersion: v1
kind: ConfigMap
metadata:
  annotations:
    this-is-my-target-directory: '{{ template "This.is.long.path.for.some.value" .
      }}'
  creationTimestamp: null
  name: my-config-map
我想要的输出是注释应该在一行中。如下

apiVersion: v1
kind: ConfigMap
metadata:
  annotations:
    this-is-my-target-directory: '{{ template "This.is.long.path.for.some.value" . }}'
  creationTimestamp: null
  name: my-config-map

如果我减小字符串的大小,那么它将变为1行。我在文档中找不到任何关于行长度的信息。有谁能指导我如何解决这个问题吗?

我想你找不到任何东西,因为这是一个完全有效的yaml。所以我想你可以使用它,因为它不需要把花括号放在同一行。

是的,它看起来是有效的yaml。但helm不喜欢这样,它抱怨分割行“模板子句中意外的未关闭操作”。如果我把它改成一行,它就会工作。