{{/* Headless service: stable per-pod DNS for the StatefulSet (-db-0.-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 }}