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

Generate Kubernetes Ingress Paths from Jakarta REST #45696

Open
Eric-Prokop opened this issue Jan 18, 2025 · 8 comments
Open

Generate Kubernetes Ingress Paths from Jakarta REST #45696

Eric-Prokop opened this issue Jan 18, 2025 · 8 comments
Labels

Comments

@Eric-Prokop
Copy link

Eric-Prokop commented Jan 18, 2025

Description

It would be nice if the ingress routing could be more explicit by adding the paths known from Jakarta REST to the generated kubernetes ingress instead of just a

  path: /
    pathType: Prefix

Implementation ideas

No response

@Eric-Prokop Eric-Prokop added the kind/enhancement New feature or request label Jan 18, 2025
Copy link

quarkus-bot bot commented Jan 18, 2025

/cc @geoand (kubernetes), @iocanel (kubernetes)

@geoand
Copy link
Contributor

geoand commented Jan 20, 2025

Thanks for reporting.

Can you provide a few more details on what you would like to see here?

@Eric-Prokop
Copy link
Author

So bascially this is my resource:

@Path("/projects")
public interface ProjectsApi {

    @GET
    @Path("/autocomplete")
    @Produces({ "application/json" })
    Uni<AutocompleteResponse> autocomplete(@QueryParam("term") @NotNull @Size(min=3) String term);

    @GET
    @Path("/filter-elements")
    @Produces({ "application/json" })
    Uni<GetFilterElementsResponse> getFilterElements();

    @GET
    @Path("/all")
    @Produces({ "application/json" })
    Uni<ListProjectsResponse> listProjects();
}

Using the kubernetes extension with quarkus.kubernetes.ingress.expose=true produces:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    app.quarkus.io/quarkus-version: 3.17.5
  labels:
    app.kubernetes.io/name: project-service
    app.kubernetes.io/managed-by: quarkus
  name: project-service
  namespace: staging
spec:
  rules:
    - http:
        paths:
          - backend:
              service:
                name: project-service
                port:
                  name: http
            path: /
            pathType: Prefix

But it would be much nicer to get this:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    app.quarkus.io/quarkus-version: 3.17.5
  labels:
    app.kubernetes.io/name: project-service
    app.kubernetes.io/managed-by: quarkus
  name: project-service
  namespace: staging
spec:
  rules:
    - http:
        paths:
          - backend:
              service:
                name: project-service
                port:
                  name: http
            path: /projects/autocomplete
            pathType: Exact
          - backend:
              service:
                name: project-service
                port:
                  name: http
            path: /projects/filter-elements
            pathType: Exact
          - backend:
              service:
                name: project-service
                port:
                  name: http
            path: /projects/all
            pathType: Exact

@geoand
Copy link
Contributor

geoand commented Jan 21, 2025

Thanks for the example!

Would that really be useful in practice?

@Eric-Prokop
Copy link
Author

Having only Exact machtes makes it easier for me to deal with 404 situations, since I want such situations to be routed to a different service. Also, the kubernetes.yml would be more verbose allowing my coworkers to quickly get a board idea of which routes are actually used. Also, on a more emotional/conceptual level, determing things exactly "at build time" feels (at least for me) more fitting to the quarkus philosophy.

On the other hand, I think it would be nice-to-have and not a must-have. We already have quarkus.kubernetes.ports.http.path to at least change the Prefix.

@geoand
Copy link
Contributor

geoand commented Jan 21, 2025

Let's see what @iocanel thinks

@iocanel
Copy link
Contributor

iocanel commented Jan 21, 2025

I agree, this ties nicely to our philosophy.

We should collect all registered paths and use the least common denominator for the ingress / route path.

@Eric-Prokop: Is this something you would be willing to contribute?

@Eric-Prokop
Copy link
Author

While I would like to work on this, I won't be able to find the time in the near future.

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

No branches or pull requests

3 participants