GithubHelp home page GithubHelp logo

Comments (10)

Gacko avatar Gacko commented on June 23, 2024 1

Hm, I think we're mixing up things a bit here.

What @philipp-durrer-jarowa asks for is the ability to have just one Ingress resource per domain (IIRC we are kind of enforcing that somewhere during validations anyway) with different backends separated by path.

In their use case each of those backends requires its own rewrite configuration. Some example requests:

http://first-tenant.great-service.com/anything -> http://frontend-service/anything
http://first-tenant.great-service.com/api/anything -> http://service-backend/anything
http://first-tenant.great-service.com/static/anything -> http://data-backend/first-tenant/anything

If that's correct, I do not think it's related to the chart but more to how we're rendering rewrites in locations.

from ingress-nginx.

k8s-ci-robot avatar k8s-ci-robot commented on June 23, 2024

This issue is currently awaiting triage.

If Ingress contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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.

from ingress-nginx.

longwuyuan avatar longwuyuan commented on June 23, 2024

And you are already using this https://kubernetes.github.io/ingress-nginx/examples/rewrite/ ?

from ingress-nginx.

philipp-durrer-jarowa avatar philipp-durrer-jarowa commented on June 23, 2024

Yes but we'd like to have only one ingress resource per domain, but there are multiple services behind it that need different rewrites. Example:

...
    - host: "{{ $tenant }}.{{ .host }}"
      http:
        paths:
          - path: "/"
            pathType: Prefix
            backend:
              service:
                name: {{ $fullName }}-frontend
                port:
                  name: http-fe
          - path: "/api/"     ---> needs a rewrite to /
            pathType: Prefix
            backend:
              service:
                name: {{ $fullName }}-backend
                port:
                  name: http
          - path: "/static"     ---> needs a rewrite to /$tenant/static/
            pathType: Prefix
            backend:
              service:
                name: {{ $fullName }}-data
                port:
                  name: http-fe
...

With the nginx.org/rewrites I could do this:

    nginx.org/rewrites: "serviceName={{ $fullName }}-backend rewrite=/; serviceName={{ $fullName }}-data rewrite=/{{ $tenant }}/static;"

from ingress-nginx.

longwuyuan avatar longwuyuan commented on June 23, 2024

Thanks for clarifying.

from ingress-nginx.

strongjz avatar strongjz commented on June 23, 2024

/assign @Gacko

I will leave this up to @Gacko, but this would be a breaking change for all other uses. The two projects are different, so annotations should reflect that.

from ingress-nginx.

longwuyuan avatar longwuyuan commented on June 23, 2024

It seems like this controller's one annotation will perform a single rewrite of the target-path to all rules in that ingress.

But what is @philipp-durrer-jarowa is asking is a combo like ;

  • one annotation
  • multiple rewrite operations defined in the value part of that one single annotation (new ability)

And @Gacko's example is showing a 2nd new ability of even having option to pick different backends for different rewrite operations, all in the same annotation

from ingress-nginx.

Gacko avatar Gacko commented on June 23, 2024

And @Gacko's example is showing a 2nd new ability of even having option to pick different backends for different rewrite operations, all in the same annotation

That is already covered by the rules matching the according paths.

What's not yet covered is the ability to specify a rewrite rule per backend. So in case a requests gets sent to backend A, apply rewrite rule A, if backend b then rewrite rule B and in all the other cases either do nothing or apply a general rewrite rule.

I really don't wanna over-engineer things, but that's how I understand the NGINX Inc. documentation.

from ingress-nginx.

strongjz avatar strongjz commented on June 23, 2024

This will be a feature for support in HTTP routes https://gateway-api.sigs.k8s.io/guides/http-redirect-rewrite/

We are working on gateway API support and cannot implement this issue in ingress.

/close

from ingress-nginx.

k8s-ci-robot avatar k8s-ci-robot commented on June 23, 2024

@strongjz: Closing this issue.

In response to this:

This will be a feature for support in HTTP routes https://gateway-api.sigs.k8s.io/guides/http-redirect-rewrite/

We are working on gateway API support and cannot implement this issue in ingress.

/close

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.

from ingress-nginx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.