set event broadcasting to Infof and update rbac

This commit is contained in:
Felix Kunde 2020-04-29 12:00:26 +02:00
parent d76203b3f9
commit 5463e2809a
4 changed files with 26 additions and 5 deletions

View File

@ -49,6 +49,11 @@ rules:
- events - events
verbs: verbs:
- create - create
- get
- list
- patch
- update
- watch
# to manage endpoints which are also used by Patroni # to manage endpoints which are also used by Patroni
- apiGroups: - apiGroups:
- "" - ""

View File

@ -53,8 +53,19 @@ them.
## Watch pods being created ## Watch pods being created
Check if the database pods are coming up. Use the label `application=spilo` to
filter and list the label `spilo-role` to see when the master is promoted and
replicas get their labels.
```bash ```bash
kubectl get pods -w --show-labels kubectl get pods -l application=spilo -L spilo-role -w
```
The operator also emits K8s events to the Postgresql CRD which can be inspected
in the operator logs or with:
```bash
kubectl describe postgresql acid-minimal-cluster
``` ```
## Connect to PostgreSQL ## Connect to PostgreSQL
@ -736,14 +747,14 @@ spin up more instances).
## Custom TLS certificates ## Custom TLS certificates
By default, the spilo image generates its own TLS certificate during startup. By default, the Spilo image generates its own TLS certificate during startup.
However, this certificate cannot be verified and thus doesn't protect from However, this certificate cannot be verified and thus doesn't protect from
active MITM attacks. In this section we show how to specify a custom TLS active MITM attacks. In this section we show how to specify a custom TLS
certificate which is mounted in the database pods via a K8s Secret. certificate which is mounted in the database pods via a K8s Secret.
Before applying these changes, in k8s the operator must also be configured with Before applying these changes, in k8s the operator must also be configured with
the `spilo_fsgroup` set to the GID matching the postgres user group. If you the `spilo_fsgroup` set to the GID matching the postgres user group. If you
don't know the value, use `103` which is the GID from the default spilo image don't know the value, use `103` which is the GID from the default Spilo image
(`spilo_fsgroup=103` in the cluster request spec). (`spilo_fsgroup=103` in the cluster request spec).
OpenShift allocates the users and groups dynamically (based on scc), and their OpenShift allocates the users and groups dynamically (based on scc), and their
@ -805,5 +816,5 @@ spec:
Alternatively, it is also possible to use Alternatively, it is also possible to use
[cert-manager](https://cert-manager.io/docs/) to generate these secrets. [cert-manager](https://cert-manager.io/docs/) to generate these secrets.
Certificate rotation is handled in the spilo image which checks every 5 Certificate rotation is handled in the Spilo image which checks every 5
minutes if the certificates have changed and reloads postgres accordingly. minutes if the certificates have changed and reloads postgres accordingly.

View File

@ -50,6 +50,11 @@ rules:
- events - events
verbs: verbs:
- create - create
- get
- list
- patch
- update
- watch
# to manage endpoints which are also used by Patroni # to manage endpoints which are also used by Patroni
- apiGroups: - apiGroups:
- "" - ""

View File

@ -76,7 +76,7 @@ func NewController(controllerConfig *spec.ControllerConfig, controllerId string)
} }
eventBroadcaster := record.NewBroadcaster() eventBroadcaster := record.NewBroadcaster()
eventBroadcaster.StartLogging(logger.Debugf) eventBroadcaster.StartLogging(logger.Infof)
recorder := eventBroadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: myComponentName}) recorder := eventBroadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: myComponentName})
c := &Controller{ c := &Controller{