Dashboard for visualization of multi-projects resources in OpenShift.
This is a web application that aims to display a nice dashboard of your resources across multiple projects in an OpenShift instance.
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:
- Routes
- Services
- Pods
- Containers
- Images
- Builds
- Deployments
- and... 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?
If you want to deploy this dashboard on an OpenShift cluster, you can use the provided template, that will create all the required resources:
- a
dashboard
Service Account that will be used by the running pod - a Build Config that will use the Dockerfile to build the Docker image
- a Deployment Config that will deploy a simple pod with a single container
- a Service in front of the pod(s)
- and a Route to expose the service to the outside world
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 ourdashboard
service account for all the projects you want to display in the dashboardoc 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 projectsproject1
andproject2
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
imageoc 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:
- create a new service account, edit the deployment config to configure the pod to use your new service account, and redeploy
- or give more rights to the
default
service account (not recommended)
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
-
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 usegodep
to retrieve the vendored dependencies)gin --godep --port 8080 run main.go
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.