Moving dev back to LF Gerrit
[it/dep.git] / ric-aux / 80-Auxiliary-Functions / helm / mc-stack / charts / elasticsearch / templates / ingress.yaml
@@ -1,6 +1,5 @@
 ################################################################################
 #   Copyright (c) 2019 AT&T Intellectual Property.                             #
-#   Copyright (c) 2019 Nokia.                                                  #
 #                                                                              #
 #   Licensed under the Apache License, Version 2.0 (the "License");            #
 #   you may not use this file except in compliance with the License.           #
 #   limitations under the License.                                             #
 ################################################################################
 
-apiVersion: v1
-kind: Service
+{{- if .Values.ingress.enabled -}}
+{{- $fullName := include "uname" . -}}
+{{- $servicePort := .Values.httpPort -}}
+{{- $ingressPath := .Values.ingress.path -}}
+apiVersion: extensions/v1beta1
+kind: Ingress
 metadata:
-  name: {{ include "common.servicename.dbaas.tcp" . }}
-  namespace: {{ include "common.namespace.platform" . }}
+  name: {{ $fullName }}
   labels:
-    app: {{ include "common.namespace.platform" . }}-{{ include "common.name.dbaas" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+    app: {{ .Chart.Name }}
     release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }} 
+    heritage: {{ .Release.Service }}
+{{- with .Values.ingress.annotations }}
+  annotations:
+{{ toYaml . | indent 4 }}
+{{- end }}
 spec:
-  selector:
-    app: {{ include "common.namespace.platform" . }}-{{ include "common.name.dbaas" . }}
-    release: {{ .Release.Name }}
-  ports:
-  - port: {{ include "common.serviceport.dbaas.tcp" . }}
-    targetPort: "sql"
-    protocol: "TCP"
-    name: "sql"
+{{- if .Values.ingress.tls }}
+  tls:
+  {{- range .Values.ingress.tls }}
+    - hosts:
+      {{- range .hosts }}
+        - {{ . }}
+      {{- end }}
+      secretName: {{ .secretName }}
+  {{- end }}
+{{- end }}
+  rules:
+  {{- range .Values.ingress.hosts }}
+    - host: {{ . }}
+      http:
+        paths:
+          - path: {{ $ingressPath }}
+            backend:
+              serviceName: {{ $fullName }}
+              servicePort: {{ $servicePort }}
+  {{- end }}
+{{- end }}