All Projects → qlkube → Qlkube

qlkube / Qlkube

Licence: apache-2.0
A GraphQL api for Kubernetes

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Qlkube

Graphjin
GraphJin - Build APIs in 5 minutes with GraphQL. An instant GraphQL to SQL compiler.
Stars: ✭ 1,264 (+1320.22%)
Mutual labels:  graphql, graphql-server
Gql
☁ Universal GraphQL HTTP middleware for Deno
Stars: ✭ 42 (-52.81%)
Mutual labels:  graphql, graphql-server
Ultimate Backend
Multi tenant SaaS starter kit with cqrs graphql microservice architecture, apollo federation, event source and authentication
Stars: ✭ 978 (+998.88%)
Mutual labels:  graphql, graphql-server
Graphql
Haskell GraphQL implementation
Stars: ✭ 36 (-59.55%)
Mutual labels:  graphql, graphql-server
Locksmith
Want to use GraphQL with Clojure/script but don't want keBab or snake_keys everywhere? Use locksmith to change all the keys!
Stars: ✭ 59 (-33.71%)
Mutual labels:  graphql, graphql-server
Graphqldockerproxy
A generic Graphql API for Docker and Kubernetes
Stars: ✭ 38 (-57.3%)
Mutual labels:  graphql, graphql-server
Graphql Kotlin
Libraries for running GraphQL in Kotlin
Stars: ✭ 1,030 (+1057.3%)
Mutual labels:  graphql, graphql-server
Eschool
eSchool Microservice based Solution
Stars: ✭ 29 (-67.42%)
Mutual labels:  graphql, graphql-server
Graphql Api Gateway
An open-sourced example of a GraphQL API Gateway. This service queries and joins data across different back-ends into one GraphQL schema.
Stars: ✭ 57 (-35.96%)
Mutual labels:  graphql, graphql-server
Data Source Base
Boilerplate for creating a GrAMPS-compatible data source.
Stars: ✭ 52 (-41.57%)
Mutual labels:  graphql, graphql-server
Orionjs
A new framework for serverside GraphQL apps
Stars: ✭ 35 (-60.67%)
Mutual labels:  graphql, graphql-server
Daptin
Daptin - Backend As A Service - GraphQL/JSON-API Headless CMS
Stars: ✭ 1,195 (+1242.7%)
Mutual labels:  graphql, graphql-server
Graphql Modules
Enterprise Grade Tooling For Your GraphQL Server
Stars: ✭ 962 (+980.9%)
Mutual labels:  graphql, graphql-server
Ariadne
Ariadne is a Python library for implementing GraphQL servers using schema-first approach.
Stars: ✭ 1,274 (+1331.46%)
Mutual labels:  graphql, graphql-server
Fullstack Graphql
🌈 Simple Fullstack GraphQL Application. API built with Express + GraphQL + Sequelize (supports MySQL, Postgres, Sqlite and MSSQL). WebApp built with React + Redux to access the API. Written in ES6 using Babel + Webpack.
Stars: ✭ 955 (+973.03%)
Mutual labels:  graphql, graphql-server
Omdb Graphql Wrapper
🚀 GraphQL wrapper for the OMDb API
Stars: ✭ 45 (-49.44%)
Mutual labels:  graphql, graphql-server
Graphql Spqr
Java 8+ API for rapid development of GraphQL services
Stars: ✭ 843 (+847.19%)
Mutual labels:  graphql, graphql-server
Turbulette
😴 Turbulette - A batteries-included framework to build high performance, fully async GraphQL APIs
Stars: ✭ 29 (-67.42%)
Mutual labels:  graphql, graphql-server
Example Auth
User auth, session & JWT example for ReactQL
Stars: ✭ 51 (-42.7%)
Mutual labels:  graphql, graphql-server
Apollo Server Vercel
⚫ Production-ready Node.js GraphQL server for Vercel Serverless Functions
Stars: ✭ 69 (-22.47%)
Mutual labels:  graphql, graphql-server

qlkube

qlkube is a graphql api for kubernetes, allowing you to interact with all the features of the Kubernetes api using graphql.

qlkube's graphql schema is dynamically built from the openapi/swagger api specification exposed by the Kubernetes cluster it is running in - qlkube should therefore:

  • expose all the types and operations from the Kubernetes rest api in its grapqhl api
  • be consistent with the exact Kubernetes api version of your cluster and kept up to date if and when this changes

In addition to the directly mapped operations from the openapi spec, qlkube provides an 'all' query type that gives a more natural 'kubectl' influenced interface into the api.

qlkube ships with the Apollo GraphQL Playground, so you can play around with the api straight away.

Demo

Example Queries

The 'all' resource is the easiest query type to use for querying kubernetes resources of all types (services, pods, deployments etc). qlkube also exposes all the low-level resources autogenerated from the Kubernetes openapi/swagger api - these types are named exactly as the 'operationId' in the openapi spec, they can therefore seem quite 'low-level' and sometimes unintuitive in comparison.

Get all pods in all namespaces

This query returns the names and namespaces of all the pods in the cluster. (here we use the more friendly 'all' type - you can perform a similar query using listCoreV1PodForAllNamespaces)

query getAllPodsInAllNamespaces {
  all {
    pods {
      items {
        metadata {
          name
          namespace
        }
      }
    }
  }
}

Output:

