Giter VIP home page Giter VIP logo

qube's Introduction

qube

qube is a GraphQL API provider for your Kubernetes cluster. It's working as a separate proxy above native Kubernetes API.

GraphQL schema is dynamically built from the openapi/swagger API specification exposed by the Kubernetes cluster.

What GraphQL primitives are working now

  • Queries
  • Mutations
  • Subscriptions

Authorization

qube supports the Bearer token auth flow in the same manner as Kubernetes API. Set Authorization header with your Kubernetes account token to pass the request.

Running

Requirements

node > 10

Run

npm start

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

Environment variables (settings)

NODE_ENV - string, set to production to mute stacktrace proxying to a client, see more here

IN_CLUSTER- bool, set to false if you run outside of Kubernetes cluster

KUBERNETES_HOST - string, path to Kubernetes cluster API, use with IN_CLUSTER=false

API_SCHEMA_FILE_PATH - string, set path to swagger.json, if you run qube outside of Kubernetes cluster and do not want provide it with any KUBE_SCHEMA_TOKEN

KUBE_SCHEMA_TOKEN - string, a token from account, which will be used to request OpenAPI schema of Kubernetes cluster, use with IN_CLUSTER=false and without API_SCHEMA_FILE_PATH

USE_JWT_AUTH - bool, set to false if you do not want to proxify client Authorization header to Kubernetes

REMOVE_PATHS - string, contains a comma-separated list of path strings that should be removed from the OpenAPI Specification (OAS) object. It's useful for dynamically excluding certain API endpoints or paths based on runtime configuration.

Notice: In case of USE_JWT_AUTH=false default token (or KUBE_SCHEMA_TOKEN) will be used for all user requests, which can be unsecure.

Examples

Create namespaced Secret

Query

mutation CreateSecretMutation($namespace: String!, $name: String!, $data: JSON) {
  createCoreV1NamespacedSecret(namespace: $namespace, ioK8sApiCoreV1SecretInput: {kind: "Secret", stringData: $data, metadata: {name: $name}}) {
    data
    type
    metadata {
      name
    }
  }
}

Variables

{
  "data": {"key": "value"},
  "namespace": "my-namespace",
  "name": "my-secret"
}

Get namespaced pods

Query

query GetPodsQuery($namespace: String!) {
  ioK8sApiCoreV1PodList(namespace: $namespace) {
    items {
      metadata {
        name
      }
      spec {
        hostname
        containers {
          image
          name
        }
      }
    }
  }
}

Variables

{
  "namespace": "my-namespace"
}

qube's People

Contributors

nikpaushkin avatar sergeimonakhov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

qube's Issues

apiV1NamespacePodLog does not work

We have to process text/plain responses properly

 "Unexpected error value: \"Operation GET /api/v1/namespaces/{namespace}/pods/{name}/log should have a content-type 'application/json' but has 'text/plain' instead\""

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.