extend admin docs on UI

This commit is contained in:
Felix Kunde 2020-02-03 16:50:02 +01:00
parent bc04e92a3d
commit 7da6bd86a4
1 changed files with 34 additions and 21 deletions

View File

@ -486,29 +486,36 @@ A secret can be pre-provisioned in different ways:
## Setting up the Postgres Operator UI
With the v1.2 release the Postgres Operator is shipped with a browser-based
Since the v1.2 release the Postgres Operator is shipped with a browser-based
configuration user interface (UI) that simplifies managing Postgres clusters
with the operator. It talks to the K8s API Server as well as the Postgres
Operator [REST API](developer.md#debugging-the-operator). URLs as well as parts
of the UI layout can be configured via environment variables in the
[deployment manifest](../ui/manifests/deployment.yaml#L40).
with the operator.
The UI runs with Node.js and comes with it's own Docker image. Run NPM to
continuously compile `tags/js` code. Basically, it creates an `app.js` file in:
`static/build/app.js`
### Building the UI image
```bash
(cd ui/app && npm start)
```
To build operator UI and Docker image open a shell, change to the `ui` folder
and run:
The UI runs with Node.js and comes with it's own Docker
image. However, installing Node.js to build the operator UI is not required. It
is handled via Docker containers when running:
```bash
make docker
```
Apply all manifests from the `ui/manifests` folder to deploy the Postgres
### Configure endpoints and options
The UI talks to the K8s API server as well as the Postgres Operator [REST API](developer.md#debugging-the-operator).
K8s API server URLs are loaded from the machine's kubeconfig environment by
default. Alternatively, a list can also be passed when starting the Python
application with the `--cluster` option.
The Operator API endpoint can be configured via the `OPERATOR_API_URL`
environment variables in the [deployment manifest](../ui/manifests/deployment.yaml#L40).
You can also expose the operator API through a [service](../manifests/api-service.yaml).
Some displayed options can be disabled from UI using simple flags under the
`OPERATOR_UI_CONFIG` field in the deployment.
### Deploy the UI on K8s
Now, apply all manifests from the `ui/manifests` folder to deploy the Postgres
Operator UI on K8s. Replace the image tag in the deployment manifest if you
want to test the image you've built with `make docker`. Make sure the pods for
the operator and the UI are both running.
@ -518,11 +525,17 @@ sed -e "s/\(image\:.*\:\).*$/\1$TAG/" manifests/deployment.yaml | kubectl apply
kubectl get all -l application=postgres-operator-ui
```
For local testing you need to apply proxying and port forwarding so that the UI
can talk to the K8s and Postgres Operator REST API. The Ingress resource is not
needed. You can use the provided `run_local.sh` script for this. Make sure
Python dependencies are installed on your machine and the correct K8s API server
URL is used, e.g. for minikube it would usually be `https://192.168.99.100:8443`.
### Local testing
For local testing you need to apply K8s proxying and operator pod port
forwarding so that the UI can talk to the K8s and Postgres Operator REST API.
The Ingress resource is not needed. You can use the provided `run_local.sh`
script for this. Make sure that:
* Python dependencies are installed on your machine
* the K8s API server URL is set for kubectl commands, e.g. for minikube it would usually be `https://192.168.99.100:8443`.
* the pod label selectors for port forwarding are correct
When testing with minikube you have to build the image in its docker environment
(running `make docker` doesn't do it for you). From the `ui` directory execute:
@ -537,7 +550,7 @@ docker build -t registry.opensource.zalan.do/acid/postgres-operator-ui:v1.3.0 .
# apply UI manifests next to a running Postgres Operator
kubectl apply -f manifests/
# install python dependencies and run UI locally
# install python dependencies to run UI locally
pip3 install -r requirements
./run_local.sh
```