Merge R3 into master
[it/dep.git] / ric-aux / helm / infrastructure / subcharts / kong / templates / ingress-proxy.yaml
diff --git a/ric-aux/helm/infrastructure/subcharts/kong/templates/ingress-proxy.yaml b/ric-aux/helm/infrastructure/subcharts/kong/templates/ingress-proxy.yaml
new file mode 100755 (executable)
index 0000000..9976df9
--- /dev/null
@@ -0,0 +1,40 @@
+{{- if .Values.proxy.ingress.enabled -}}
+{{- $serviceName := include "kong.fullname" . -}}
+{{- $servicePort := include "kong.ingress.servicePort" .Values.proxy -}}
+{{- $path := .Values.proxy.ingress.path -}}
+{{- $hosts_count := len .Values.proxy.ingress.hosts -}}
+apiVersion: extensions/v1beta1
+kind: Ingress
+metadata:
+  name: {{ template "kong.fullname" . }}-proxy
+  labels:
+    {{- include "kong.metaLabels" . | nindent 4 }}
+  annotations:
+    {{- range $key, $value := .Values.proxy.ingress.annotations }}
+      {{ $key }}: {{ $value | quote }}
+    {{- end }}
+spec:
+  rules:
+    {{- if eq $hosts_count 0 }}
+    - http:
+        paths:
+          - path: {{ $path }}
+            backend:
+              serviceName: {{ $serviceName }}-proxy
+              servicePort: {{ $servicePort }}
+    {{ else -}}
+    {{- range $host := .Values.proxy.ingress.hosts }}
+    - host: {{ $host | quote }}
+      http:
+        paths:
+          - path: {{ $path }}
+            backend:
+              serviceName: {{ $serviceName }}-proxy
+              servicePort: {{ $servicePort }}
+    {{- end -}}
+    {{- end -}}
+  {{- if .Values.proxy.ingress.tls }}
+  tls:
+{{ toYaml .Values.proxy.ingress.tls | indent 4 }}
+  {{- end -}}
+{{- end -}}