{{- if .Values.ingress.enabled }}
apiVersion: {{ template "ejbca.ingress.apiVersion" . }}
kind: Ingress
metadata:
  name: {{ template "ejbca.fullname" . }}
  labels: {{- include "common.labels.standard" . | nindent 4 }}
    {{- if .Values.commonLabels }}
    {{- include "ejbca.tplValue" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
    {{- end }}
  annotations:
    nginx.ingress.kubernetes.io/ssl-passthrough: "true"
    {{- if .Values.ingress.annotations }}
    {{- include "ejbca.tplValue" (dict "value" .Values.ingress.annotations "context" $) | nindent 4 }}
    {{- end }}
    {{- if .Values.commonAnnotations }}
    {{- include "ejbca.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
    {{- end }}
spec:
  rules:
    {{- if .Values.ingress.hostname }}
    - host: {{ .Values.ingress.hostname }}
      http:
        paths:
          - backend:
              serviceName: {{ template "ejbca.fullname" . }}
              servicePort: https
    {{- end }}
{{- end }}
