{{- if .Values.ingress.enabled }}
apiVersion: {{ required "A valid .Values.networkPolicyApiVersion entry required!" .Values.networkPolicyApiVersion }}
kind: Ingress
metadata:
  name: {{ template "owncloud.fullname" . }}
  labels:
    app: {{ template "owncloud.fullname" . }}
    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"
{{- if .Values.ingress.annotations }}
  annotations:
{{ toYaml .Values.ingress.annotations | indent 4 }}
{{- end }}
spec:
  rules:
  - host: {{ .Values.owncloudHost }}
    http:
      paths:
      - path: /
        backend:
          serviceName: {{ template "owncloud.fullname" . }}
          servicePort: {{ .Values.ingress.servicePort }}
{{- if .Values.ingress.tls }}
  tls:
{{ toYaml .Values.ingress.tls | indent 4 }}
{{- end -}}
{{- end }}
