This repository has been archived by the owner on Aug 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 385
/
Copy pathingress-gateways-service.yaml
51 lines (48 loc) · 1.8 KB
/
ingress-gateways-service.yaml
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
47
48
49
50
51
{{- 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 }}