Skip to content

jeswanke/console-api

 
 

Repository files navigation

Console API

Build Status Coverage Vulnerabilities

Open Cluster Management - Console API for the Application console. It uses Kubernetes APIs to provide APIs that are used for topology, access checks, and generic resource CRUD.


Table of Contents generated with DocToc


Work in Progress

We are in the process of enabling this repo for community contribution. See wiki here.

Community, discussion, contribution, and support

Check the CONTRIBUTING Doc for how to contribute to the repo.

Getting Started

Console API provides APIs that are used for topology, access checks, and generic resource CRUD in Application console. This is a guide on how to build and run open-cluster-management console-api.

Prerequisite Tools

Building for Development

git clone https://github.com/open-cluster-management/console-api.git
cd console-api
npm install
npm run build:production

Running locally with an OKD cluster

By default the server runs in development mode using insecure HTTP connections. To use HTTPS, you must either:

  • set the environment variables serverKey and serverCert with the full path of the key and certificate files
  • provide a key and certificate in the ./sslcert/consoleapi.key and ./sslcert/consoleapi.crt files

To run your local console-api code against an existing OCM installation:

  1. Make sure you are logged in using oc

  2. The following environment variables need to be set

    export API_SERVER_URL=`oc get infrastructure cluster -o jsonpath={.status.apiServerURL}`
    export SERVICEACCT_TOKEN=`oc whoami -t`
    
  3. Start the server for production (key and certificate required for HTTPS)

    npm run start:production
    
  4. Start the server for development

    npm run start
    
  5. Now you can make GraphQL calls to http://localhost:4000/hcmuiapi/graphql or https://localhost:4000/hcmuiapi/graphql (depending on whether you are using secure connections) or use it with a local instance of Application UI

Building a local image

git clone https://github.com/open-cluster-management/console-api.git
cd console-api
export COMPONENT_DOCKER_REPO=<docker_repo>
export COMPONENT_NAME=console-api
export IMAGE_TAG=<image_tag>
make install
make build
make lint
make prune
make build-image

Testing

The following will run all unit tests.

npm test

To run a particular test.

npm run test -- <test_file>


# for example
npm run test -- application.test.js

About

No description, website, or topics provided.

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 98.4%
  • Other 1.6%