decK: declarative configuration for Kong


#1

Hello everyone,

I’ve released decK, a tool to manage Kong’s configuration using a declarative config file.

I’ve had this project on my personal project todo list for quite a while and
I finally had some time over the holidays to get it polished and out for a public release.

Here are some feature highlights:

  • Export
    Existing Kong configuration to a YAML configuration file This can be used to backup Kong’s configuration.

  • Import
    Kong’s database can be populated using the exported or a hand written config file.

  • Diff and sync capabilities
    deck can diff the configuration in the config file and the configuration in Kong’s DB and then sync it as well. This can be used to detect config drifts or manual interventions.

  • Reverse sync
    deck supports a sync the other way as well, meaning if an entity is created in Kong and doesn’t add it to the config file, deck will detect the change.

  • Reset
    This can be used to drops all entities in Kong’s DB and reset a Kong cluster.

  • Parallel operations
    All Admin API calls to Kong are executed in parallel using threads to speed up the sync.

  • Supported entities

    • Routes and services
    • Upstreams and targets
    • Certificates and SNIs
    • Plugins (Global, per route and per service)
  • More coming, check out the roadmap!

With deck, you can manage Kong’s configuration using a CI/CD pipeline and Git ops, move and sync configuration between multiple Kong clusters.

Detailed documentation is in progress and will be released soon. Stay tuned!

Meanwhile, download the binary, give it a spin and let me know your thoughts!

Please note that this is not an official tool from Kong Inc.

best,
Harry


RFC: Kong native Declarative Config format
#2

Neat project, I am specifically looking to give export and import a go and see how stable it is. Could be a great tool for before migrations just do a quick export and keep a copy on file and if migrations somehow went horribly wrong I could just restore to a totally fresh keyspace the same db entries using my exported record.

Your supported entities seems to be lacking Consumers(and credentials?)

Supported entities

Routes and services
Upstreams and targets
Certificates and SNIs
Plugins (Global, per route and per service)

Ohh I see its on the road-map :slight_smile: , as soon as that is in place and it can do full backup/restores I will give it a whirl, keep us posted on your progress!

Ooo and RESET will be just a helpful option too in sandbox modes to clear out a kong node when you have been just loadtesting resource creations.


#3

Consumers and credentials are a little tricky with a declarative configuration and expect to have some limitations:

With a lot of consumers (>10k+), the performance will slow down a little bit but for smaller scale clusters it should be possible.

Some credentials can actually never be exported, like basic-auth. Kong stores the hash with a salt and there is no way to actually export and then re-import from the Admin API.

Feel free to try out now for other entities as support consumers entity is being developed!


#4

Very cool that you created this in Go!

I’m curious if you considered configuring Kong declaratively using Terraform, which is also in Go? (The Terraform provider & its underlying API client). I ask because Terraform is amazing for configuring many separate technologies together as an integrated system, inherent to Kong’s gateway/routing role, and it would be great to have more momentum to those Go language projects :grimacing: (the client & provider are lagging behind Kong 1.0, now broken :persevere:)


#5

Ha! Very similar to what we did with Kongverge! Great minds thinking alike and all that.

Do we have a mechanism to just get behind one of these projects as a community - rather than everyone build a different one?


#6

Having the community behind one of the options feels like a better option for everyone. The Terraform provider approach is where I would put my chips. I haven’t dug into the existing TF Kong provider but we use TF providers whenever possible - it simplifies the overall workflow. And, streamlines dependencies, CI/CD, etc.