some Makefile polishing and updated admin docs on UI

This commit is contained in:
Felix Kunde 2020-01-30 16:45:33 +01:00
parent a7421184b5
commit b1fae4d171
2 changed files with 33 additions and 26 deletions

View File

@ -488,8 +488,12 @@ A secret can be pre-provisioned in different ways:
With the v1.2 release the Postgres Operator is shipped with a browser-based With the v1.2 release the Postgres Operator is shipped with a browser-based
configuration user interface (UI) that simplifies managing Postgres clusters 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 with the operator. It talks to the K8s API Server as well as the Postgres
image. 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).
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 Run NPM to continuously compile `tags/js` code. Basically, it creates an
`app.js` file in: `static/build/app.js` `app.js` file in: `static/build/app.js`
@ -498,26 +502,37 @@ Run NPM to continuously compile `tags/js` code. Basically, it creates an
(cd ui/app && npm start) (cd ui/app && npm start)
``` ```
To build the Docker image open a shell and change to the `ui` folder. Then run: To build operator UI and Docker image open a shell, change to the `ui` folder
and run:
```bash ```bash
docker build -t registry.opensource.zalan.do/acid/postgres-operator-ui:v1.3.0 . make docker
``` ```
Apply all manifests for the `ui/manifests` folder to deploy the Postgres Apply all manifests from the `ui/manifests` folder to deploy the Postgres
Operator UI on K8s. For local tests you don't need the Ingress resource. Operator UI on K8s. Replace the image tag in the deployment manifest if you
want to test the image you build with `make docker`. For local tests you also
don't need the Ingress resource. Make sure the pods for the operator and the UI
are both running.
```bash ```bash
kubectl apply -f ui/manifests sed -e "s/\(image\:.*\:\).*$/\1$TAG/" manifests/deployment.yaml | kubectl apply -f manifests/
kubectl get all -l application=postgres-operator-ui
``` ```
Make sure the pods for the operator and the UI are both running. For local For local testing you need to apply proxying and port forwarding so that the UI
testing you need to apply proxying and port forwarding so that the UI can talk can talk to the K8s and Postgres Operator REST API. You can use the provided
to the K8s and Postgres Operator REST API. You can use the provided
`run_local.sh` script for this. Make sure Python dependencies are installed on `run_local.sh` script for this. Make sure Python dependencies are installed on
you machine and the correct URL to your K8s API server is used, e.g. for your machine and the correct K8s API server URL is used, e.g. for minikube it
minikube it would usually be `https://192.168.99.100:8443`. would usually be `https://192.168.99.100:8443`. When testing in minikube you
have to build the image in its docker environment as `make docker` doesn't do it
for you. From the `ui` directory execute:
```bash ```bash
# minikube
eval $(minikube docker-env)
docker build -t registry.opensource.zalan.do/acid/postgres-operator-ui:v1.3.0 .
kubectl apply -f manifests/
./run_local.sh ./run_local.sh
``` ```

View File

@ -1,17 +1,6 @@
.PHONY: clean test appjs docker push mock .PHONY: clean test appjs docker push mock
BINARY ?= postgres-operator-ui IMAGE ?= registry.opensource.zalan.do/acid/postgres-operator-ui
BUILD_FLAGS ?= -v
CGO_ENABLED ?= 0
ifeq ($(RACE),1)
BUILD_FLAGS += -race -a
CGO_ENABLED=1
endif
LOCAL_BUILD_FLAGS ?= $(BUILD_FLAGS)
LDFLAGS ?= -X=main.version=$(VERSION)
IMAGE ?= registry.opensource.zalan.do/acid/$(BINARY)
VERSION ?= $(shell git describe --tags --always --dirty) VERSION ?= $(shell git describe --tags --always --dirty)
TAG ?= $(VERSION) TAG ?= $(VERSION)
GITHEAD = $(shell git rev-parse --short HEAD) GITHEAD = $(shell git rev-parse --short HEAD)
@ -32,8 +21,11 @@ appjs:
docker run $(TTYFLAGS) -u $$(id -u) -v $$(pwd):/workdir -w /workdir/app node:10.1.0-alpine npm run build docker run $(TTYFLAGS) -u $$(id -u) -v $$(pwd):/workdir -w /workdir/app node:10.1.0-alpine npm run build
docker: appjs docker: appjs
docker build --build-arg "VERSION=$(VERSION)" -t "$(IMAGE):$(TAG)" . echo `(env)`
@echo 'Docker image $(IMAGE):$(TAG) can now be used.' echo "Tag ${TAG}"
echo "Version ${VERSION}"
echo "git describe $(shell git describe --tags --always --dirty)"
docker build --rm -t "$(IMAGE):$(TAG)" -f Dockerfile .
push: docker push: docker
docker push "$(IMAGE):$(TAG)" docker push "$(IMAGE):$(TAG)"