You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/devel/getting-started.md
+45-18Lines changed: 45 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,10 @@ This document describes how to setup your development environment.
4
4
5
5
## Architecture Overview
6
6
7
-
Kubernetes Dashboard project consists of two main components. They are called here the frontend and the backend. The frontend is a single page web application that runs in a browser. It fetches all its business data from the backend using standard HTTP methods. The backend implements UI-business logic and fetches raw data from the various Kubernetes APIs.
7
+
Kubernetes Dashboard project consists of two main components. They are called here the frontend and
8
+
the backend. The frontend is a single page web application that runs in a browser. It fetches all
9
+
its business data from the backend using standard HTTP methods. The backend implements UI-business
10
+
logic and fetches raw data from the various Kubernetes APIs.
8
11
9
12
## Preparation
10
13
@@ -23,45 +26,60 @@ $ npm install
23
26
24
27
## Run a Kubernetes Cluster
25
28
26
-
For development it is recommended to run a local Kubernetes cluster. For your convenience, a task is provided that checks out the latest stable version, and runs it inside a Docker container. Open a separate tab in your terminal and run the following command:
29
+
For development it is recommended to run a local Kubernetes cluster. For your convenience, a
30
+
task is provided that checks out the latest stable version, and runs it inside a Docker container.
31
+
Open a separate tab in your terminal and run the following command:
27
32
28
33
```
29
34
$ gulp local-up-cluster
30
35
```
31
36
32
-
This will build and start a lightweight local cluster, consisting of a master and a single node. All processes run locally, in Docker container. The local cluster should behave like a real cluster, however, plugins like heapster are not installed. To shut it down, type the following command that kills all running Docker containers:
37
+
This will build and start a lightweight local cluster, consisting of a master and a single node.
38
+
All processes run locally, in Docker container. The local cluster should behave like a real
39
+
cluster, however, plugins like heapster are not installed. To shut it down, type the following
40
+
command that kills all running Docker containers:
33
41
34
42
```
35
43
$ docker kill $(docker ps -aq)
36
44
```
37
45
38
-
From time to time you might want to use to a real Kubernetes cluster (e.g. GCE, Vagrant) instead of the local one. The most convenient way is to create a proxy. Run the following command instead of the gulp task from above:
46
+
From time to time you might want to use to a real Kubernetes cluster (e.g. GCE, Vagrant) instead
47
+
of the local one. The most convenient way is to create a proxy. Run the following command instead
48
+
of the gulp task from above:
39
49
```
40
50
$ kubectl proxy --port=8080
41
51
```
42
-
kubectl will handle authentication with Kubernetes and create an API proxy with the address `localhost:8080`. Therefore, no changes in the configuration are required.
52
+
kubectl will handle authentication with Kubernetes and create an API proxy with the address
53
+
`localhost:8080`. Therefore, no changes in the configuration are required.
43
54
44
55
## Serving Dashboard for Development
45
56
46
57
It is easy to compile and run Dashboard. Open a new tab in your terminal and type:
47
58
```
48
59
$ gulp serve
49
60
```
50
-
Open a browser and access the UI under `localhost:9090`. A lot of things happened underneath. Let's scratch on the surface a bit.
61
+
Open a browser and access the UI under `localhost:9090`. A lot of things happened underneath.
62
+
Let's scratch on the surface a bit.
51
63
52
64
Compilation:
53
65
* Stylesheets are implemented with SASS and compiled to CSS with libsass
54
-
* JavaScript is implemented in ES6. It is compiled with Babel for development and the Google-Closure-Compiler for production.
55
-
* Go is used for the implementation of the backend. The source code gets compiled into the single binary 'dashboard'
66
+
* JavaScript is implemented in ES6. It is compiled with Babel for development and the
67
+
Google-Closure-Compiler for production.
68
+
* Go is used for the implementation of the backend. The source code gets compiled into the
69
+
single binary 'dashboard'
56
70
57
71
58
72
Execution:
59
-
* Frontend is served by BrowserSync. It enables features like live reloading when HTML/CSS/JS change and even synchronize scrolls, clicks and form inputs across multiple devices.
73
+
* Frontend is served by BrowserSync. It enables features like live reloading when
74
+
HTML/CSS/JS change and even synchronize scrolls, clicks and form inputs across multiple devices.
60
75
* Backend is served by the 'dashboard' binary.
61
76
62
-
File watchers listen for source code changes (CSS, JS, GO) and automatically recompile. All changes are instantly reflected, e.g. by automatic process restarts or browser refreshes. The build artifacts are created in a hidden folder (`.tmp`).
77
+
File watchers listen for source code changes (CSS, JS, GO) and automatically recompile.
78
+
All changes are instantly reflected, e.g. by automatic process restarts or browser refreshes.
79
+
The build artifacts are created in a hidden folder (`.tmp`).
63
80
64
-
After successful execution of `gulp local-up-cluster` and `gulp serve`, the following processes should be running (respective ports are given in parentheses):
81
+
After successful execution of `gulp local-up-cluster` and `gulp serve`, the following processes
82
+
should be running (respective ports are given in parentheses):
65
83
66
84
BrowserSync (9090) ---> Dashboard backend (9091) ---> Kubernetes API server (8080)
67
85
@@ -72,14 +90,16 @@ The Dashboard project can be built for production by using the following task:
72
90
```
73
91
$ gulp build
74
92
```
75
-
The code is compiled, compressed and debug support removed. The artifacts can be found in the `dist` folder.
93
+
The code is compiled, compressed and debug support removed. The artifacts can be found
94
+
in the `dist` folder.
76
95
77
96
In order to serve Dashboard from the `dist` folder, use the following task:
78
97
79
98
```
80
99
$ gulp serve:prod
81
100
```
82
-
Open a browser and access the UI under `localhost:9090.` The following processes should be running (respective ports are given in parentheses):
101
+
Open a browser and access the UI under `localhost:9090.` The following processes should
102
+
be running (respective ports are given in parentheses):
83
103
84
104
85
105
Dashboard backend (9090) ---> Kubernetes API server (8080)
@@ -90,23 +110,30 @@ In order to package everything into a ready-to-run Docker image, use the followi
90
110
```
91
111
$ gulp docker-image:canary
92
112
```
93
-
You might notice that the Docker image is very small and requires only a few MB. Only Dashboard assets are added to a scratch image. This is possible, because the `dashboard` binary has no external dependencies. Awesome!
113
+
You might notice that the Docker image is very small and requires only a few MB. Only
114
+
Dashboard assets are added to a scratch image. This is possible, because the `dashboard`
115
+
binary has no external dependencies. Awesome!
94
116
95
117
## Run the Tests
96
-
Unit tests should be executed after every source code change. The following task makes this a breeze by automatically executing the unit tests after every save action.
118
+
Unit tests should be executed after every source code change. The following task makes this
119
+
a breeze by automatically executing the unit tests after every save action.
97
120
98
121
```
99
122
$ gulp test:watch
100
123
```
101
-
The full test suite includes static code analysis, unit tests and integration tests. It can be executed with:
124
+
The full test suite includes static code analysis, unit tests and integration tests.
125
+
It can be executed with:
102
126
```
103
127
$ gulp check
104
128
```
105
129
106
130
## Building Dashboard Inside a Container
107
131
108
-
It's possible to run `gulp` and all the dependencies inside a development container. To do this, just replace `gulp [some arg]` commands with `build/run-gulp-in-docker.sh [some arg]`. If you do this, the only dependency is `docker`, and required commands such as `npm install` will be run automatically.
132
+
It's possible to run `gulp` and all the dependencies inside a development container. To do this,
133
+
just replace `gulp [some arg]` commands with `build/run-gulp-in-docker.sh [some arg]`. If you
134
+
do this, the only dependency is `docker`, and required commands such as `npm install`
135
+
will be run automatically.
109
136
110
137
## Contribute
111
138
112
-
Wish to contribute !! Great start [here](../../CONTRIBUTING.md).
139
+
Wish to contribute? Great, start [here](../../CONTRIBUTING.md).
0 commit comments