1

我有这个从 YAML 转换而来的 JSON 文件:

{
  "kind": "DeploymentConfig",
  "apiVersion": "v1",
  "metadata": {
    "name": "cdt-cae-deployment"
  },
  "spec": {
    "template": {
      "metadata": {
        "labels": {
          "name": "cdt-cae"
        },
        "annotations": {
          "app_version": "latest"
        }
      },
      "spec": {
        "containers": [
          {
            "name": "cdt-cae",
            "image": "containers.nabisco.com/cdt-org/cdt-dev:__IMAGETAG__",
            "ports": [
              {
                "containerPort": 8080,
                "protocol": "TCP"
              }
            ],
            "env": [
              {
                "name": "APP_NAME",
                "value": "cdt-cae"
              },
              {
                "name": "CISCO_LC",
                "value": "dev"
              },
              {
                "name": "OPENSHIFT_MONGODB_DB_USERNAME",
                "value": "cdtdev"
              },
              {
                "name": "OPENSHIFT_MONGODB_DB_PORT",
                "value": "27058"
              },
              {
                "name": "OPENSHIFT_MONGODB_DB_HOST",
                "value": "secret stuff here"
              },
              {
                "name": "OPENSHIFT_MONGODB_DB_PASSWORD",
                "valueFrom": {
                  "secretKeyRef": {
                    "name": "refapp-secret",
                    "key": "mongodb-password"
                  }
                }
              },
              {
                "name": "NOTIFICATIONS_CLIENT_SECRET",
                "valueFrom": {
                  "secretKeyRef": {
                    "name": "refapp-secret",
                    "key": "notifications-client-secret"
                  }
                }
              }
            ],
            "volumeMounts": [
              {
                "name": "podinfo",
                "mountPath": "/etc/metadata",
                "readOnly": false
              }
            ],
            "imagePullPolicy": "IfNotPresent",
            "securityContext": {
              "capabilities": {},
              "privileged": false
            }
          }
        ],
        "volumes": [
          {
            "name": "podinfo",
            "downwardAPI": {
              "items": [
                {
                  "path": "labels",
                  "fieldRef": {
                    "fieldPath": "metadata.labels"
                  }
                },
                {
                  "path": "annotations",
                  "fieldRef": {
                    "fieldPath": "metadata.annotations"
                  }
                }
              ]
            }
          }
        ],
        "restartPolicy": "Always",
        "dnsPolicy": "ClusterFirst"
      }
    },
    "replicas": 3,
    "selector": {
      "name": "cdt-cae"
    },
    "triggers": [
      {
        "type": "ConfigChange"
      }
    ],
    "strategy": {
      "type": "Rolling",
      "rollingParams": {
        "updatePeriodSeconds": 1,
        "intervalSeconds": 1,
        "timeoutSeconds": 120
      }
    }
  }
}

不幸的是,这是无效的 JSON - 我收到此消息:

在此处输入图像描述

有人知道配置有什么问题吗?看起来它实际上是有效的 JSON,只是模式可能是错误的..

不要介意这只是添加更多细节 不要介意这只是添加更多细节 不要介意这只是添加更多细节 不要介意这只是添加更多细节 不要介意这只是添加更多细节 不要介意这个只是添加更多细节 不要介意这只是添加更多细节 不要介意这只是添加更多细节 不要介意这只是添加更多细节

4

1 回答 1

0

<value> expected, unexpected end of file

表示处理 JSON 的事物认为缺少终止的 }。

问题中引用的 JSON 很好,但由于秘密字段,它已从原始内容更改。也许这个秘密有一个未转义的报价?

于 2018-03-01T01:41:28.427 回答