OpenShift Cluster Console UI
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
auth Tighten the validation around OAuth URLs Dec 6, 2018
cmd/bridge Accept service-ca.crt file as parameter Dec 17, 2018
contrib Remove Tectonic branding Jul 17, 2018
docs-internal Fix operators.md link Sep 12, 2018
examples Additional branding updates Aug 8, 2018
frontend Merge pull request #1096 from rebeccaalpert/add-event-namespace Jan 18, 2019
pkg/proxy Remove noise from the console logs Aug 29, 2018
server Enable gzip compression of static files Dec 18, 2018
vendor vendor: revendor Jul 6, 2018
version Rename for packaging: coreos-inc/bridge -> openshift/console. May 12, 2018
.gitignore use 'render' prop for <LazyRoute> to prevent unmounting when query pa… Nov 26, 2018
CONTRIBUTING.md docs: udpates to project documentation Sep 20, 2016
Dockerfile Include system roots in cert pool when talking to OAuth server Aug 13, 2018
Dockerfile-builder Bump versions of various software in builder image. May 30, 2018
Dockerfile.product Bump chromedriver to version 2.43.3 Nov 20, 2018
Dockerfile.product.nodejs multistage builds for downstream Aug 30, 2018
LICENSE chore: Adds license Apr 2, 2018
Procfile Procfile: modified commands to correctly execute Aug 2, 2017
README.md Fixing typos Sep 20, 2018
STYLEGUIDE.md frontend: Add object-shorthand to linter Dec 19, 2018
bill-of-materials.json chore: Adds license bill of materials Mar 26, 2018
build-backend.sh Rename all shell files to have .sh extensions. May 23, 2018
build-frontend.sh Rename all shell files to have .sh extensions. May 23, 2018
build.sh Rename all shell files to have .sh extensions. May 23, 2018
builder-run.sh prevent unnecessary re-rendering of Firehose by checking if resources… Oct 9, 2018
clean-backend.sh Rename all shell files to have .sh extensions. May 23, 2018
clean-frontend.sh Rename all shell files to have .sh extensions. May 23, 2018
clean.sh Rename all shell files to have .sh extensions. May 23, 2018
e2e.Dockerfile added failfast for Protractor Dec 21, 2017
e2e.yaml added failfast for Protractor Dec 21, 2017
git-version.sh Rename all shell files to have .sh extensions. May 23, 2018
glide.lock server: support config file for openshift-ansible Jul 6, 2018
glide.yaml server: support config file for openshift-ansible Jul 6, 2018
jenkins Add jenkins file that just calls jenkins.sh. Needed for compatibility… May 23, 2018
jenkins.sh Jenkins: always exit on error Nov 12, 2018
link-check.sh Add script to check for bad links in console. Fix broken links. Oct 26, 2017
push-builder.sh Rename all shell files to have .sh extensions. May 23, 2018
push.sh Oops. Missed a .sh rename. May 25, 2018
revendor.sh Rename all shell files to have .sh extensions. May 23, 2018
test-backend.sh Rename all shell files to have .sh extensions. May 23, 2018
test-frontend.sh Rename all shell files to have .sh extensions. May 23, 2018
test-gui.sh Service Catalog Integration Tests Sep 27, 2018
test.sh Rename all shell files to have .sh extensions. May 23, 2018

README.md

OpenShift Console

Codename: "Bridge"

Build Status

quay.io/openshift/origin-console

The console is a more friendly kubectl in the form of a single page webapp. It also integrates with other services like monitoring, chargeback, and OLM. Some things that go on behind the scenes include:

  • Proxying the Kubernetes API under /api/kubernetes
  • Providing additional non-Kubernetes APIs for interacting with the cluster
  • Serving all frontend static assets
  • User Authentication

Quickstart

Dependencies:

  1. node.js >= 8 & yarn >= 1.3.2
  2. go >= 1.8 & glide >= 0.12.0 (go get github.com/Masterminds/glide) & glide-vc
  3. kubectl and a k8s cluster
  4. jq (for contrib/environment.sh)
  5. Google Chrome/Chromium >= 60 (needs --headless flag) for integration tests

Build everything:

./build.sh

Backend binaries are output to /bin.

Configure the application

OpenShift

Registering an OpenShift OAuth client requires administrative privileges for the entire cluster, not just a local project. Run the following command to log in as cluster admin:

oc login -u system:admin

To run bridge locally connected to an OpenShift cluster, create an OAuthClient resource with a generated secret and read that secret:

oc process -f examples/console-oauth-client.yaml | oc apply -f -
oc get oauthclient console-oauth-client -o jsonpath='{.secret}' > examples/console-client-secret

If the CA bundle of the OpenShift API server is unavailable, fetch the CA certificates from a service account secret. Otherwise copy the CA bundle to examples/ca.crt:

oc get secrets -n default --field-selector type=kubernetes.io/service-account-token -o json | \
    jq '.items[0].data."service-ca.crt"' -r | python -m base64 -d > examples/ca.crt
# Note: use "openssl base64" because the "base64" tool is different between mac and linux

Set the OPENSHIFT_API environment variable to tell the script the API endpoint:

export OPENSHIFT_API="https://127.0.0.1:8443"

Finally run the console and visit localhost:9000:

