Invalid JSON file for DeploymentConfig for Kubernetes

2/28/2018

I have this JSON file which was converted from YAML:

{
  "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
      }
    }
  }
}

unfortunately this is invalid JSON - I get this message:

enter image description here

Does anyone know what's wrong with the config? It looks like it's actually valid JSON, only that perhaps the schema is wrong..

Don't mind this just adding more details Don't mind this just adding more details Don't mind this just adding more details Don't mind this just adding more details Don't mind this just adding more details Don't mind this just adding more details Don't mind this just adding more details Don't mind this just adding more details Don't mind this just adding more details

--
kubectl
kubernetes
openshift
openshift-enterprise
yaml

1 Answer

3/1/2018

The

<value> expected, unexpected end of file

means that the thing processing the JSON thinks that the terminating } is missing.

The JSON quoted in the question is fine, but it's been changed from the original because of the secret fields. Maybe the secret has an unescaped quote?

-- Jonah Benton
Source: StackOverflow