emissary
emissary copied to clipboard
API Doc : URL reported to Ambassador Cloud is wrong
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:
- Connect your Cluster to Ambassador Cloud
- Deploy an application that reports an APIDoc with a base path.
- Create a mapping that point to the APIDoc created. Mapping must include a prefix
- 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.