kyma-project / kyma

Kyma is an opinionated set of Kubernetes-based modular building blocks, including all necessary capabilities to develop and run enterprise-grade cloud-native applications.
https://kyma-project.io
Apache License 2.0
1.52k stars 405 forks source link

Enable providing multiple services with paths in apirules. #9936

Closed valentinvieriu closed 1 year ago

valentinvieriu commented 3 years ago

Description

We should have the possibility to have a single hostname and multiple paths mapped to various k8s services. Example:

apiVersion: networking.k8s.io/v1
kind: APIRule
metadata:
  name: coolapp-ingress-wildcard-host
spec:
  rules:
  - host: "coolapp.bar.com"
    http:
      paths:
      - pathType: Prefix
        path: "/api"
        backend:
          service:
            name: customApiService
            port:
              number: 80
      - pathType: Prefix
        path: "/login"
        backend:
          service:
            name: loginService
            port:
              number: 80
      - pathType: Prefix
        path: "/.*"
        backend:
          service:
            name: staticWebsiteService
            port:
              number: 80

Acceptance criteria

Reasons

For Single Page Applications, this will be a very simple way to consume services, without worrying about CORS overhead and also about how to pass the API endpoints as configurations to the SPA. This is also a good practice that is used by other vendors like Firebase, and Vercel to expose and consume serverless functions to the SPA

stale[bot] commented 3 years ago

This issue has been automatically marked as stale due to the lack of recent activity. It will soon be closed if no further activity occurs. Thank you for your contributions.

gabel commented 3 years ago

Having a similar requirement but for multiple namespaces. Discussion in Slack https://kyma-community.slack.com/archives/CBLBESMST/p1612770790008100

Namespace foo
api.example.com/foo -> service foo

Namespace bar
api.example.com/bar -> service bar

The same domain should be possible to be used in multiple namespaces with different paths to different services. This works for Istio Virtual Services using https://istio.io/latest/docs/reference/config/analysis/ist0109/.

ghost commented 3 years ago

This issue has been automatically marked as stale due to the lack of recent activity. It will soon be closed if no further activity occurs. Thank you for your contributions.

gabel commented 3 years ago

Any chance this topic will be picked up?

ghost commented 3 years ago

This issue has been automatically marked as stale due to the lack of recent activity. It will soon be closed if no further activity occurs. Thank you for your contributions.

ghost commented 3 years ago

This issue has been automatically marked as stale due to the lack of recent activity. It will soon be closed if no further activity occurs. Thank you for your contributions.

ghost commented 2 years ago

This issue has been automatically marked as stale due to the lack of recent activity. It will soon be closed if no further activity occurs. Thank you for your contributions.

ghost commented 2 years ago

This issue has been automatically closed due to the lack of recent activity.

ThuF commented 2 years ago

Are there any updates on this issues?

The feature seems quite relevant and multiple scenarios are depending on it. For example the Eclipse Dirigible Web IDE Debugger is not working on Kyma due to CORS issues.

ghost commented 2 years ago

This issue has been automatically marked as stale due to the lack of recent activity. It will soon be closed if no further activity occurs. Thank you for your contributions.

dariusztutaj commented 2 years ago

/remove-lifecycle stale

dapus123 commented 2 years ago

The apirule ability to have a failover service would be a good scenario in this particular issue, but it may be slightly different issue as well. In our setup, we have apirule pointing to a single cache service, but what if cache service is down, I would go directly to service, in case we could configure apirule for that. Thanks, Daniel

strekm commented 2 years ago

@gabel we will handle support for svc from other namespaces in separate ticket. thanks for your input! @dapus123 please open separate feature request for you request. thanks

luizcarlospedrosogomes commented 1 year ago

Is this available in the latest version of kyma?