emissary icon indicating copy to clipboard operation
emissary copied to clipboard

API Doc : URL reported to Ambassador Cloud is wrong

Open shepz opened this issue 2 years ago • 0 comments

Describe the bug Emissary automatically adds the prefixes from the mappings to the swagger APIs on the fly. The issue with that is that sometimes, the swagger contract already contains a base path. As a solution, we should also read the rewrite field from the mapping, and avoid adding the prefix if it matches the rewrite.

See code : https://github.com/emissary-ingress/emissary/blob/master/pkg/agent/api_docs.go#L273

To Reproduce Steps to reproduce the behavior:

  1. Connect your Cluster to Ambassador Cloud
  2. Deploy an application that reports an APIDoc with a base path.
  3. Create a mapping that point to the APIDoc created. Mapping must include a prefix
  4. Navigate to Service Catalog choose your service and click on the API Tab

The URL reported includes the mapping prefix and the basePath.

Mapping Host : my-website.com Mapping Prefix : /hello BasePath in swagger : /hello

Url reported in the UI : my-website.com/hello/hello

Expected behavior Don't add two times the prefix if it's the same

Versions (please complete the following information):

  • Ambassador: any
  • Kubernetes environment : any
  • Version : any

Additional context Add any other context about the problem here.

shepz avatar Jul 28 '22 15:07 shepz