kubeshop / kusk-gen

Kusk Gen generates Ingress-controller configurations from your OpenAPI definition
https://kubeshop.github.io/kusk-gen
MIT License
173 stars 12 forks source link

Literal Rewrite flag on Ambassador2 #186

Closed mg185363 closed 2 years ago

mg185363 commented 2 years ago

Is your feature request related to a problem? Please describe. I would like to have the ability to use a flag to create a rewrite to override the default rewrite: "" behavior. A good example would be trying to create the following:

apiVersion: getambassador.io/v3alpha1
kind:  Mapping
metadata:
  name:  cat-mapping
  namespace: api-gateway
spec:
  hostname: "*"
  prefix: /cat/
  rewrite: /fact/
  service: catfact.ninja

This mapping routes to the free API, catfact.ninja using https://[external-IP]/cat/ which then is rewritten to be /fact/.

Another example would be the free API, https://jservice.io/api/random. I had created my own mapping that rewrote /api/ to be /trivia/

Describe the solution you'd like An ideal solution would be the addition of a --path.rewrite flag so that the user can add in their own rewrite that doesn't require the regex substitution.

Describe alternatives you've considered This cannot be achieved using the path.trim_prefix flag

dobegor commented 2 years ago

@mg185363 this should be available in 0.6.0-rc1 release now - we'd be glad to receive feedback if this works for your setup

mg185363 commented 2 years ago

awesome, thanks!