Consumer groups with tags and distributed configuration
gregoirechauvet opened this issue · comments
Tags have been added to consumer groups in #823
But despite this addition, it seems a distributed configuration doesn't work with consumer groups.
I've tested it on deck v1.17.2 which is the version that includes the consumer group tags addition.
Reproduction
Create consumer groups from a configuration with select_tags: global
.
# In config/consumer-groups.yml
_format_version: "3.0"
_konnect:
runtime_group_name: default
_info:
select_tags:
- global
consumer_groups:
- name: gold
plugins:
- name: rate-limiting-advanced
config:
limit:
- 200
window_size:
- 60
window_type: sliding
deck sync -s config/
And then try to create a service from another location with another select tag:
# In my-service/services.yml
_format_version: "3.0"
_konnect:
runtime_group_name: default
_info:
select_tags:
- client-api
services:
- name: client-api
host: example.domain
port: 80
path: /api
protocol: http
deck diff -s my-service/
It results in the following output. The consumer groups should be deleted from decK's perspective. Whereas other entities such as services and plugins are ignored properly.
creating service client-api
deleting consumer-group gold
Summary:
Created: 1
Updated: 0
Deleted: 1
Investigation
I've investigated decK hoping I could contribute to it by fixing this behavior. But my conclusion is that the error comes from the /v1/consumer-groups
endpoint that doesn't filter on tags
:
deck/konnect/consumer_group.go
Line 432 in 629712b
The full endpoint decK is using in my case is:
https://eu.api.konghq.com/konnect-api/api/runtime_groups/[RUNTIME_GROUP_ID]/v1/consumer-groups
I've tried it on the CLI, and it ignores the tags
when sent as parameters (?tags=client-api
). As opposed to endpoints such as /services
which filter correctly on tags.
I could not find any documentation about /v1/consumer-groups
, only about /consumer_groups
.
Any reason not to use the second one instead? Should the first one be documented?
@gregoirechauvet Thank you very much for this ticket, and your investigation! I have been able to reproduce the issue with your steps. There are indeed 2 different issues:
- the tags filtering doesn't work as expected with the konnect endpoint
- the tags filter is not added properly by deck (like the other endpoints).
we are going to provide fixes as soon as possible and keep you on touch.
About the different endpoints for consumer groups, this is expected. There are some differences in the implementation between Konnect (saas) vs Kong. Usually, konnect users don't deal with the endpoint directly so that's why it is not documented.