Files
it_cost_dashboard/helm/templates/db-service.yaml
T
2026-09-11 10:11:09 +08:00

41 lines
1.2 KiB
YAML

{{/*
Headless service: stable per-pod DNS for the StatefulSet
(<fullname>-db-0.<fullname>-db-headless). Required by the StatefulSet spec.
*/}}
apiVersion: v1
kind: Service
metadata:
name: {{ include "it-cost-dashboard.fullname" . }}-db-headless
labels:
{{- include "it-cost-dashboard.componentLabels" (dict "ctx" . "component" "db") | nindent 4 }}
spec:
clusterIP: None
ports:
- name: mysql
port: {{ .Values.db.port }}
targetPort: mysql
protocol: TCP
selector:
{{- include "it-cost-dashboard.componentSelectorLabels" (dict "ctx" . "component" "db") | nindent 4 }}
---
{{/*
Normal ClusterIP service. This is what DATABASE_URL and the wait-for-db
initContainer target — simpler than per-pod DNS and sufficient for a
single-primary MySQL.
*/}}
apiVersion: v1
kind: Service
metadata:
name: {{ include "it-cost-dashboard.dbServiceName" . }}
labels:
{{- include "it-cost-dashboard.componentLabels" (dict "ctx" . "component" "db") | nindent 4 }}
spec:
type: ClusterIP
ports:
- name: mysql
port: {{ .Values.db.port }}
targetPort: mysql
protocol: TCP
selector:
{{- include "it-cost-dashboard.componentSelectorLabels" (dict "ctx" . "component" "db") | nindent 4 }}