{{- if .Values.ingress.enabled }}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: {{ template "schema-registry.fullname" . }}
  labels:
    app: {{ template "schema-registry.fullname" . }}
    chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
{{- if .Values.ingress.labels }}
{{ toYaml .Values.ingress.labels | indent 4 }}
{{- end }}
{{- if .Values.ingress.annotations }}
  annotations:
{{ toYaml .Values.ingress.annotations | indent 4 }}
{{- end }}
spec:
  rules:
    - host: {{ .Values.ingress.hostname }}
      http:
        paths:
          - path: /
            backend:
              serviceName: {{ template "schema-registry.fullname" . }}
              servicePort: {{ .Values.servicePort }}
{{- if .Values.ingress.tls.enabled }}
  tls:
    - secretName: {{ .Values.ingress.tls.secretName }}
      hosts:
        - {{ .Values.ingress.hostname }}
{{- end -}}
{{ end -}}
