Skip to content

Commit

Permalink
set event broadcasting to Infof and update rbac (#952)
Browse files Browse the repository at this point in the history
  • Loading branch information
FxKu committed Apr 29, 2020
1 parent d76203b commit 865d5b4
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
5 changes: 5 additions & 0 deletions charts/postgres-operator/templates/clusterrole.yaml
Expand Up @@ -49,6 +49,11 @@ rules:
- events
verbs:
- create
- get
- list
- patch
- update
- watch
# to manage endpoints which are also used by Patroni
- apiGroups:
- ""
Expand Down
19 changes: 15 additions & 4 deletions docs/user.md
Expand Up @@ -53,8 +53,19 @@ them.

## 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
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 get pods -w --show-labels
kubectl describe postgresql acid-minimal-cluster
```

## Connect to PostgreSQL
Expand Down Expand Up @@ -736,14 +747,14 @@ spin up more instances).

## 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
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.

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
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).

OpenShift allocates the users and groups dynamically (based on scc), and their
Expand Down Expand Up @@ -805,5 +816,5 @@ spec:
Alternatively, it is also possible to use
[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.
5 changes: 5 additions & 0 deletions manifests/operator-service-account-rbac.yaml
Expand Up @@ -50,6 +50,11 @@ rules:
- events
verbs:
- create
- get
- list
- patch
- update
- watch
# to manage endpoints which are also used by Patroni
- apiGroups:
- ""
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/controller.go
Expand Up @@ -76,7 +76,7 @@ func NewController(controllerConfig *spec.ControllerConfig, controllerId string)
}

eventBroadcaster := record.NewBroadcaster()
eventBroadcaster.StartLogging(logger.Debugf)
eventBroadcaster.StartLogging(logger.Infof)
recorder := eventBroadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: myComponentName})

c := &Controller{
Expand Down

0 comments on commit 865d5b4

Please sign in to comment.