Kong / deck

decK: Configuration management and drift detection for Kong
https://docs.konghq.com/deck/overview
Apache License 2.0
436 stars 128 forks source link

Deck convert from 2.x to 3.x does not handle the escape characters in the regex paths #1310

Open shambhand opened 4 months ago

shambhand commented 4 months ago

Input

  routes:
  - https_redirect_status_code: 426
    methods:
    - POST
    name: excelReader-route
    path_handling: v0
    paths:
    - /excelReader/([^\/]+)

deck file convert --from kong-gateway-2.x --to kong-gateway-3.x --input-file {input_file} --output-file {output_file}

Expected output:

  routes:
  - https_redirect_status_code: 426
    methods:
    - POST
    name: excelReader-route
    path_handling: v0
    paths:
    - /excelReader/([^/]+)

After converted file from 2.x to 3.x output, while syncing got an below error

 while processing event: Create route excelReader-route failed: HTTP status 400 (message: "validation error")
Tieske commented 4 months ago

This is not a conversion of Kong formats. It is a stricter regex rule. The escape (the \) in not necessary, some regex engines accept it, and some don't. So this is not covered in the conversion.

shambhand commented 4 months ago

@Tieske Thanks for the response. We have so many route's paths contains the regex with escape character paths; carried from kong 1.x to 2.x.

Now we are trying to migrate to kong/konnect 3.x.

I guess the earlier version of the kong was requiring to have the escape characters for route's regex paths.

Would there be a problem or any issue if it would be handle as part of deck 2.x to 3.x conversion? Considering kong 3.x routes creation API does not even accept the escape character for regex paths.

Tieske commented 4 months ago

It would mean trying to interpret a regex and guessing how to resolve the situation. I do not think there is a fool proof way of doing that conversion.