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

Duplicate resources when using implementation-specific annotations #109

Closed
pottekkat opened this issue Dec 15, 2023 · 11 comments · Fixed by #112 or #116
Closed

Duplicate resources when using implementation-specific annotations #109

pottekkat opened this issue Dec 15, 2023 · 11 comments · Fixed by #112 or #116
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@pottekkat
Copy link
Contributor

What happened:

When converting Ingress resources with implementation-specific annotations, the output contains duplicated Gateway and HTTPRoute resources.

See #104 (comment) for details.

Also see: #104 (comment) and #104 (comment)

What you expected to happen:

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

See #104 (comment) for reproducing.

Anything else we need to know?:

No.

@pottekkat pottekkat added the kind/bug Categorizes issue or PR as related to a bug. label Dec 15, 2023
@mlavacca
Copy link
Member

/good-first-issue

@k8s-ci-robot
Copy link
Contributor

@mlavacca:
This request has been marked as suitable for new contributors.

Guidelines

Please ensure that the issue body includes answers to the following questions:

  • Why are we solving this issue?
  • To address this issue, are there any code changes? If there are code changes, what needs to be done in the code and what places can the assignee treat as reference points?
  • Does this issue have zero to low barrier of entry?
  • How can the assignee reach out to you for help?

For more details on the requirements of such an issue, please see here and ensure that they are met.

If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-good-first-issue command.

In response to this:

/good-first-issue

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. label Dec 15, 2023
@pottekkat
Copy link
Contributor Author

From a quick look, the issue seems to be because each provider calls the common ToGateway function. If that is the case, instead of changing the provider logic, we can just disable all providers by default and then user can enable any one provider, which would usually be the case.

@k8s-ci-robot k8s-ci-robot added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Dec 15, 2023
@mlavacca
Copy link
Member

From a quick look, the issue seems to be because each provider calls the common ToGateway function. If that is the case, instead of changing the provider logic, we can just disable all providers by default and then user can enable any one provider, which would usually be the case.

Similarly to what @levikobi suggested in their comment, I suggest adding the IngressClass name to the common converter function signature and letting the common machinery filter out resources for not matching ingress classes. @levikobi does it make sense to you?

@levikobi
Copy link
Member

From a quick look, the issue seems to be because each provider calls the common ToGateway function. If that is the case, instead of changing the provider logic, we can just disable all providers by default and then user can enable any one provider, which would usually be the case.

Similarly to what @levikobi suggested in their comment, I suggest adding the IngressClass name to the common converter function signature and letting the common machinery filter out resources for not matching ingress classes. @levikobi does it make sense to you?

Absolutely @mlavacca, that's exactly what I meant 👍

@pottekkat
Copy link
Contributor Author

In the provider code, we get all the gateway resources from the common ToGateway and the parse it and add implementation specific configuration to those resources which have custom annotations and return everything back. If the provider only gets a filtered gateway resources, then we will only return resources which has converted annotations? The rest will be filtered out because they aren't implementation specific?

Maybe I am missing something.

@levikobi
Copy link
Member

@pottekkat pretty much yes, but after reading your comment I'm realizing it isn't as intuitive as it should be.

Maybe we should add a new function to the common package, which will filter ingresses based on class name. Every provider will call it before calling ToGateway.
It will be more understandable and also keeps ToGateway function with one responsibility.

Thoughts @mlavacca @pottekkat?

@mlavacca
Copy link
Member

@pottekkat pretty much yes, but after reading your comment I'm realizing it isn't as intuitive as it should be.

Maybe we should add a new function to the common package, which will filter ingresses based on class name. Every provider will call it before calling ToGateway. It will be more understandable and also keeps ToGateway function with one responsibility.

Thoughts @mlavacca @pottekkat?

I agree with adding a dedicated filter function to the common package, but not on leaving implementations to call them. This is not optional, and I think it should not be on the providers' shoulders, but instead, something addressed without providers's awareness. For this reason, I think that the common.ToGateway function should call it, or at least introduce a mechanism to filter without asking providers do anything.

@levikobi
Copy link
Member

I tend to agree with you @mlavacca, that's a good point IMO. I would also prefer not to let the implementations the extra "power" / "responsibility". Maybe we can call the filter function in the i2gw pkg, and only pass implementations their associated resources?

@LiorLieberman
Copy link
Member

Thanks for flagging this. I think it is touching a topic we discussed on #99 with @dpasiukevich. More specifically this comment - #99 (comment).

The solution to this would be to also move ingresses to be fetched by the provider (perhaps every provider will query the ingresses with the relevant ingress classes it needs). Same as we do with CRDs.

Thoughts?
Any cons I did no think of if we are proceeding with this change?

@LiorLieberman
Copy link
Member

/assign @LiorLieberman

@LiorLieberman LiorLieberman removed good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Dec 27, 2023
@LiorLieberman LiorLieberman reopened this Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment