aboutsummaryrefslogtreecommitdiffstats
path: root/kud/tests/vnfs/comp-app/collection/app2/helm/prometheus-operator/templates/prometheus/serviceperreplica.yaml
blob: 791057b725a6144cf91d87a4f56cd952bb76b66e (plain)
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
38
39
40
41
42
43
44
45
46
{{- if and .Values.prometheus.enabled .Values.prometheus.servicePerReplica.enabled }}
{{- $count := .Values.prometheus.prometheusSpec.replicas | int -}}
{{- $serviceValues := .Values.prometheus.servicePerReplica -}} 
apiVersion: v1
kind: List
metadata:
  name: {{ include "prometheus-operator.fullname" $ }}-prometheus-serviceperreplica
  namespace: {{ template "prometheus-operator.namespace" . }}
items:
{{- range $i, $e := until $count }}
  - apiVersion: v1
    kind: Service
    metadata:
      name: {{ include "prometheus-operator.fullname" $ }}-prometheus-{{ $i }}
      namespace: {{ template "prometheus-operator.namespace" . }}
      labels:
        app: {{ include "prometheus-operator.name" $ }}-prometheus
{{ include "prometheus-operator.labels" $ | indent 8 }}
      {{- if $serviceValues.annotations }}
      annotations:
{{ toYaml $serviceValues.annotations | indent 8 }}
      {{- end }}
    spec:
      {{- if $serviceValues.clusterIP }}
      clusterIP: {{ $serviceValues.clusterIP }}
      {{- end }}
      {{- if $serviceValues.loadBalancerSourceRanges }}
      loadBalancerSourceRanges:
      {{- range $cidr := $serviceValues.loadBalancerSourceRanges }}
        - {{ $cidr }}
      {{- end }}
      {{- end }}
      ports:
        - name: {{ $.Values.prometheus.prometheusSpec.portName }}
          {{- if eq $serviceValues.type "NodePort" }}
          nodePort: {{ $serviceValues.nodePort }}
          {{- end }}
          port: {{ $serviceValues.port }}
          targetPort: {{ $serviceValues.targetPort }}
      selector:
        app: prometheus
        prometheus: {{ include "prometheus-operator.fullname" $ }}-prometheus
        statefulset.kubernetes.io/pod-name: prometheus-{{ include "prometheus-operator.fullname" $ }}-prometheus-{{ $i }}
      type: "{{ $serviceValues.type }}"
{{- end }}
{{- end }}