Skip to content

Geo GraphQL API: Add geoNode field at root

Michael Kozono requested to merge mk/add-geo-node-to-graphql into master

What does this MR do?

Allows querying geo_nodes table via the GraphQL API. In a next iteration !26719 (merged), we will allow querying registry tables, beginning with the package_file_registry table, via a field on geoNode called packageFileRegistries.

Closes #212928 (closed)

Example request without specifying a node name

{
  geoNode {
    id
    primary
    enabled
    name
    url
    internalUrl
    filesMaxCapacity
    reposMaxCapacity
    verificationMaxCapacity
    containerRepositoriesMaxCapacity
    syncObjectStorage
    selectiveSyncType
    selectiveSyncShards
    selectiveSyncNamespaces(first: 3) {
      edges {
        cursor
        node {
          id
          fullPath
        }
      }
      pageInfo {
        endCursor
        hasNextPage
      }
    }
    minimumReverificationInterval
  }
}

Response will use the current node:

{
  "data": {
    "geoNode": {
      "id": "gid://gitlab/GeoNode/4",
      "primary": false,
      "enabled": true,
      "name": "gdk-geo",
      "url": "http://127.0.0.1:3001/",
      "internalUrl": "http://127.0.0.1:3001/",
      "filesMaxCapacity": 4,
      "reposMaxCapacity": 4,
      "verificationMaxCapacity": 4,
      "containerRepositoriesMaxCapacity": 4,
      "syncObjectStorage": false,
      "selectiveSyncType": "namespaces",
      "selectiveSyncShards": [
        "default"
      ],
      "selectiveSyncNamespaces": {
        "edges": [
          {
            "cursor": "eyJpZCI6IjY0In0",
            "node": {
              "id": "gid://gitlab/Group/64",
              "fullPath": "gitlab-qa-sandbox-group/qa-test-2020-02-06-15-19-31-b370bcb8c661bbd7"
            }
          },
          {
            "cursor": "eyJpZCI6IjU4In0",
            "node": {
              "id": "gid://gitlab/Group/58",
              "fullPath": "gitlab-qa-sandbox-group/qa-test-2020-02-04-14-03-54-7b39822265d03ef8"
            }
          },
          {
            "cursor": "eyJpZCI6IjU3In0",
            "node": {
              "id": "gid://gitlab/Group/57",
              "fullPath": "gitlab-qa-sandbox-group/qa-test-2020-02-04-09-58-25-2be444855346f255"
            }
          }
        ],
        "pageInfo": {
          "endCursor": "eyJpZCI6IjU3In0",
          "hasNextPage": true
        }
      },
      "minimumReverificationInterval": 7
    }
  }
}

Example request specifying a node by name

{
  geoNode(name: "gdk") {
    id
    primary
    enabled
    name
  }
}
{
  "data": {
    "geoNode": {
      "id": "gid://gitlab/GeoNode/1",
      "primary": true,
      "enabled": true,
      "name": "gdk"
    }
  }
}

Example request for a node name that doesn't exist

{
  geoNode(name: "does not exist") {
    id
  }
}

Response:

{
  "data": {
    "geoNode": null
  }
}

Also, this response is the same when no name is specified and there is no current node.

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Edited by Michael Kozono

Merge request reports