forked from cloudnative-pg/cloudnative-pg
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcluster-example-pod-selector-refs.yaml
More file actions
33 lines (29 loc) · 1.02 KB
/
cluster-example-pod-selector-refs.yaml
File metadata and controls
33 lines (29 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: cluster-example-pod-selector-refs
spec:
instances: 3
# Define named pod label selectors for dynamic pg_hba address resolution.
# The operator resolves matching pod IPs and expands ${podselector:NAME}
# references in pg_hba rules into one line per IP with /32 (IPv4) or /128 (IPv6) masks.
podSelectorRefs:
- name: app-pods
selector:
matchLabels:
app: myapp
- name: monitoring
selector:
matchLabels:
role: monitoring
postgresql:
pg_hba:
# These rules use ${podselector:NAME} syntax to reference podSelectorRefs.
# Each reference is expanded to one line per matching pod IP.
- "hostssl mydb myuser ${podselector:app-pods} scram-sha-256"
- "hostssl postgres monitor ${podselector:monitoring} scram-sha-256"
# Standard rules without expansion are passed through unchanged.
- host all all 10.244.0.0/16 md5
primaryUpdateStrategy: unsupervised
storage:
size: 1Gi