metrics-svc.yaml 1.4 KB

12345678910111213141516171819202122232425262728293031
  1. {{- /*
  2. Copyright VMware, Inc.
  3. SPDX-License-Identifier: APACHE-2.0
  4. */}}
  5. {{- if .Values.metrics.enabled }}
  6. apiVersion: v1
  7. kind: Service
  8. metadata:
  9. name: {{ printf "%s-metrics" (include "postgresql.v1.primary.fullname" .) }}
  10. namespace: {{ .Release.Namespace | quote }}
  11. labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
  12. app.kubernetes.io/component: metrics
  13. {{- if or .Values.commonAnnotations .Values.metrics.service.annotations }}
  14. {{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.metrics.service.annotations .Values.commonAnnotations ) "context" . ) }}
  15. annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
  16. {{- end }}
  17. spec:
  18. type: ClusterIP
  19. sessionAffinity: {{ .Values.metrics.service.sessionAffinity }}
  20. {{- if .Values.metrics.service.clusterIP }}
  21. clusterIP: {{ .Values.metrics.service.clusterIP }}
  22. {{- end }}
  23. ports:
  24. - name: http-metrics
  25. port: {{ .Values.metrics.service.ports.metrics }}
  26. targetPort: http-metrics
  27. {{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.primary.podLabels .Values.commonLabels ) "context" . ) }}
  28. selector: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }}
  29. app.kubernetes.io/component: primary
  30. {{- end }}