./examples/run-bridge.sh

OpenShift (without OAuth)

For local development, you can also disable OAuth and run bridge with an OpenShift user's access token. Run the following commands to create an admin user and start bridge for a cluster up environment:

oc login -u system:admin
oc adm policy add-cluster-role-to-user cluster-admin admin
oc login -u admin
source ./contrib/oc-environment.sh
./bin/bridge

Native Kubernetes

If you have a working kubectl on your path, you can run the application with:

export KUBECONFIG=/path/to/kubeconfig
source ./contrib/environment.sh
./bin/bridge

The script in contrib/environment.sh sets sensible defaults in the environment, and uses kubectl to query your cluster for endpoint and authentication information.

To configure the application to run by hand, (or if environment.sh doesn't work for some reason) you can manually provide a Kubernetes bearer token with the following steps.

First get the secret ID that has a type of kubernetes.io/service-account-token by running:

kubectl get secrets

then get the secret contents:

kubectl describe secrets/<secret-id-obtained-previously>

Use this token value to set the BRIDGE_K8S_BEARER_TOKEN environment variable when running Bridge.

Images

The builder-run.sh script will run any command from a docker container to ensure a consistent build environment. For example to build with docker run:

./builder-run.sh ./build.sh

The docker image used by builder-run is itself built and pushed by the script push-builder, which uses the file Dockerfile-builder to define an image. To update the builder-run build environment, first make your changes to Dockerfile-builder, then run push-builder, and then update the BUILDER_VERSION variable in builder-run to point to your new image. Our practice is to manually tag images builder images in the form Builder-v$SEMVER once we're happy with the state of the push.

Compile, Build, & Push Image

(Almost no reason to ever do this manually, Jenkins handles this automation)

Build an image, tag it with the current git sha, and pushes it to the quay.io/coreos/tectonic-console repo.

Must set env vars DOCKER_USER and DOCKER_PASSWORD or have a valid .dockercfg file.

./build-docker-push.sh

Jenkins automation

Master branch:

  • Runs a build, pushes an image to Quay tagged with the commit sha

Pull requests:

  • Runs a build when PRs are created or PR commits are pushed
  • Comment with Jenkins rebuild to manually trigger a re-build
  • Comment with Jenkins push to push an image to Quay, tagged with: pr_[pr #]_build_[jenkins build #]

If changes are ever required for the Jenkins job configuration, apply them to both the regular console job and PR image job.

Hacking

See CONTRIBUTING for workflow & convention details.

See STYLEGUIDE for file format and coding style guide.

Dev Dependencies

go, glide, glide-vc, nodejs/yarn, kubectl

Frontend Development

All frontend code lives in the frontend/ directory. The frontend uses node, yarn, and webpack to compile dependencies into self contained bundles which are loaded dynamically at run time in the browser. These bundles are not committed to git. Tasks are defined in package.json in the scripts section and are aliased to yarn run <cmd> (in the frontend directory).

Install Dependencies

To install the build tools and dependencies:

yarn install

You must run this command once, and every time the dependencies change. node_modules are not committed to git.

Interactive Development

The following build task will watch the source code for changes and compile automatically. You must reload the page in your browser!

yarn run dev

If changes aren't detected, you might need to increase fs.inotify.max_user_watches. See https://webpack.js.org/configuration/watch/#not-enough-watchers.

Tests

Run all unit tests:

./test.sh

Run backend tests:

./test-backend.sh

Run frontend tests:

./test-frontend.sh

Integration Tests

Integration tests are run in a headless Chrome driven by protractor. Requirements include Chrome, a working cluster, kubectl, and bridge itself (see building above).

Note: If you are running integration tests against OpenShift, you should start bridge using oc-environment.sh to skip the login page.

Setup (or any time you change node_modules - yarn add or yarn install)

cd frontend && yarn run webdriver-update

Run integration tests:

yarn run test-gui

Run integration tests on an OpenShift cluster:

yarn run test-gui-openshift

This will include the normal k8s CRUD tests and CRUD tests for OpenShift resources. It doesn't include ALM tests since it assumes ALM is not set up on an OpenShift cluster.

Hacking Integration Tests

Remove the --headless flag to Chrome (chromeOptions) in frontend/integration-tests/protractor.conf.ts to see what the tests are actually doing.

Dependency Management

Dependencies should be pinned to an exact semver, sha, or git tag (eg, no ^).

Backend

Whenever making vendor changes:

  1. Finish updating dependencies & writing changes
  2. Commit everything except vendor/ (eg, server: add x feature)
  3. Make a second commit with only vendor/ (eg, vendor: revendor)

Add new backend dependencies:

  1. Edit glide.yaml
  2. ./revendor.sh

Update existing backend dependencies:

  1. Edit the glide.yaml file to the desired version (most likely a git hash)
  2. Run ./revendor.sh
  3. Verify update was successful. glide.lock will have been updated to reflect the changes to glide.yaml and the package will have been updated in vendor.

Frontend

Add new frontend dependencies:

yarn add <package@version>

Update existing frontend dependencies:

yarn upgrade <package@version>

Supported Browsers

We support the latest versions of the following browsers:

  • Edge
  • Chrome
  • Safari
  • Firefox

IE 11 and earlier is not supported.