@@ -480,37 +480,71 @@ A secret can be pre-provisioned in different ways:
480
480
481
481
# # Setting up the Postgres Operator UI
482
482
483
- With the v1.2 release the Postgres Operator is shipped with a browser-based
483
+ Since the v1.2 release the Postgres Operator is shipped with a browser-based
484
484
configuration user interface (UI) that simplifies managing Postgres clusters
485
- with the operator. The UI runs with Node.js and comes with it's own Docker
486
- image.
485
+ with the operator.
487
486
488
- Run NPM to continuously compile `tags/js` code. Basically, it creates an
489
- `app.js` file in : ` static/build/app.js`
487
+ # ## Building the UI image
490
488
491
- ` ` `
492
- (cd ui/app && npm start)
493
- ` ` `
494
-
495
- To build the Docker image open a shell and change to the `ui` folder. Then run :
489
+ The UI runs with Node.js and comes with it's own Docker
490
+ image. However, installing Node.js to build the operator UI is not required. It
491
+ is handled via Docker containers when running :
496
492
497
493
` ` ` bash
498
- docker build -t registry.opensource.zalan.do/acid/postgres-operator-ui:v1.2.0 .
494
+ make docker
499
495
` ` `
500
496
501
- Apply all manifests for the `ui/manifests` folder to deploy the Postgres
502
- Operator UI on K8s. For local tests you don't need the Ingress resource.
497
+ # ## Configure endpoints and options
498
+
499
+ The UI talks to the K8s API server as well as the Postgres Operator [REST API](developer.md#debugging-the-operator).
500
+ K8s API server URLs are loaded from the machine's kubeconfig environment by
501
+ default. Alternatively, a list can also be passed when starting the Python
502
+ application with the `--cluster` option.
503
+
504
+ The Operator API endpoint can be configured via the `OPERATOR_API_URL`
505
+ environment variables in the [deployment manifest](../ui/manifests/deployment.yaml#L40).
506
+ You can also expose the operator API through a [service](../manifests/api-service.yaml).
507
+ Some displayed options can be disabled from UI using simple flags under the
508
+ ` OPERATOR_UI_CONFIG` field in the deployment.
509
+
510
+ # ## Deploy the UI on K8s
511
+
512
+ Now, apply all manifests from the `ui/manifests` folder to deploy the Postgres
513
+ Operator UI on K8s. Replace the image tag in the deployment manifest if you
514
+ want to test the image you've built with `make docker`. Make sure the pods for
515
+ the operator and the UI are both running.
503
516
504
517
` ` ` bash
505
- kubectl apply -f ui/manifests
518
+ sed -e "s/\( image\: .*\:\) .*$/\1 $TAG/" manifests/deployment.yaml | kubectl apply -f manifests/
519
+ kubectl get all -l application=postgres-operator-ui
506
520
` ` `
507
521
508
- Make sure the pods for the operator and the UI are both running. For local
509
- testing you need to apply proxying and port forwarding so that the UI can talk
510
- to the K8s and Postgres Operator REST API. You can use the provided
511
- ` run_local.sh` script for this. Make sure it uses the correct URL to your K8s
512
- API server, e.g. for minikube it would be `https://192.168.99.100:8443`.
522
+ # ## Local testing
523
+
524
+ For local testing you need to apply K8s proxying and operator pod port
525
+ forwarding so that the UI can talk to the K8s and Postgres Operator REST API.
526
+ The Ingress resource is not needed. You can use the provided `run_local.sh`
527
+ script for this. Make sure that :
528
+
529
+ * Python dependencies are installed on your machine
530
+ * the K8s API server URL is set for kubectl commands, e.g. for minikube it would usually be `https://192.168.99.100:8443`.
531
+ * the pod label selectors for port forwarding are correct
532
+
533
+ When testing with minikube you have to build the image in its docker environment
534
+ (running `make docker` doesn't do it for you). From the `ui` directory execute :
513
535
514
536
` ` ` bash
537
+ # compile and build operator UI
538
+ make docker
539
+
540
+ # build in image in minikube docker env
541
+ eval $(minikube docker-env)
542
+ docker build -t registry.opensource.zalan.do/acid/postgres-operator-ui:v1.3.0 .
543
+
544
+ # apply UI manifests next to a running Postgres Operator
545
+ kubectl apply -f manifests/
546
+
547
+ # install python dependencies to run UI locally
548
+ pip3 install -r requirements
515
549
./run_local.sh
516
550
` ` `
0 commit comments