The dashboard is the main UI component of the Kubeapps project. Written in Javascript, the dashboard uses the React Javascript library for the frontend.
Telepresence is not a hard requirement, but is recommended for a better developer experience
export GOPATH=~/gopath
export PATH=$GOPATH/bin:$PATH
export KUBEAPPS_DIR=$GOPATH/src/github.com/kubeapps/kubeapps
git clone --recurse-submodules https://github.com/kubeapps/kubeapps $KUBEAPPS_DIR
The dashboard application source is located under the dashboard/
directory of the repository.
cd $KUBEAPPS_DIR/dashboard
Kubeapps is a Kubernetes-native application. To develop and test Kubeapps components we need a Kubernetes cluster with Kubeapps already installed. Follow the Kubeapps installation guide to install Kubeapps in your cluster.
Telepresence is a local development tool for Kubernetes microservices. As the dashboard is a service running in the Kubernetes cluster we use telepresence to proxy requests to the dashboard running in your cluster to your local development host.
First install the dashboard dependency packages:
yarn install
Next, create a telepresence
shell to swap the kubeapps-internal-dashboard
deployment in the kubeapps
namespace, forwarding local port 3000
to port 8080
of the kubeapps-internal-dashboard
pod.
telepresence --namespace kubeapps --method inject-tcp --swap-deployment kubeapps-internal-dashboard --expose 3000:8080 --run-shell
NOTE: If you encounter issues getting this setup working correctly, please try switching the telepresence proxying method in the above command to
vpn-tcp
. Refer to the telepresence docs to learn more about the available proxying methods and their limitations.
Finally, launch the dashboard within the telepresence shell:
export TELEPRESENCE_CONTAINER_NAMESPACE=kubeapps
yarn run start
NOTE: The commands above assume you install Kubeapps in the
kubeapps
namespace. Please update the environment variableTELEPRESENCE_CONTAINER_NAMESPACE
if you are using a different namespace.
You can now access the local development server simply by accessing the dashboard as you usually would (e.g. doing a port-forward or accesing the Ingress URL).
In some cases, the 'Create React App' scripts keep listening on the 3000 port, even when you disconnect telepresence. If you see that localhost:3000
is still serving the dashboard, even with your telepresence down, check if there is a 'Create React App' script process running (ps aux | grep react
) and kill it.
Execute the following command within the dashboard directory to start the test runner which will watch for changes and automatically re-run the tests when changes are detected.
yarn run test
NOTE: macOS users may need to install watchman (https://facebook.github.io/watchman/).