kyma-project / api-gateway

Apache License 2.0
4 stars 26 forks source link

Support for wildcard host/multiple hosts #419

Open pbusko opened 1 year ago

pbusko commented 1 year ago

Description

At the moment, each APIRule object is bound to single external URL, however the underlying VirtualService object is capable of serving multiple hosts at the same time, or use regex matchers for the Host header.

Example with regex matcher (will match a-http-echo.my.domain.com, b-http-echo.my.domain.com etc.):

apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
  name: http-echo
  namespace: http-echo
spec:
  gateways:
    - kyma-system/kyma-gateway
  hosts:
    - '*'
  http:
    - corsPolicy:
        allowHeaders:
          - Authorization
          - Content-Type
          - '*'
        allowMethods:
          - GET
          - POST
          - PUT
          - DELETE
          - PATCH
        allowOrigins:
          - regex: .*
      match:
        - uri:
            regex: /.*
          headers:
            Host:
              regex: ^(.*)-http-echo\.my\.domain\.com$
      route:
        - weight: 100
          destination:
            host: http-echo.http-echo.svc.cluster.local

Example with multiple hosts:

apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
  name: http-echo
  namespace: http-echo
spec:
  gateways:
    - kyma-system/kyma-gateway
  hosts:
    - 'a-http-echo.my.domain.com'
    - 'b-http-echo.my.domain.com'
  http:
    - corsPolicy:
        allowHeaders:
          - Authorization
          - Content-Type
          - '*'
        allowMethods:
          - GET
          - POST
          - PUT
          - DELETE
          - PATCH
        allowOrigins:
          - regex: .*
      match:
        - uri:
            regex: /.*
      route:
        - weight: 100
          destination:
            host: http-echo.http-echo.svc.cluster.local

Would be very helpful to have support from APIRule for such use cases, by either introducing new spec.hosts array, or making spec.host regex capable by switching to the Host header regex matcher (or both).

Reasons

These features would greatly improve Kyma support for Multitenant CAP applications, which are using SaaS Registry Service. At the moment there's no easy way to handle multitenant URLs on Kyma.

DoD:

Attachments

kyma-bot commented 11 months ago

This issue or PR has been automatically marked as stale due to the lack of recent activity. Thank you for your contributions.

This bot triages issues and PRs according to the following rules:

You can:

If you think that I work incorrectly, kindly raise an issue with the problem.

/lifecycle stale

kyma-bot commented 11 months ago

This issue or PR has been automatically closed due to the lack of activity. Thank you for your contributions.

This bot triages issues and PRs according to the following rules:

You can:

If you think that I work incorrectly, kindly raise an issue with the problem.

/close

kyma-bot commented 11 months ago

@kyma-bot: Closing this issue.

In response to [this](https://github.com/kyma-project/api-gateway/issues/419#issuecomment-1742475964): >This issue or PR has been automatically closed due to the lack of activity. >Thank you for your contributions. > >This bot triages issues and PRs according to the following rules: >- After 60d of inactivity, `lifecycle/stale` is applied >- After 7d of inactivity since `lifecycle/stale` was applied, the issue is closed > >You can: >- Reopen this issue or PR with `/reopen` >- Mark this issue or PR as fresh with `/remove-lifecycle stale` > >If you think that I work incorrectly, kindly [raise an issue](https://github.com/kyma-project/test-infra/issues/new/choose) with the problem. > >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
kyma-bot commented 8 months ago

This issue or PR has been automatically marked as stale due to the lack of recent activity. Thank you for your contributions.

This bot triages issues and PRs according to the following rules:

You can:

If you think that I work incorrectly, kindly raise an issue with the problem.

/lifecycle stale

kyma-bot commented 8 months ago

This issue or PR has been automatically closed due to the lack of activity. Thank you for your contributions.

This bot triages issues and PRs according to the following rules:

You can:

If you think that I work incorrectly, kindly raise an issue with the problem.

/close

kyma-bot commented 8 months ago

@kyma-bot: Closing this issue.

In response to [this](https://github.com/kyma-project/api-gateway/issues/419#issuecomment-1873957516): >This issue or PR has been automatically closed due to the lack of activity. >Thank you for your contributions. > >This bot triages issues and PRs according to the following rules: >- After 60d of inactivity, `lifecycle/stale` is applied >- After 7d of inactivity since `lifecycle/stale` was applied, the issue is closed > >You can: >- Reopen this issue or PR with `/reopen` >- Mark this issue or PR as fresh with `/remove-lifecycle stale` > >If you think that I work incorrectly, kindly [raise an issue](https://github.com/kyma-project/test-infra/issues/new/choose) with the problem. > >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.