{{- if .Values.controller.ingressClassResource.enabled -}}
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
  labels:
    {{- include "ingress-nginx.labels" . | nindent 4 }}
    app.kubernetes.io/component: controller
    {{- with .Values.controller.labels }}
    {{- toYaml . | nindent 4 }}
    {{- end }}
  name: {{ .Values.controller.ingressClassResource.name }}
  {{- if or .Values.controller.ingressClassResource.default .Values.controller.ingressClassResource.annotations }}
  annotations:
    {{- if .Values.controller.ingressClassResource.default }}
    ingressclass.kubernetes.io/is-default-class: "true"
    {{- end }}
    {{- if .Values.controller.ingressClassResource.annotations }}
    {{- toYaml .Values.controller.ingressClassResource.annotations | nindent 4 }}
    {{- end }}
  {{- end }}
spec:
  controller: {{ .Values.controller.ingressClassResource.controllerValue }}
  {{- with .Values.controller.ingressClassResource.parameters }}
  parameters: {{ toYaml . | nindent 4 }}
  {{- end }}
{{- end }}
