Initial commit for Postgres Operator UI (#613)

* Initial commit for our basic Postgres Operator UI:
 * Create and modify Postgres manifests
 * Watch Operator Logs in the UI
 * Observe cluster creation progress
 * S3 Backup browser for clone and restore

Many thanks to Manuel Gomez and Jan Mussler for the initial UI work a long time ago!
This commit is contained in:
Felix Kunde
2019-07-12 17:02:55 +02:00
committed by GitHub
parent 4fc5822b24
commit 4eabc8f5db
60 changed files with 12752 additions and 13 deletions
+38 -1
View File
@@ -313,7 +313,7 @@ empty sequence `[]`. Setting the field to `null` or omitting it entirely may
lead to K8s removing this field from the manifest due to its
[handling of null fields](https://kubernetes.io/docs/concepts/overview/object-management-kubectl/declarative-config/#how-apply-calculates-differences-and-merges-changes).
Then the resultant manifest will not contain the necessary change, and the
operator will respectively do noting with the existing source ranges.
operator will respectively do nothing with the existing source ranges.
## Running periodic 'autorepair' scans of K8s objects
@@ -409,3 +409,40 @@ A secret can be pre-provisioned in different ways:
* Generic secret created via `kubectl create secret generic some-cloud-creds --from-file=some-cloud-credentials-file.json`
* Automatically provisioned via a custom K8s controller like
[kube-aws-iam-controller](https://github.com/mikkeloscar/kube-aws-iam-controller)
## Setting up the Postgres Operator UI
With 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. 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`
```
(cd ui/app && npm start)
```
To build the Docker image open a shell and change to the `ui` folder. Then run:
```
docker build -t registry.opensource.zalan.do/acid/postgres-operator-ui:v1.2.0 .
```
Apply all manifests for the `ui/manifests` folder to deploy the Postgres
Operator UI on K8s. For local tests you don't need the Ingress resource.
```
kubectl apply -f ui/manifests
```
Make sure the pods for the operator and the UI are both running. 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. You can use the provided
`run_local.sh` script for this. Make sure it uses the correct URL to your K8s
API server, e.g. for minikube it would be `https://192.168.99.100:8443`.
```
./run_local.sh
```
Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

+65
View File
@@ -0,0 +1,65 @@
# Postgres Operator UI
The Postgres Operator UI provides a graphical interface for a convenient
database-as-a-service user experience. Once the operator is set up by database
and/or Kubernetes (K8s) admins it's very easy for other teams to create, clone,
watch, edit and delete their own Postgres clusters. Information on the setup
and technical details can be found in the [admin docs](administrator.md#setting-up-the-postgres-operator-ui).
## Create a new cluster
In the top menu select the "New cluster" option and adjust the values in the
text fields. The cluster name is composed of the team plus given name. Among the
available options are [enabling load balancers](administrator.md#load-balancers-and-allowed-ip-ranges),
[volume size](user.md#increase-volume-size),
[users and databases](user.md#manifest-roles) and
[pod resources](cluster-manifest.md#postgres-container-resources).
![pgui-new-cluster](diagrams/pgui-new-cluster.png "Create a new cluster")
On the left side you will see a preview of the Postgres cluster manifest which
is applied when clicking on the green "Create cluster" button.
## Cluster starting up
After the manifest is applied to K8s the Postgres Operator will create all
necessary resources. The progress of this process can nicely be followed in UI
status page.
![pgui-cluster-startup](diagrams/pgui-cluster-startup.png "Cluster starting up")
![pgui-waiting-for-master](diagrams/pgui-waiting-for-master.png "Waiting for master pod")
Usually, the startup should only take up to 1 minute. If you feel the process
got stuck click on the "Logs" button to inspect the operator logs. From the
"Status" field in the top menu you can also retrieve the logs and queue of each
worker the operator is using. The number of concurrent workers can be
[configured](reference/operator_parameters.md#general).
![pgui-operator-logs](diagrams/pgui-operator-logs.png "Checking operator logs")
Once the startup has finished you will see the cluster address path. When load
balancers are enabled the listed path can be used as the host name when
connecting to PostgreSQL. But, make sure your IP is within the specified
`allowedSourceRanges`.
![pgui-finished-setup](diagrams/pgui-finished-setup.png "Status page of ready cluster")
## Update and delete clusters
Created clusters are listed under the menu "PostgreSQL clusters". You can get
back to cluster's status page via the "Status" button. From both menus you can
choose to edit the manifest, [clone](user.md#how-to-clone-an-existing-postgresql-cluster)
or delete a cluster.
![pgui-cluster-list](diagrams/pgui-cluster-list.png "List of PostgreSQL clusters")
Note, that not all [manifest options](reference/cluster_manifest.md) are yet
supported in the UI. If you try to add them in the editor view it won't have an
effect. Use `kubectl` commands instead. The displayed manifest on the left side
will also show parameters patched that way.
When deleting a cluster you are asked to type in its namespace and name to
confirm the action.
![pgui-delete-cluster](diagrams/pgui-delete-cluster.png "Confirm cluster deletion")
@@ -1,4 +1,4 @@
## Command-line options
# Command-line options
The following command-line options are supported for the operator: