I'm Updating from kong 1.1.2 to kong 2.0.3 (both in db less mode).
In kong 1.1.2 it does not matter if a route has same name than another route, but in kong 2.0.3 all kind of weird errors occurs.
Hello @carnei-ro,
Could you send us an example of the errors you are receiving, and (if possible) a minimal example of the db-less config that shows this problem?
Hello @kikito I don't have the errors anymore, sorry. I implemented "name checker" into my pipeline to avoid this kind of errors.
@carnei-ro I found that deck validate is useful to detect such errors. What tool are you using?
https://docs.konghq.com/hub/kong-inc/deck/#features
we use this version: https://github.com/hbagdi/deck/releases/download/v1.1.0/deck_1.1.0_linux_amd64.tar.gz
and then this script:
#!/usr/bin/env bash
set -e # will abort if anything fails
echo Validating syntax with kong config...
kong config parse $1
ln -fs $1 kong.yaml # needed for deck
echo Validating content with deck...
/bin/deck validate
echo Successful!
deck validate is probably enough (kong config parse kind of redundant) but since output is not quite clear I prefer this 2 step validation, so it's clearly an invalid yaml file or a duplicated route name (or duplicated plugin uuid).
hello @javiertejero we are using "kong config parse
Thanks @carnei-ro that's why we found deck validate useful, it detects duplicate names and IDs. So I understand you added some kind of linter? Is it open source?
We do have a linter in our pipeline. It is not open source yet.
It also verifies some "business rules", such as: is the service an S3 bucket? If yes, the "preserve_host" for all the routes of this service should be set as "false".
We use kong with Chef as CM, so I have a bunch of yamls with environment variables, used to not commit secrets to git and to reuse code (a route for development environment can be used in the production environment - the only change is the hosts, so, env var for that). Chef source these environment variables, interpolate the YAMLs files, join them into one single yaml to POST to Kong config.
When I saw decK it didn't support interpolation yet.
https://github.com/carnei-ro/kong-interpolation -> I made this when kong 1.1.2 come into play
Great comment and feedback in this thread, thank you for sharing!
deck validate should catch quite a few errors but it is not perfect. We plan to add more thorough checking using /schemas endpoint in Kong that should catch almost all errors. Please open Github issues in decK's repo to track more requests if you have any.Going back to the original problem, I tried to reproduce myself but failed to do so.
I'm going to close this since we don't have any reproducible steps. Please re-open if needed. Thanks!