<p>On my cluster I use <code>traefik</code> as an ingress-controller, but now also want to provide an <code>nginx</code> controller.</p>

<p>I don't want my developers to think about how exactly their application is exposed. Therefore I would like to make traefik the "default" controller and only use nginx if the developer explicitly requests that controller by setting the proper <code>ingress.class</code>.</p>

<p>Unfortunately it looks like setting <em>no</em> class will result in both controllers fighting about that ingress. :(
Is there a way to tell a controller to <em>only</em> handle a ingress object if has the correct <code>ingress.class</code>?</p>

<p>If that is not possible, I was thinking about writing a MutatingAdmissionWebhook which will insert the traefik class in case no class is set. - Does this make sense, or is there a better way?</p>

<p>Handling <code>no class</code> is an arbitrary ingress implementation decision. 
You typically pass the desired class into a binary and it then filters all the config map events with a corresponding class: 
<a href="https://github.com/helm/charts/blob/master/stable/nginx-ingress/templates/controller-deployment.yaml#L60" rel="nofollow noreferrer">https://github.com/helm/charts/blob/master/stable/nginx-ingress/templates/controller-deployment.yaml#L60</a></p>

<p>As far as I know, no one does <code>no class</code>, nor do I recommend as it would be error-prone. Someone will forget to add class and will implicitly get exposed where they did not want. </p>

<p>Mutating hook is a way to go, as it will add an explicit note of what ingress this belongs to. Try <a href="https://github.com/HotelsDotCom/kube-graffiti" rel="nofollow noreferrer">https://github.com/HotelsDotCom/kube-graffiti</a> </p>

<p>The simplest way will be just to register traefik to listen on <code>ingress.class: default</code> or <code>dev</code> and ask developers to put this in all their templates. In this way, you will abstract them from a particular ingress choice underneath.</p>
