{{- if .Values.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: {{ include "openwork-ee.fullname" . }}
  labels:
    {{- include "openwork-ee.labels" . | nindent 4 }}
  {{- with .Values.ingress.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
spec:
  {{- if .Values.ingress.className }}
  ingressClassName: {{ .Values.ingress.className }}
  {{- end }}
  {{- with .Values.ingress.tls }}
  tls:
    {{- toYaml . | nindent 4 }}
  {{- end }}
  rules:
    - host: {{ .Values.ingress.web.host | quote }}
      http:
        paths:
          - path: {{ .Values.ingress.web.path }}
            pathType: {{ .Values.ingress.web.pathType }}
            backend:
              service:
                name: {{ include "openwork-ee.denWebServiceName" . }}
                port:
                  name: http
    {{- if .Values.ingress.api.enabled }}
    - host: {{ .Values.ingress.api.host | quote }}
      http:
        paths:
          - path: {{ .Values.ingress.api.path }}
            pathType: {{ .Values.ingress.api.pathType }}
            backend:
              service:
                name: {{ include "openwork-ee.denApiServiceName" . }}
                port:
                  name: http
    {{- end }}
{{- end }}
