mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-09-30 17:30:33 +02:00
define ownership between operator and clusters via annotation (#802)
* define ownership between operator and postgres clusters * add documentation * add unit test
This commit is contained in:
@@ -95,6 +95,34 @@ lacks access rights to any of them (except K8s system namespaces like
|
||||
'list pods' execute at the cluster scope and fail at the first violation of
|
||||
access rights.
|
||||
|
||||
## Operators with defined ownership of certain Postgres clusters
|
||||
|
||||
By default, multiple operators can only run together in one K8s cluster when
|
||||
isolated into their [own namespaces](administrator.md#specify-the-namespace-to-watch).
|
||||
But, it is also possible to define ownership between operator instances and
|
||||
Postgres clusters running all in the same namespace or K8s cluster without
|
||||
interfering.
|
||||
|
||||
First, define the [`CONTROLLER_ID`](../../manifests/postgres-operator.yaml#L38)
|
||||
environment variable in the operator deployment manifest. Then specify the ID
|
||||
in every Postgres cluster manifest you want this operator to watch using the
|
||||
`"acid.zalan.do/controller"` annotation:
|
||||
|
||||
```yaml
|
||||
apiVersion: "acid.zalan.do/v1"
|
||||
kind: postgresql
|
||||
metadata:
|
||||
name: demo-cluster
|
||||
annotations:
|
||||
"acid.zalan.do/controller": "second-operator"
|
||||
spec:
|
||||
...
|
||||
```
|
||||
|
||||
Every other Postgres cluster which lacks the annotation will be ignored by this
|
||||
operator. Conversely, operators without a defined `CONTROLLER_ID` will ignore
|
||||
clusters with defined ownership of another operator.
|
||||
|
||||
## Role-based access control for the operator
|
||||
|
||||
The manifest [`operator-service-account-rbac.yaml`](../manifests/operator-service-account-rbac.yaml)
|
||||
|
||||
Reference in New Issue
Block a user