Files
Keybard-Vagabond-Demo/manifests/infrastructure/postgresql/postgresql-service-alias.yaml

65 lines
1.4 KiB
YAML
Raw Normal View History

---
# Service alias for backward compatibility
# This creates "postgresql-shared-rw" service that points to the same endpoints as "postgres-shared-rw"
# During the disaster recovery, I got the name wrong and dropped 'sql'
apiVersion: v1
kind: Service
metadata:
name: postgresql-shared-rw
namespace: postgresql-system
labels:
app: postgresql-shared
cnpg.io/cluster: postgres-shared
cnpg.io/reload: ""
spec:
type: ClusterIP
ports:
- name: postgres
port: 5432
protocol: TCP
targetPort: 5432
selector:
cnpg.io/cluster: postgres-shared
cnpg.io/instanceRole: primary
---
# Read-only service alias
apiVersion: v1
kind: Service
metadata:
name: postgresql-shared-ro
namespace: postgresql-system
labels:
app: postgresql-shared
cnpg.io/cluster: postgres-shared
cnpg.io/reload: ""
spec:
type: ClusterIP
ports:
- name: postgres
port: 5432
protocol: TCP
targetPort: 5432
selector:
cnpg.io/cluster: postgres-shared
cnpg.io/instanceRole: replica
---
# Read load-balanced service alias
apiVersion: v1
kind: Service
metadata:
name: postgresql-shared-r
namespace: postgresql-system
labels:
app: postgresql-shared
cnpg.io/cluster: postgres-shared
cnpg.io/reload: ""
spec:
type: ClusterIP
ports:
- name: postgres
port: 5432
protocol: TCP
targetPort: 5432
selector:
cnpg.io/cluster: postgres-shared