Tags provide a way to associate metadata with entities
in Kong Gateway. You can also filter entities by tags on the list endpoints in Kong Gateway.
Using this feature, decK associates tags with entities and can manage a group
of entities which share a common tag(s).
When multiple tags are specified in decK, decK AND
s those tags together,
meaning only entities containing all the tags will be managed by decK.
You can specify a combination of up to 5 tags, but we recommend using
fewer or only one tag, for performance reasons in Kong’s codebase.
Gateway dump
You can export a subset of entities in Kong Gateway by specifying common tags
using the --select-tag
flag.
For example, the following command generates a kong.yaml
file with all entities
which have both of the specified tags:
deck gateway dump --select-tag foo-tag --select-tag bar-tag
If you observe the file generated by decK, you will see the following section:
_info:
select_tags:
- foo-tag
- bar-tag
This sub-section tells decK to filter out entities containing select-tags during
a sync operation.
Gateway sync
You don’t need to specify --select-tag
in sync
and diff
commands.
The commands will use the tags present in the state file and perform the diff
accordingly.
Since the state files contain the tagging information, different teams can
make updates to the part of configuration in Kong without worrying about
configuration of other teams. You no longer need to maintain Kong’s
configuration in a single repository, where multiple teams need to
co-ordinate.
The --select-tag
flag is present on those two commands for use cases where
the file cannot have select_tags
defined inside it. It is strongly advised
that you do not supply select-tags to sync and diff commands via flags.
This is because the tag information should be part of the declarative
configuration file itself in order to provide a practical declarative file.
The tagging information and entity definitions should be present in one place,
else an error in supplying the wrong tag via the CLI can break the
configuration.
Gateway reset
You can delete only a subset of entities sharing a tag using the --select-tag
flag on the gateway reset
command.