{
  "data": {
    "all": {
      "pods": {
        "items": [
          {
            "metadata": {
              "name": "alpha-7c766f4fc7-2bh8m",
              "namespace": "default"
            }
          },
          {
            "metadata": {
              "name": "alpha-7c766f4fc7-hx8ml",
              "namespace": "default"
            }
          },
          {
            "metadata": {
              "name": "alpha-7c766f4fc7-ztpph",
              "namespace": "default"
            }
          },
          {
            "metadata": {
              "name": "beta-v1-597679f796-k5gn4",
              "namespace": "default"
            }
          },
          {
            "metadata": {
              "name": "beta-v1-597679f796-x7hsl",
              "namespace": "default"
            }
          },
          {
            "metadata": {
              "name": "gamma-79bc488b5b-srmxm",
              "namespace": "default"
            }
          },
...etc
Get all pods in a specific namespace

This query returns the names, namespaces, creation times and labels of all the pods in the 'default' namespace (here we use the more friendly 'all' type - you can perform a similar query using ioK8sApiCoreV1PodList)

query getAllPodsInDefaultNamespace {
  all(namespace: "default") {
    pods {
      items {
        metadata {
          name
          namespace
          creationTimestamp
          labels
        }
      }
    }
  }
}

Output:

{
  "data": {
    "all": {
      "pods": {
        "items": [
          {
            "metadata": {
              "name": "alpha-7c766f4fc7-2bh8m",
              "namespace": "default",
              "creationTimestamp": "2019-06-03T15:07:17Z",
              "labels": {
                "app": "alpha",
                "appKubernetesIoManagedBy": "skaffold-v0.29.0",
                "appId": "github.expedia.biz_hotels_alpha",
                "podTemplateHash": "7c766f4fc7",
                "skaffoldDevBuilder": "local",
                "skaffoldDevCleanup": "true",
                "skaffoldDevDeployer": "kubectl",
                "skaffoldDevDockerApiVersion": "1.39",
                "skaffoldDevTagPolicy": "git-commit",
                "skaffoldDevTail": "true",
                "version": "v1"
              }
            }
          },
...etc          
Get all kubernetes resources with a specific label

This query gets the names of all kubernetes resources (services, deployments, pods etc) that are labelled with label 'app=alpha' (roughly equivalent to kubectl get all -l app=alpha)

query allResourcesOfApp {
  all(labelSelector:"app=alpha") { 
    services {
      items {
        metadata {
          name
        }
      }
    }
    deployments {
      items {
        metadata {
          name
        }
      }
    }
    pods {
      items {
        metadata {
          name
        }
      }
    }
    daemonSets {
      items {
        metadata {
          name
        }
      }
    }
    replicaSets {
      items {
        metadata {
          name
        }
      }
    }
    statefulSets {
      items {
        metadata {
          name
        }
      }
    }
    jobs {
      items {
        metadata {
          name
        }
      }
    }
    cronJobs {
      items {
        metadata {
          name
        }
      }
    } 
    namespaces {
      items {
        metadata {
          name
        }
      }
    }
  }
}

Output:

{
  "data": {
    "all": {
      "services": {
        "items": [
          {
            "metadata": {
              "name": "alpha"
            }
          }
        ]
      },
      "deployments": {
        "items": [
          {
            "metadata": {
              "name": "alpha"
            }
          }
        ]
      },
      "pods": {
        "items": [
          {
            "metadata": {
              "name": "alpha-7c766f4fc7-2bh8m"
            }
          },
...etc          

Example Mutations

Create namespace

This mutation creates a new 'bar' namespace. The input json is the escaped version of the following:

{
    "apiVersion": "v1",
    "kind": "Namespace",
    "metadata": {
        "name": "bar"
    }
}

We output the creation timestamp for the new namesapce.

mutation createNamespace {
  createCoreV1Namespace(input: "{\"apiVersion\":\"v1\",\"kind\":\"Namespace\",\"metadata\":{\"name\":\"bar\"}}") {
    metadata {
      creationTimestamp
    }
  }
}

Output:

{
  "data": {
    "createCoreV1Namespace": {
      "metadata": {
        "creationTimestamp": "2019-06-03T22:37:02Z"
      }
    }
  }
}

Running

Quickstart

qlkube is designed to be run inside the kubernetes cluster. The included quickstart.yaml manifest should get you started:

kubectl apply -f deployments/quickstart.yaml 
kubectl port-forward svc/qlkube 8080:80

Navigate to http://localhost:8080/ in your browser - this will launch the GraphQL Playground which you can use to interact with the kubernetes api.

Skaffold

The included skaffold.yaml can be used to build and deploy from source (note that in production you may want to restrict the permissive RBAC settings in deployments/deployment.yaml). N.B. you need skaffold installed!

skaffold dev
kubectl port-forward svc/qlkube 8080:80

Navigate to http://localhost:8080/ in your browser - this will launch the GraphQL Playground which you can use to interact with the kubernetes api.

Out of cluster (dev mode)

For playing around locally you can run qlkube from source outside of the cluster. To do this you must first proxy the Kubernetes api server to http://localhost:8001:

kubectl proxy

You can then run qlkube locally, which will connect to the proxied Kubernetes api:

npm run local

Navigate to http://localhost:8080/ in your browser - this will launch the GraphQL Playground which you can use to interact with the kubernetes api.

Schema

The generated graphql schema is served at /schema

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].