mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-04 11:41:33 +02:00
Add inherited_labels (#459)
* add support for inherited_labels Signed-off-by: Stephane Tang <hi@stang.sh> * update docs with inherited_labels Signed-off-by: Stephane Tang <hi@stang.sh>
This commit is contained in:
committed by
Sergey Dudoladov
parent
f2dddb0f2b
commit
d11b23bd71
@@ -146,6 +146,57 @@ data:
|
||||
...
|
||||
```
|
||||
|
||||
### Add cluster-specific labels
|
||||
|
||||
In some cases, you might want to add `labels` that are specific to a given
|
||||
postgres cluster, in order to identify its child objects.
|
||||
The typical use case is to add labels that identifies the `Pods` created by the
|
||||
operator, in order to implement fine-controlled `NetworkPolicies`.
|
||||
|
||||
**OperatorConfiguration**
|
||||
|
||||
```yaml
|
||||
apiVersion: "acid.zalan.do/v1"
|
||||
kind: OperatorConfiguration
|
||||
metadata:
|
||||
name: postgresql-operator-configuration
|
||||
configuration:
|
||||
kubernetes:
|
||||
inherited_labels:
|
||||
- application
|
||||
- environment
|
||||
...
|
||||
```
|
||||
|
||||
**cluster manifest**
|
||||
|
||||
```yaml
|
||||
apiVersion: "acid.zalan.do/v1"
|
||||
kind: postgresql
|
||||
metadata:
|
||||
name: demo-cluster
|
||||
labels:
|
||||
application: my-app
|
||||
environment: demo
|
||||
spec:
|
||||
...
|
||||
```
|
||||
|
||||
**network policy**
|
||||
|
||||
```yaml
|
||||
kind: NetworkPolicy
|
||||
apiVersion: networking.k8s.io/v1
|
||||
metadata:
|
||||
name: netpol-example
|
||||
spec:
|
||||
podSelector:
|
||||
matchLabels:
|
||||
application: my-app
|
||||
environment: demo
|
||||
...
|
||||
```
|
||||
|
||||
## Custom Pod Environment Variables
|
||||
|
||||
It is possible to configure a ConfigMap which is used by the Postgres pods as
|
||||
|
||||
Reference in New Issue
Block a user