| Giorgi Lekveishvili | 8c99d62 | 2023-05-30 14:40:50 +0400 | [diff] [blame] | 1 | {{- if .Values.metrics.enabled }} |
| 2 | apiVersion: v1 |
| 3 | kind: Service |
| 4 | metadata: |
| 5 | name: {{ printf "%s-metrics" (include "postgresql.primary.fullname" .) }} |
| 6 | namespace: {{ .Release.Namespace | quote }} |
| 7 | labels: {{- include "common.labels.standard" . | nindent 4 }} |
| 8 | app.kubernetes.io/component: metrics |
| 9 | {{- if .Values.commonLabels }} |
| 10 | {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} |
| 11 | {{- end }} |
| 12 | {{- if or .Values.commonAnnotations .Values.metrics.service.annotations }} |
| 13 | annotations: |
| 14 | {{- if .Values.commonAnnotations }} |
| 15 | {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} |
| 16 | {{- end }} |
| 17 | {{- if .Values.metrics.service.annotations }} |
| 18 | {{- include "common.tplvalues.render" ( dict "value" .Values.metrics.service.annotations "context" $ ) | nindent 4 }} |
| 19 | {{- end }} |
| 20 | {{- end }} |
| 21 | spec: |
| 22 | type: ClusterIP |
| 23 | sessionAffinity: {{ .Values.metrics.service.sessionAffinity }} |
| 24 | {{- if .Values.metrics.service.clusterIP }} |
| 25 | clusterIP: {{ .Values.metrics.service.clusterIP }} |
| 26 | {{- end }} |
| 27 | ports: |
| 28 | - name: http-metrics |
| 29 | port: {{ .Values.metrics.service.ports.metrics }} |
| 30 | targetPort: http-metrics |
| 31 | selector: {{- include "common.labels.matchLabels" . | nindent 4 }} |
| 32 | app.kubernetes.io/component: primary |
| 33 | {{- end }} |