Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-14310

Could not import multiple resources via JSON (while YAML supports this)

XMLWordPrintable

    • No
    • ODC Sprint 238
    • 1
    • Rejected
    • False
    • Hide

      None

      Show
      None

      This is a clone of issue OCPBUGS-9909. The following is the description of the original issue:

      Description of problem:

      Version-Release number of selected component (if applicable):
      All versions?
      At least on 4.12+

      How reproducible:
      Always

      Steps to Reproduce:

      1. Open the console and click on the + sign in the top right navigation header.

      This JSON works fine:

      {
        "apiVersion": "v1",
        "kind": "ConfigMap",
        "metadata": {
          "generateName": "a-configmap-"
        }
      }
      

      But neither an array could be used to import multiple resources:

      [
        {
          "apiVersion": "v1",
          "kind": "ConfigMap",
          "metadata": {
            "generateName": "a-configmap-"
          }
        },
        {
          "apiVersion": "v1",
          "kind": "ConfigMap",
          "metadata": {
            "generateName": "a-configmap-"
          }
        }
      ]
      

      Fails with error: No "apiVersion" field found in YAML.

      Nor a Kubernetes List "resource" could be used:

      {
        "apiVersion": "v1",
        "kind": "List",
        "items": [
          {
            "apiVersion": "v1",
            "kind": "ConfigMap",
            "metadata": {
              "generateName": "a-configmap-"
            }
          },
          {
            "apiVersion": "v1",
            "kind": "ConfigMap",
            "metadata": {
              "generateName": "a-configmap-"
            }
          }
        ]
      }
      

      Fails with error: The server doesn't have a resource type "kind: List, apiVersion: v1".

      Actual results:
      Both JSON structures could not be imported.

      Expected results:
      Both JSON structures works fine and create multiple resources.

      If the JSON array contains just one item the resource detail page should be opened, otherwise the import result page similar to when the user imports a yaml with multiple resources.

      Additional info:
      Found this JSON structure for example in issue OCPBUGS-4646

            rh-ee-lprabhu Lokananda Prabhu
            openshift-crt-jira-prow OpenShift Prow Bot
            Sanket Pathak Sanket Pathak
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: