tidaldb/k8s/cluster/service-peers.yaml

42 lines
1.6 KiB
YAML

# Headless PEER-discovery Service (m11p5 §4).
#
# Gives every StatefulSet pod a stable per-pod DNS name
# tidaldb-N.tidaldb-peers.tidaldb-cluster.svc.cluster.local
# which is exactly what the topology ConfigMap advertises as each region's
# grpc_addr/http_addr. Peers dial these names; tonic re-resolves DNS on every
# reconnect so a pod rescheduled onto a new IP becomes reachable with no peer
# restart (the whole point of the m11p5 bind/advertise split).
#
# publishNotReadyAddresses: true is LOAD-BEARING. The m11p5 readiness predicate
# 503s a joiner/quarantined/reseeding pod (so the CLIENT Service drops it from
# load-balancing — see service-client.yaml). But peer discovery, snapshot fetch,
# and the catch-up stream must still RESOLVE a not-ready joiner's DNS, or the
# joiner can never reach a seed to converge and become ready — a deadlock. This
# Service keeps NOT-ready pods in its DNS A-records for exactly that reason.
#
# This Service is also `serviceName` for the StatefulSet (stable network ids).
apiVersion: v1
kind: Service
metadata:
name: tidaldb-peers
namespace: tidaldb-cluster
labels:
app.kubernetes.io/name: tidaldb
app.kubernetes.io/part-of: tidaldb
spec:
clusterIP: None # headless: per-pod DNS, no VIP
publishNotReadyAddresses: true # keep not-ready joiners resolvable for peers
selector:
app.kubernetes.io/name: tidaldb
app.kubernetes.io/component: cluster-node
ports:
- name: http
port: 9500
targetPort: http
- name: grpc
port: 9601
targetPort: grpc
- name: metrics
port: 9091
targetPort: metrics