将 YAML 转换为 JSON 时出错:在此上下文中不允许映射值

error converting YAML to JSON: mapping values are not allowed in this context

我正在使用 helm3。 我的 kubernetes 部署在下面的第 43 行代码处崩溃了。

控制台错误:将 YAML 转换为 JSON 时出错:此上下文中不允许映射值

yaml lint 是这样说的: (): 在第 43 行第 19 列扫描普通标量时发现意外的“:”

那一行有什么问题?

错一个:

- image: {{ printf "%s/%s:%s" .Values.dockerRegistry .Values.dockerImage .Values.version }}



  apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ template "deploy_name" . }}
  namespace: {{ .Release.Namespace }}
spec:
  replicas: {{ .Values.replicas.min }}
  revisionHistoryLimit: 3
  selector:
    matchLabels:
      app: {{ .Release.Name }}
  template:
    metadata:
      labels:
        app: {{ .Release.Name }}
        team: {{ .Values.meta.team }}
        env: {{ .Values.env }}
        version: {{ .Values.version }}
        revision: {{ .Release.Revision | quote }}
        json_logs: "true"
        commit_hash: {{ .Values.commitHash }}
      annotations:
        prometheus.io/port: {{ .Values.ports.application | quote }}
        prometheus.io/path: {{ .Values.prometheus.path | quote }}
        prometheus.io/scrape: {{ .Values.prometheus.scrape | quote }}
        prometheus.io/scheme: {{ .Values.prometheus.scheme | quote }}
        host/url: {{ .Values.url | quote }}
        host.net/owner: {{ .Values.meta.owner | quote }}
        host.net/system: {{ .Values.meta.team | quote }}
        sidecar.istio.io/rewriteAppHTTPProbers: "true"
    spec:
      imagePullSecrets:
      - name: gitlab
      hostAliases:
      - ip: 0.0.0.0
        hostnames:
        - host
        - host
      - ip: 0.0.0.0
        hostnames:
        - host
      containers:
      - image: {{ printf "%s/%s:%s" .Values.dockerRegistry .Values.dockerImage .Values.version }}
        imagePullPolicy: Always
        name: website
        ports:
        - containerPort: {{  .Values.ports.application }}
        envFrom:
        - configMapRef:
            name: {{ template "config_map_name" . }}
        - secretRef:
            name: {{ template "secret_name" . }}
        resources:
          limits:
            cpu: 2
            memory: 4Gi
          requests:
            cpu: 350m
            memory: 2Gi
        livenessProbe:
          httpGet:
            path: /healthz
            port: {{ .Values.ports.application }}
          initialDelaySeconds: 20
          periodSeconds: 3
          failureThreshold: 10
        readinessProbe:
          httpGet:
            path: /readyz
            port: {{ .Values.ports.application }}
          initialDelaySeconds: 20
          periodSeconds: 3

所以我的解决方案是:

- image: '{{.Values.dockerRegistry}}/{{.Values.dockerImage}}:{{.Values.version}}'

问题出在

中的printf函数和冒号符号
"%s/%s:%s"