For KongConsumer, KongService and KongRoute relations it creates a single entry (and thus a single KongPluginBinding) where KIC (and the linked implementation) would create 2:
1 for KongConsumer and KongService
1 for KongConsumer and KongRoute
Which issue this PR fixes
Fixes #525
Special notes for your reviewer:
envtest based test will follow in a separate PR to not make this PR any bigger.
This introduces a small gap where KongPluginBinding (and thus Konnect plugin entity) can be deleted and recreated when target set of a plugin has changed, for instance when KongService and KongRoute are annotated with the same plugin and then KongRoute gets that annotation removed the reconciler will remove the KongPluginBinding as the target set doesn't match and then recreate a new one, having only the service as target.
Implementing an improvement for this would require adding a mechanism which could map the plugin relations (combinations of resources having the konghq.com/plugins annotation set) to existing KongPluginBindings.
PR Readiness Checklist:
Complete these before marking the PR as ready to review:
[x] the CHANGELOG.md release notes have been updated to reflect significant changes
What this PR does / why we need it:
This PR introduces mechanism of creating
KongPluginBinding
s for bothKongRoute
s andKongService
s based on annotation on those.A mechanism to clean unused
KongPluginBinding
s has also been introduced.Creating a cartesian product of possible relations (if e.g. the same plugin is used on
KongService
andKongRoute
create 1 binding with both set as targets) is based on https://github.com/Kong/kubernetes-ingress-controller/blob/ee797b4e84bd176526af32ab6db54f16ee9c245b/internal/util/relations.go with 1 small change:For
KongConsumer
,KongService
andKongRoute
relations it creates a single entry (and thus a singleKongPluginBinding
) where KIC (and the linked implementation) would create 2:KongConsumer
andKongService
KongConsumer
andKongRoute
Which issue this PR fixes
Fixes #525
Special notes for your reviewer:
envtest
based test will follow in a separate PR to not make this PR any bigger.This introduces a small gap where
KongPluginBinding
(and thus Konnect plugin entity) can be deleted and recreated when target set of a plugin has changed, for instance whenKongService
andKongRoute
are annotated with the same plugin and thenKongRoute
gets that annotation removed the reconciler will remove theKongPluginBinding
as the target set doesn't match and then recreate a new one, having only the service as target.Implementing an improvement for this would require adding a mechanism which could map the plugin relations (combinations of resources having the
konghq.com/plugins
annotation set) to existingKongPluginBinding
s.PR Readiness Checklist:
Complete these before marking the PR as
ready to review
:CHANGELOG.md
release notes have been updated to reflect significant changes