Align docs/ui.md with www/README.md

This commit is contained in:
jackgr
2015-06-05 11:42:05 -07:00
parent b68e08f55f
commit 5d666dbfbf
2 changed files with 38 additions and 45 deletions

View File

@@ -1,4 +1,7 @@
### Installing dependencies
# Working with the Kubernetes UI
This document explains how to work with the Kubernetes UI. For information on how to access and use it, see [docs/ui.md](../docs/ui.md).
## Installing dependencies
There are two kinds of dependencies in the UI project: tools and frameworks. The tools help
us manage and test the application. They are not part of the application. The frameworks, on the other hand, become part of the application, as described below.
@@ -13,6 +16,8 @@ npm install
It creates a new directory, `www/master/node_modules`, which contains the tool dependencies.
## Building and serving the app
### Building the app for development
To build the application for development, run this command from the `www/master` directory:
@@ -33,17 +38,25 @@ The `www/app` directory and its contents are generated by the build. All of the
### Serving the app during development
For development you can serve the files locally by installing a webserver as follows:
For development you can serve the files locally by installing a web server as follows:
```
sudo npm install -g http-server
```
The server can then be launched from the `app` directory as follows:
The server can then be launched from the `www/app` directory as follows:
```
cd www/app
http-server -a localhost -p 8000
http-server -a localhost -p 8001
```
`http-server` is convenient, since we're already using `npm`, but any web server hosting the `www/app` directory should work.
Note that you'll need to tell the application where to find the api server by setting the value of the `k8sApiServer` configuration parameter in `www/master/shared/config/development.json` and then rebuilding the application. For example, for a cluster running locally at `localhost:8080`, as described [here](../docs/getting-started-guides/locally.md), you'll want to set it as follows:
```
"k8sApiServer": "http://localhost:8080/api/v1beta3"
```
### Building the app for production
@@ -68,12 +81,18 @@ Then, run one of the go build scripts, such as `hack/build-go.sh`, to build a ne
### Serving the app in production
The app is served in production by `kube-apiserver` at:
```
https://<kubernetes-master>/ui/
```
which redirects to:
```
https://<kubernetes-master>/static/app/
```
### Configuration
#### Configuration settings
## Configuration
### Configuration settings
A json file can be used by `gulp` to automatically create angular constants. This is useful for setting per environment variables such as api endpoints.
`www/master/shared/config/development.json` and `www/master/shared/config/production.json` are used for application wide configuration in development and production, respectively.
@@ -105,19 +124,19 @@ angular.module('kubernetesApp.config', [])
});
```
#### Kubernetes server configuration
### Kubernetes server configuration
**RECOMMENDED**: The Kubernetes api server does not enable CORS by default, so `kube-apiserver` must be started with `--cors_allowed_origins=http://<your
host here>` or `--cors_allowed_origins=.*`.
**NOT RECOMMENDED**: If you don't want to/cannot restart the Kubernetes api server, you can start your browser with web security disabled. For example, you can [launch Chrome](http://www.chromium.org/developers/how-tos/run-chromium-with-flags) with flag `--disable-web-security`. Be careful not to visit untrusted web sites when running your browser in this mode.
### Building a new visualizer or component
## Building a new visualizer or component
See [master/components/README.md](master/components/README.md).
### Testing
## Testing
Currently, the UI project includes both unit-testing with [Karma](http://karma-runner.github.io/0.12/index.html) and end-to-end testing with [Protractor](http://angular.github.io/protractor/#/).
#### Unit testing with Karma
### Unit testing with Karma
To run the existing Karma tests:
* Install the Karma CLI (Note: it needs to be installed globally, so the `sudo` below may be needed. The other Karma packages, such as `karma`, `karma-jasmine`, and `karma-chrome-launcher,` should be installed automatically by the build).
@@ -138,7 +157,7 @@ To run new Karma tests for a component, put new `*.spec.js` files under the appr
To test the chrome, put new `*.spec.js` files under the appropriate `www/master/test/modules/*` directories.
#### End-to-end testing with Protractor
### End-to-end testing with Protractor
To run the existing Protractor tests:
* Install the CLIs.