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

spec.rules[0].matches: Too many #2501

Closed
Rez0k opened this issue Oct 22, 2023 · 12 comments
Closed

spec.rules[0].matches: Too many #2501

Rez0k opened this issue Oct 22, 2023 · 12 comments

Comments

@Rez0k
Copy link

Rez0k commented Oct 22, 2023

Hi,

I am getting the following error:

The HTTPRoute "###" is invalid: spec.rules[0].matches: Too many: 20: must have at most 8 items

I need all 20 routes, why is there a limit and how can I bypass this limitation if possible?

if I can't bypass this limitation what is the workaround? creating multiple http routes objects?

I read this #1485 issue but I coudn't understand wheater or not you are going to increase / delete this limitation in the future.

@youngnick
Copy link
Contributor

There is a size limit because there is a limit to the size of any one Kubernetes object, so we need to ensure that we don't hit that.

Also, we do prefer that people create multiple, smaller HTTPRoute objects, and this is designed to have people do that.

It's possible we might increase this limit at some point, but unlikely, because of the reasons above.

If you post your HTTPRoute (or at least a redacted version), maybe someone can assist with splitting it up.

@Rez0k
Copy link
Author

Rez0k commented Oct 23, 2023

There is a size limit because there is a limit to the size of any one Kubernetes object, so we need to ensure that we don't hit that.

Also, we do prefer that people create multiple, smaller HTTPRoute objects, and this is designed to have people do that.

It's possible we might increase this limit at some point, but unlikely, because of the reasons above.

If you post your HTTPRoute (or at least a redacted version), maybe someone can assist with splitting it up.

I understand but I still believes the limit should be more than 8, thanks

@Rez0k Rez0k closed this as completed Oct 23, 2023
@devopsmash
Copy link

Hi @youngnick ,
Got this error too, you need to understand that in some places the developers has legacy routes that hard to be changed.

It will be great if you can add the ability to configure the limit with environment variable or some other ways, so each user will be responsible for his configuration.

@robscott
Copy link
Member

Unfortunately increasing the max size of an individual list has significant knock-on effects as @youngnick mentioned. To highlight consider the following:

16 max HTTPRoute rules:

// +kubebuilder:validation:MaxItems=16

8 max HTTPRouteRule matches:

// +kubebuilder:validation:MaxItems=8

16 max HTTPRouteMatch header matches:

// +kubebuilder:validation:MaxItems=16

16 max HTTPRouteMatch query param matches:

// +kubebuilder:validation:MaxItems=16

That means that each rule can specify 8 matches, and each match can specify 16 header matches and 16 query param matches 🤯. If you consider that we allow 16 rules within a route, you can see that this can quickly result in untenable resource size. I think the only reasonable way to make significant increases here would be if Kubernetes API machinery allowed us to make the max size conditional - ie this can only be larger than x if there is only 1 total route rule.

In the meantime, it should be entirely possible to split different matches into different route rules to get around this limitation.

@youngnick
Copy link
Contributor

As I said to @Rez0k, I'd be happy to take a look at sample HTTPRoutes and suggest ways that I think it would be better to break them up - I have an outstanding TODO to write some documentation around best practices here, but I need more real-world data to make it useful.

@Rez0k
Copy link
Author

Rez0k commented Oct 27, 2023

As I said to @Rez0k, I'd be happy to take a look at sample HTTPRoutes and suggest ways that I think it would be better to break them up - I have an outstanding TODO to write some documentation around best practices here, but I need more real-world data to make it useful.

Thanks, I decoupled my 20 paths into groups of 8 in each match array, all in the same httproue single object, and it seems to work fine.
the helm template wasn't fun, though 😇

@srinathrangaramanujam
Copy link

I understand the technical implication. is it possible to document this behaviour?

@youngnick
Copy link
Contributor

Hmm, the behavior is already documented in the validations, but I'm not sure how we should document this aside from that. I think that may need a fresh issue, would you mind opening one?

@srinathrangaramanujam
Copy link

@youngnick sure let me raise a new one. We could add these rules into the API spec for the HttpRoutes

@804e
Copy link

804e commented Jun 18, 2024

As I said to @Rez0k, I'd be happy to take a look at sample HTTPRoutes and suggest ways that I think it would be better to break them up - I have an outstanding TODO to write some documentation around best practices here, but I need more real-world data to make it useful.

Thanks, I decoupled my 20 paths into groups of 8 in each match array, all in the same httproue single object, and it seems to work fine. the helm template wasn't fun, though 😇

hi, @Rez0k Can you give an example yaml file?

@youngnick
Copy link
Contributor

@804e, the limit has been chosen to limit the combinatorial complexity and resulting size of the object. We've had a few discussions before, but have not found a compelling enough reason to increase the limit yet. If you would like to open a fresh issue outlining your reasons, please feel free to do so.

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

No branches or pull requests

6 participants