-
Notifications
You must be signed in to change notification settings - Fork 345
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
Be able to set route id in Kubernetes resource #1881
Comments
Here are a few clarifications:
But if you want to get the route id, it's a good idea to go back to status. You can also check out the current build logic, it's fixed |
Being able to determine the ID beforehand - let's say Re 1: I don't think I understand what you mean. The Admin API already exposes the possibility of determining the ID beforehand as far as I can see, it's just that the Ingress Controller does not make use of it. |
@frankkoornstra are you planning to raise a PR? |
Because in a Kubernetes environment (through declarative configuration), its name is obviously more intuitive. However, we also need to consider isolation based on namespaces. Users may deploy the same content in multiple namespaces, so we cannot directly use its name as an ID. Therefore, we regenerate its ID. |
For clarity: I'm not suggesting using the actual So you'd have something like this: apiVersion: apisix.apache.org/v2
kind: ApisixRoute
metadata:
name: echo
spec:
route_id: echo-route <-- This would become the id of the route
http:
- name: echo-free
match:
... @shreemaan-abhishek I don't have the faintest idea how to write Go so sorry to say that I can't raise a PR. |
After the APISIX Route is submitted as a k8s resource, the name of the generated apisix route is named using the following rule. How about using the same rule for the ID? apisix-ingress-controller/pkg/providers/apisix/translation/apisix_route.go Lines 157 to 159 in e809cfb
https://github.com/apache/apisix-ingress-controller/blob/master/pkg/types/apisix/v1/types.go#L619 apisix-ingress-controller/pkg/types/apisix/v1/types.go Lines 619 to 632 in e809cfb
|
That would definitely work 👍 |
This will be a break change. Is anyone willing to submit a PR to implement it? |
I wish I could but am not capable in Go |
Description
When a route gets created from the Kubernetes resource there's no way to create the id deterministically (by providing a route_id for example) or to even get the id from the status of the resource; only when I log in to the dashboard, I can get the route id.
I need the route id to be able to programmatically create consumers that I want to restrict to a route with consumer-restrict through the Admin API . Also I need it to analyze my reported traffic in a completely different service.
I would be very happy if we could determine the id beforehand with an optional route_id in the spec. If that's not possible, could the id be returned in the status of the k8s resource?
The text was updated successfully, but these errors were encountered: