apiVersion: v1
kind: Service
metadata:
  name: {{ include "brand-master.fullname" . }}-db
  labels:
    {{- include "brand-master.labels" . | nindent 4 }}
    app.kubernetes.io/component: database
spec:
  type: {{ .Values.postgres.service.type }}
  ports:
    - port: {{ .Values.postgres.service.port }}
      targetPort: {{ .Values.postgres.service.targetPort }}
      protocol: TCP
      name: postgres
  selector:
    {{- include "brand-master.selectorLabels" . | nindent 4 }}
    app.kubernetes.io/component: database
---
apiVersion: v1
kind: Service
metadata:
  name: {{ include "brand-master.fullname" . }}-db-headless
  labels:
    {{- include "brand-master.labels" . | nindent 4 }}
    app.kubernetes.io/component: database
spec:
  type: ClusterIP
  clusterIP: None
  ports:
    - port: {{ .Values.postgres.service.port }}
      targetPort: {{ .Values.postgres.service.targetPort }}
      protocol: TCP
      name: postgres
  selector:
    {{- include "brand-master.selectorLabels" . | nindent 4 }}
    app.kubernetes.io/component: database
