service.yaml 1.02 KB
Newer Older
GGGitBoy's avatar
GGGitBoy committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
apiVersion: v1
kind: Service
metadata:
  labels:
    app: {{ template "app.name" . }}
    chart: {{ template "app.version" . }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
    {{- range .Values.serviceSelectorLabels }}
    {{- $pair := regexSplit "=" . 2 }}
    {{- if eq 2 (len $pair) }}
    {{ (index $pair 0) }}: {{ (index $pair 1) }}
    {{- else }}
    {{ (index $pair 0) }}: ""
    {{- end }}
    {{- end }}
  name: expose-coredns-metrics
  namespace: {{ .Release.Namespace }}
spec:
  type: ClusterIP
  clusterIP: None
  ports:
  - name: {{ .Values.ports.metrics.name }}
    port: {{ .Values.ports.metrics.port }}
    protocol: {{ .Values.ports.metrics.protocol }}
    targetPort: {{ .Values.ports.metrics.port }}
{{- if not .Values.endpoints }}
  selector:
    {{- range .Values.serviceSelectorLabels }}
    {{- $pair := regexSplit "=" . 2 }}
    {{- if eq 2 (len $pair) }}
    {{ (index $pair 0) }}: {{ (index $pair 1) }}
    {{- else }}
    {{ (index $pair 0) }}: ""
    {{- end }}
    {{- end }}
{{- end }}