{{- /* VMSelect Split Services - only created when splitService is enabled */}} {{- $ctx := dict "helm" . }} {{- $app := .Values.vmselect }} {{- if and (kindIs "map" $app) $app.enabled ($app.service).enabled (default false $app.splitService) }} {{- $service := $app.service }} {{- $_ := set $ctx "extraLabels" $service.labels }} {{- $_ := set $ctx "appKey" "vmselect" }} {{- $fullname := include "vm.plain.fullname" $ctx }} --- # VMSelect HTTP-only Service apiVersion: v1 kind: Service metadata: {{- with $service.annotations }} annotations: {{ toYaml . | nindent 4 }} {{- end }} labels: {{ include "vm.labels" $ctx | nindent 4 }} {{- $_ := unset $ctx "extraLabels" }} name: {{ $fullname }}-http namespace: {{ include "vm.namespace" $ }} spec: {{- $type := $service.type }} {{- if and (not $type) (eq $app.mode "statefulSet") }} {{- $type = "ClusterIP" }} {{- end }} type: {{ $type }} {{- if eq $type "ClusterIP" }} {{- with $service.clusterIP }} clusterIP: {{ . }} {{- end }} {{- end }} {{- with $service.externalIPs }} externalIPs: {{ toYaml . | nindent 4 }} {{- end }} {{- with $service.loadBalancerIP }} loadBalancerIP: {{ . }} {{- end }} {{- with $service.loadBalancerSourceRanges }} loadBalancerSourceRanges: {{ toYaml . | nindent 4 }} {{- end }} {{- with $service.healthCheckNodePort }} healthCheckNodePort: {{ . }} {{- end }} {{- with $service.externalTrafficPolicy }} externalTrafficPolicy: {{ . }} {{- end }} {{- with $service.ipFamilyPolicy }} ipFamilyPolicy: {{ . }} {{- end }} {{- with $service.ipFamilies }} ipFamilies: {{ toYaml . | nindent 4 }} {{- end }} {{- with $service.trafficDistribution }} trafficDistribution: {{ . }} {{- end }} ports: - name: http port: {{ $service.servicePort }} protocol: TCP targetPort: {{ $service.targetPort }} selector: {{ include "vm.selectorLabels" $ctx | nindent 4 }} {{- end }} --- {{- /* VMSelect Clusternative-only Service - only created when splitService is enabled AND clusternativeListenAddr is set */}} {{- if and (kindIs "map" $app) $app.enabled ($app.service).enabled (default false $app.splitService) $app.extraArgs.clusternativeListenAddr }} {{- $service := $app.service }} {{- $_ := set $ctx "extraLabels" $service.labels }} {{- $_ := set $ctx "appKey" "vmselect" }} {{- $fullname := include "vm.plain.fullname" $ctx }} apiVersion: v1 kind: Service metadata: {{- with $service.annotations }} annotations: {{ toYaml . | nindent 4 }} {{- end }} labels: {{ include "vm.labels" $ctx | nindent 4 }} {{- $_ := unset $ctx "extraLabels" }} name: {{ $fullname }}-cluster-tcp namespace: {{ include "vm.namespace" $ }} spec: {{- $type := $service.type }} {{- if and (not $type) (eq $app.mode "statefulSet") }} {{- $type = "ClusterIP" }} {{- end }} type: {{ $type }} {{- if eq $type "ClusterIP" }} {{- with $service.clusterIP }} clusterIP: {{ . }} {{- end }} {{- end }} {{- with $service.externalIPs }} externalIPs: {{ toYaml . | nindent 4 }} {{- end }} {{- with $service.loadBalancerIP }} loadBalancerIP: {{ . }} {{- end }} {{- with $service.loadBalancerSourceRanges }} loadBalancerSourceRanges: {{ toYaml . | nindent 4 }} {{- end }} {{- with $service.healthCheckNodePort }} healthCheckNodePort: {{ . }} {{- end }} {{- with $service.externalTrafficPolicy }} externalTrafficPolicy: {{ . }} {{- end }} {{- with $service.ipFamilyPolicy }} ipFamilyPolicy: {{ . }} {{- end }} {{- with $service.ipFamilies }} ipFamilies: {{ toYaml . | nindent 4 }} {{- end }} {{- with $service.trafficDistribution }} trafficDistribution: {{ . }} {{- end }} ports: - name: cluster-tcp protocol: TCP port: {{ include "vm.port.from.flag" (dict "flag" $app.extraArgs.clusternativeListenAddr) }} targetPort: cluster-tcp selector: {{ include "vm.selectorLabels" $ctx | nindent 4 }} {{- end }}