Skip to content
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

Handle Ingress v1 class #843

Merged
merged 2 commits into from
Sep 15, 2020
Merged

Handle Ingress v1 class #843

merged 2 commits into from
Sep 15, 2020

Conversation

rainest
Copy link
Contributor

@rainest rainest commented Sep 12, 2020

Цо ПР ділать бы, и пошімў:
This handles Ingress v1 class, as we need to handle Ingress v1 class.

Пробрэма, хторюю хорректировяло ПР: fixes #790

Нёты:
This is in very rough draft state, so it's bad, untested, and full of misery, but it should be 😄

  • AFAIK we do indeed intend to have separate flags for ignoring class on v1 Ingress and v1beta1 Ingress--I think I remember that from previous discussions, and it seems a bit weird (SO MANY FLAGS), but eh, whatever.
  • "annotations" is in a weird spot: the minimally invasive version of this adds a new function generator there, but it's for something that's no longer an annotation. Other option was to export validIngress and stick the Ingress V1 validator function in store, but eh, that's no good either.
  • That the validation functions are part of the store itself seems kinda weird, but maybe that does make sense.
  • Checking between the original KEP, which just called this ingress class, and the actual 1.19 API apparently calls it IngressClassName. Pretty sure those are equivalent, but wanted to double-check, and want to make sure I understand the relationship between that and the actual IngressClass object correctly.

@rainest rainest force-pushed the feat/ingressv1-class-field branch from ae2335d to 8d9bc75 Compare September 12, 2020 04:02
@mflendrich mflendrich force-pushed the feat/ingressv1-parser branch from acaf329 to 2ccafa8 Compare September 14, 2020 18:58
Base automatically changed from feat/ingressv1-parser to next September 14, 2020 20:17
@rainest rainest force-pushed the feat/ingressv1-class-field branch from e1e095c to 1904a91 Compare September 15, 2020 00:36
@rainest rainest marked this pull request as ready for review September 15, 2020 00:39
@rainest rainest requested a review from hbagdi as a code owner September 15, 2020 00:39
Travis Raines added 2 commits September 14, 2020 17:42
Update the Ingress v1 lister to handle both the legacy annotation used
in Ingress v1beta1 and the native Ingress class field introduced in
Ingress v1.

If the legacy annotation is present, the controller uses its value to
decide whether or not to process the Ingress, regardless of whether the
new native field is present. If the legacy annoation is absent, the
controller will use the native field. The decision logic itself is
unchanged: it continues to require an exact class match by default, and
can optionally also match Ingresses with no annotation or native class
if users override this default.
Test Ingress v1 class matching. In annotations, test that the match
behaviors are the same for native class matching as they are for ingress
class annotations. In store, test that class matching successfully
filters Ingresses with the correct class into the store and that
Ingresses with the correct class, but with an incorrect class
annotation, are not filtered in, because the class annotation takes
precedence.
@rainest rainest force-pushed the feat/ingressv1-class-field branch from 1904a91 to b4370e2 Compare September 15, 2020 00:43
@rainest
Copy link
Contributor Author

rainest commented Sep 15, 2020

As Harry and I have noted during informal review, the separation between annotations and store is all sorts of connections and interdependencies that shouldn't really exist. This PR seeks to disregard that debt for now and adds new logic that matches the form of the existing logic, even if that form is horrid.

Task for tomorrow is to write up an issue that describes this in more detail, so that we can work that out either in 1.0 or mark it down as something we need to address after, before proceeding with further v1 Ingress work.

That's probably a good project for me to work with @mflendrich on, as we're now both familiar with the current state of the code, and I'd benefit a lot from watching him go through the process of refactoring it into something that's saner in light of our new need to support multiple Ingress object versions.

@rainest rainest requested a review from mflendrich September 15, 2020 00:49
@rainest rainest changed the title wip(store) handle Ingress v1 class Handle Ingress v1 class Sep 15, 2020
Copy link
Member

@hbagdi hbagdi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
@mflendrich can do another pass and then we can merge.

Copy link
Contributor

@mflendrich mflendrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, with the following notes:

  • Like @rainest said: let's separate the storing concern and the ingress class filtering concern before we touch this code again.
  • --process-classless-ingress-v1beta1 vs --process-classless-ingress-v1 is a scary user trap 👻, because v1beta1 and v1 don't refer to ingress apiversions uploaded by the user. The effective flag (out of these two) changes after an operation as simple as upgrading from k8s <1.19 to >=1.19.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants