metrics-svc.yaml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. {{- if .Values.metrics.enabled }}
  2. apiVersion: v1
  3. kind: Service
  4. metadata:
  5. name: {{ printf "%s-metrics" (include "common.names.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.metrics.service.annotations .Values.commonAnnotations }}
  13. annotations:
  14. {{- if .Values.metrics.service.annotations }}
  15. {{- include "common.tplvalues.render" ( dict "value" .Values.metrics.service.annotations "context" $ ) | nindent 4 }}
  16. {{- end }}
  17. {{- if .Values.commonAnnotations }}
  18. {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  19. {{- end }}
  20. {{- end }}
  21. spec:
  22. type: {{ .Values.metrics.service.type }}
  23. {{- if eq .Values.metrics.service.type "LoadBalancer" }}
  24. externalTrafficPolicy: {{ .Values.metrics.service.externalTrafficPolicy }}
  25. {{- end }}
  26. {{- if and (eq .Values.metrics.service.type "LoadBalancer") .Values.metrics.service.loadBalancerIP }}
  27. loadBalancerIP: {{ .Values.metrics.service.loadBalancerIP }}
  28. {{- end }}
  29. {{- if and (eq .Values.metrics.service.type "LoadBalancer") .Values.metrics.service.loadBalancerSourceRanges }}
  30. loadBalancerSourceRanges: {{- toYaml .Values.metrics.service.loadBalancerSourceRanges | nindent 4 }}
  31. {{- end }}
  32. ports:
  33. - name: http-metrics
  34. port: {{ .Values.metrics.service.port }}
  35. protocol: TCP
  36. targetPort: metrics
  37. {{- if .Values.metrics.service.extraPorts }}
  38. {{- include "common.tplvalues.render" (dict "value" .Values.metrics.service.extraPorts "context" $) | nindent 4 }}
  39. {{- end }}
  40. selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
  41. {{- end }}