{{- if .Values.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: {{ template "app.name" . }}
  namespace: {{ .Release.Namespace }}
  annotations:
{{ toYaml .Values.ingress.annotations | indent 4 }}
  labels:
    {{- include "app.labels" . | nindent 4 }}
spec:
{{- if .Values.ingress.tlsEnabled }}
  tls:
    - hosts:
        - {{ .Values.ingress.frontendDomain }}
      secretName: {{ .Values.ingress.frontendTlsSecretName }}
{{- end }}
  rules:
    {{- if eq .Release.Namespace "ocm" }}
    - host: {{ .Values.ingress.frontendDomain }}
      http:
        paths:
          - path: /issuer(/|$)(.*)
            pathType: Prefix
            backend:
              service:
                name: {{ template "app.name" . }}
                port:
                  number: {{ .Values.service.port }}
    {{- else if eq .Release.Namespace "ocm-test" }}
    - host: {{ .Values.ingress.frontendDomain }}
      http:
        paths:
          - path: /holder(/|$)(.*)
            pathType: Prefix
            backend:
              service:
                name: {{ template "app.name" . }}
                port:
                  number: {{ .Values.service.port1 }}
    {{- end }}
{{- end }}
