Custom Entities in Postgres DB using Kubernetes Ingress Controller

tldr: How do I add custom entities to when using the Kubernetes Ingress Controller with a postgres database?

I have Kong running with Kubernetes and I have a working custom plugin which rejects or approves requests based on their content. Now I want to expand the plugin to save some Information about every kong_consumer and include it in the decision making of the plugin. For that I added a postgres-db to kong which seems to work. Now I want to add a new entity called consumer_data which has one kong_consumer_id as a FOREIGN KEY. As far as I understand it, custom entities in Kong are tied to custom plugins. Kong knows about my custom plugin because I create a config map based on the source code of my plugin with

kubectl -n kong create configmap upload-limit --from-file=plugins/upload-limit/upload-limit

Now according to this documentation which my or may not be the correct documentation to follow, the migrations (init.lua, 000_base_upload-limit.lua) should be in a subdirectory of the plugin called migrations. The problem is that create configmap command ignores subdirectories when creating configmaps and the -R flag seems to be invalid as well. Then I looked at the generated config map and tried to add the migrations directory with the myself but “/” are not allowed where I would need them.

If anybody understands what I am trying to do here and know of a way to do it with Kong could you please point me in the right direction. Btw this is the first time that I am using Kong. If you need an more information let me know.

© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