rancher-partner-charts/charts/hashicorp/consul/templates/ingress-gateways-service.yaml

52 lines
1.8 KiB
YAML

{{- if .Values.ingressGateways.enabled }}
{{- $root := . }}
{{- $defaults := .Values.ingressGateways.defaults }}
{{- range .Values.ingressGateways.gateways }}
{{- $service := .service }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "consul.fullname" $root }}-{{ .name }}
namespace: {{ $root.Release.Namespace }}
labels:
app: {{ template "consul.name" $root }}
chart: {{ template "consul.chart" $root }}
heritage: {{ $root.Release.Service }}
release: {{ $root.Release.Name }}
component: ingress-gateway
ingress-gateway-name: {{ template "consul.fullname" $root }}-{{ .name }}
{{- if (or $defaults.service.annotations $service.annotations) }}
# We allow both default annotations and gateway-specific annotations
annotations:
{{- if $defaults.service.annotations }}
{{ tpl $defaults.service.annotations $root | nindent 4 | trim }}
{{- end }}
{{- if $service.annotations }}
{{ tpl $service.annotations $root | nindent 4 | trim }}
{{- end }}
{{- end }}
spec:
selector:
app: {{ template "consul.name" $root }}
release: "{{ $root.Release.Name }}"
component: ingress-gateway
ingress-gateway-name: {{ template "consul.fullname" $root }}-{{ .name }}
ports:
{{- range $index, $ports := (default $defaults.service.ports $service.ports) }}
- name: gateway-{{ $index }}
port: {{ $ports.port }}
{{- if (and (eq (default $defaults.service.type $service.type) "NodePort") $ports.nodePort) }}
nodePort: {{ $ports.nodePort }}
{{- end}}
{{- end }}
type: {{ default $defaults.service.type $service.type }}
{{- if (default $defaults.service.additionalSpec $service.additionalSpec) }}
{{ tpl (default $defaults.service.additionalSpec $service.additionalSpec) $root | nindent 2 | trim }}
{{- end }}
---
{{- end }}
{{- end }}