{{- if .Values.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: {{ include "nebulous.serviceName" . }}
  namespace: {{ include "nebulous.namespace" . }}
  labels:
    {{- include "common.labels" . | nindent 4 }}
  {{- with .Values.ingress.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
spec:
  {{- with .Values.ingress.className }}
  ingressClassName: {{.}}
  {{- end }}
  rules:
    - http:
        paths:
          - backend:
              service:
                name: {{ include "nebulous.serviceName" . }}
                port:
                  number: {{ .Values.service.port }}
            path: /
            pathType: Prefix
      {{- with .Values.ingress.host }}
      host: {{.}}
      {{- end }}
{{- end }}
