{{- if .Values.ingress.enabled }}
---
apiVersion: {{ include "vault-secrets-webhook.capabilities.ingress.apiVersion" . }}
kind: Ingress
metadata:
  name: {{ template "vault-secrets-webhook.fullname" . }}
  namespace: {{ .Release.Namespace }}
  {{- if .Values.ingress.annotations }}
  annotations:
{{ toYaml .Values.ingress.annotations | indent 4 }}
  {{- end }}  
spec:
  tls:
  - hosts:
      - {{ .Values.ingress.host }}
    secretName: {{ include "vault-secrets-webhook.servingCertificate" . }}
  rules:
  - host: {{ .Values.ingress.host }}
    http:
      paths:
      - path: /
        pathType: ImplementationSpecific
        backend:
          service:
            name: {{ template "vault-secrets-webhook.fullname" . }}
            port:
              number: {{ .Values.service.externalPort }}
{{- end }}
