Skip to content

Dashboard for visualization of multi-projects resources in OpenShift

License

Notifications You must be signed in to change notification settings

jenshenneberg/openshift-dashboard

 
 

Repository files navigation

OpenShift Dashboard

Dashboard for visualization of multi-projects resources in OpenShift.

DockerHub GoDoc Travis Circle CI

This is a web application that aims to display a nice dashboard of your resources across multiple projects in an OpenShift instance.

How It Works

It is a Go webapp that uses the OpenShift API to build a dashboard, based on Start Bootstrap - SB Admin 2.

  • If the application is running in a container in an OpenShift Cluster, it will connect to the OpenShift API Server using the information available from the environment (mainly the service account token secret).

  • If the application is not running in an OpenShift Cluster, it uses the default configuration file to connect to the OpenShift API Server. So it requires that you login with the oc client before starting the application.

It displays a summary of the following resources:

Applications

The dashboard also groups resources by applications. An application is just a logical wrapper for multiple resources. You can assign resources to an application by setting a label named application on each resource (object):

- kind: SomeObject
  metadata:
    name: myobject
    labels:
      application: myapplication

The dashboard will then extracts all declared applications from the labels of your resources.

  • Why not use projects to represents applications?
    • Because we could have multiple applications shared in a single project, or some projects which produces builds and images, but are not applications.

Running on OpenShift

If you want to deploy this dashboard on an OpenShift cluster, you can use the provided template, that will create all the required resources:

Using the template is very easy (and the recommended way to install the dashboard on OpenShift):

  • if you don't already have a project, create one

    oc new-project dashboard
    
  • create a new application from the template, and override some parameters

    oc new-app -f https://raw.githubusercontent.com/vbehar/openshift-dashboard/master/openshift-template.yml -p APPLICATION_NAME=dashboard,DASHBOARD_TITLE="My OpenShift Dashboard",ROUTE_DNS=dashboard.somedomain.com
    
  • if a build does not start, you can start one with

    oc start-build dashboard
    
  • Wait a little for the build to finish, the following deployment to succeed, and... that's it! You can now open your browser at the configured route DNS, and you should have a nice dashboard.

  • The next step is to give more rights to your service account so that it can see other projects: to do that, we will add the view role to our dashboard service account for all the projects you want to display in the dashboard

    oc policy add-role-to-user view system:serviceaccount:{DASHBOARD_PROJECT}:dashboard -n {NAME_OF_THE_PROJECT_TO_DISPLAY_IN_THE_DASHBOARD}
    

    for example, if the dashboard application is deployed in the dashboard projects, and you want to show projects project1 and project2 in the dashboard:

    oc policy add-role-to-user view system:serviceaccount:dashboard:dashboard -n myproject1
    oc policy add-role-to-user view system:serviceaccount:dashboard:dashboard -n myproject2
    
  • The last step is to create applications, by adding an application label to your objects.

Alternatively, you can just use the pre-build Docker image hosted on Docker Hub:

  • create a new application from the vbehar:openshift-dashboard image

    oc new-app vbehar/openshift-dashboard
    
  • expose the service through a new route

    oc expose service openshift-dashboard --hostname=dashboard.somedomain.com
    

Note that if you choose to deploy without the template, the pod will use the default service account, and you will need to either:

Running locally

If you want to run it on your laptop:

  • clone the sources in your GOPATH

     git clone https://github.com/vbehar/openshift-dashboard.git $GOPATH/src/github.com/vbehar/openshift-dashboard
    
  • install

    • godep: for using the vendored dependencies

      go get github.com/tools/godep
      
    • gin: for live-reloading the web server

      go get github.com/codegangsta/gin
      
  • configure the environment (in dev mode, caching is disabled)

    echo "GO_ENV=dev" > $GOPATH/src/github.com/vbehar/openshift-dashboard/.env
    
  • Login with the oc client: it will create a config file that will be used by the dashboard app to connect to the OpenShift API.

     oc login [...]
    
  • start the web server on port 8080 (don't forget the --godep option, to use godep to retrieve the vendored dependencies)

     gin --godep --port 8080 run main.go
    
  • open http://localhost:8080/

License

Copyright 2015 the original author or authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

Dashboard for visualization of multi-projects resources in OpenShift

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 83.0%
  • HTML 11.9%
  • CSS 3.4%
  • CoffeeScript 1.3%
  • Go 0.4%
  • Shell 0.0%