28 lines
1.2 KiB
YAML
28 lines
1.2 KiB
YAML
{{- if .Values.metrics.enabled }}
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: {{ printf "%s-metrics" (include "common.names.fullname" .) }}
|
|
namespace: {{ .Release.Namespace }}
|
|
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
|
app.kubernetes.io/component: metrics
|
|
{{- if .Values.metrics.service.annotations }}
|
|
annotations: {{ include "common.tplvalues.render" ( dict "value" .Values.metrics.service.annotations "context" $) | nindent 4 }}
|
|
{{- end }}
|
|
spec:
|
|
type: {{ .Values.metrics.service.type }}
|
|
{{- if and (eq .Values.metrics.service.type "LoadBalancer") (not (empty .Values.metrics.service.loadBalancerIP)) }}
|
|
loadBalancerIP: {{ .Values.metrics.service.loadBalancerIP }}
|
|
{{- end }}
|
|
ports:
|
|
- name: metrics
|
|
port: {{ .Values.metrics.service.port }}
|
|
targetPort: metrics
|
|
{{- if (and (or (eq .Values.metrics.service.type "NodePort") (eq .Values.metrics.service.type "LoadBalancer")) (not (empty .Values.metrics.service.nodePort))) }}
|
|
nodePort: {{ .Values.metrics.service.nodePort }}
|
|
{{- else if eq .Values.metrics.service.type "ClusterIP" }}
|
|
nodePort: null
|
|
{{- end }}
|
|
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
|
|
{{- end }}
|