-
Notifications
You must be signed in to change notification settings - Fork 594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(controllers) handle default IngressClass #2313
Conversation
7b1e1a3
to
a943922
Compare
a943922
to
ec83f1f
Compare
53496fd
to
9dd65e5
Compare
9dd65e5
to
4e10331
Compare
4e10331
to
e4aef17
Compare
Lint and unit currently broken due to a function name change; test updates are pending me figuring out a good way to organize the additional cases. The below should still be reviewable as-is. 409e959 reworks the utility class matcher(s) to try and address the comments related to it and consolidate some code. We originally had predicate generators allow toggling whether the resource allows the netv1 Ingress spec field and/or the annotation to manage it, though I don't think that was strictly necessary--the try everything approach should work fine. The spec field is present only on a single type that we have to cast to when checking anyway, and everything accepts the annotation. We mention that the annotation is deprecated (and I think this may be why we had those options) but it's kinda weird to deprecate an annotation since you can't remove specific annotations from a spec, and thus implementation is entirely on the client side. There's probably no great reason to actually remove support unless we want to make a clean cut away from the old annotation, since you can always simply not use it (assuming we eventually add dedicated fields to our CRDs in the future). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, once the commits that resolve #2313 (comment) are in I'll do a final pass.
When 'ingressclass.kubernetes.io/is-default-class: "true"' is present on the ingress controller's configured IngressClass, ingest Ingresses that have no IngressClass set. Split the v1 Ingress controller out of the generated controllers, to handle re-queueing reconciles if an IngressClass is changed to be the default IngressClass.
409e959
to
168f8ed
Compare
168f8ed
to
6b5931c
Compare
6b5931c
to
bfc8159
Compare
No luck trying generics so whatever, the number of types we need to check isn't that huge (the Ingress annotation check covers almost everything since it's the same annotation throughout; netv1 spec and Knative are the exceptions), so I went ahead and just duplicated the loops for each. Also rolled the separate commit showing the changes to MatchesIngressClass and friends into the previous one, since it's been reviewed and was only separate to highlight the change. |
Use default IngressClass behavior for any resource that supports ingress class. This re-integrates the Ingress V1 controller into the generated controllers, as all controllers that support class now include the additional IngressClass watch. Condense the store class annotation validation functions into a single function for either Ingress or Knative annotations. Add a logger to the fake store for tests. Co-authored-by: Shane Utt <shaneutt@linux.com> Co-authored-by: Michał Flendrich <michal@flendrich.pro>
bfc8159
to
a0fbe5e
Compare
What this PR does / why we need it:
When 'ingressclass.kubernetes.io/is-default-class: "true"' is present on the ingress controller's configured IngressClass, ingest class-aware resources that have no IngressClass set.
Add a new watch to reconcilers, which requeues objects if the default IngressClass changes. This ensures that existing classless objects are ingested if our class becomes the default class during operation.
Rework utility functions related to class matching to make default class handling work.
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): part of #2177Special notes for your reviewer:
This originally only applied to Ingress objects, as their link to IngressClasses is the only link actually in the spec. In retrospect during development it seemed odd that you'd have a default class that ingested classless Ingresses while you still needed to apply the class to everything else.
We did have heterogenous classless handling (i.e. classless Ingresses supported, but not classless KongClusterPlugins) with the expectation that the de facto classless handling behavior would go away entirely with Ingress v1 and the dedicated
ingressClassName
field. As that didn't happen, and default/classless handling is now a de jure part of the spec, I've applied it across the board.FWIW #853 has been exacerbated by the addition of the controller-level filters, as the duplication of effort here demonstrates.
PR Readiness Checklist:
Complete these before marking the PR as
ready to review
:CHANGELOG.md
release notes have been updated to reflect any significant (and particularly user-facing) changes introduced by this PR