kubernetes: Ingress.ingressClassName field is not readded if removed

What happened:

The default IngressClass was not applied to an Ingress when the ingressClassName field was deleted.

What you expected to happen:

The default IngressClass should be added to all new or updated Ingress’ if they do not posses one.

How to reproduce it (as minimally and precisely as possible):

  1. Create IngressClass, and add annotation to set as default IngressClass
  2. Create Ingress without ingressClassName
  3. Edit Ingress (using kubectl edit) and remove the ingressClassName field.
  4. Get Ingress and note it’s now missing an ingressClassName

Anything else we need to know?:

This was initially spotted due to using Lens to edit an Ingress which caused the ingressClassName to be added to the last-applied annotation, which a subsequent apply by the CI/CD system (the source file doesn’t contain an ingressClassName) cause to get deleted.

As this is in AWS EKS we use the ALB Load Balancer component to manage an ALB based on the ingresses. The missing ingressClassName causes the ingress to be ignored by that component, and routing removed from the ALB.

Honestly I’m not sure enforcing ingressClassName rigorously is the best idea, but what does having an Ingress with no ingressClassName mean when there’s a default IngressClass (esp. as the default is implemented by inserting that field in).

Environment:

  • Kubernetes version (use kubectl version): v1.19.6-eks-49a6c0
  • Cloud provider or hardware configuration: AWS EKS

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 32 (24 by maintainers)

Most upvoted comments

PIng @robscott seems like we should accept triage on this? It also seems like a relatively simple change. If someone writes it up well, there are lots of people who jump on “easy to approach” issues.