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
- Community, discussion, contribution, and support
- Getting Started
- Prerequisite Tools
- Building for Development
- Running locally with an OKD cluster
- Building a local image
- Testing
We are in the process of enabling this repo for community contribution. See wiki here.
Check the CONTRIBUTING Doc for how to contribute to the repo.
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.
git clone https://github.com/open-cluster-management/console-api.git cd console-api npm install npm run build:production
By default the server runs in development mode using insecure HTTP connections. To use HTTPS, you must either:
- set the environment variables
serverKey
andserverCert
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:
-
Make sure you are logged in using
oc
-
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`
-
Start the server for production (key and certificate required for HTTPS)
npm run start:production
-
Start the server for development
npm run start
-
Now you can make GraphQL calls to
http://localhost:4000/hcmuiapi/graphql
orhttps://localhost:4000/hcmuiapi/graphql
(depending on whether you are using secure connections) or use it with a local instance of Application UI
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
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