Kong / gateway-operator

Kubernetes Operator for Kong Gateways
Apache License 2.0
49 stars 11 forks source link

feat(konnect): make KongPlugin reconciler create KongPluginBindings for plugins attached to KongRoutes and KongServices #644

Closed pmalek closed 4 days ago

pmalek commented 5 days ago

What this PR does / why we need it:

This PR introduces mechanism of creating KongPluginBindings for both KongRoutes and KongServices based on annotation on those.

A mechanism to clean unused KongPluginBindings has also been introduced.

Creating a cartesian product of possible relations (if e.g. the same plugin is used on KongService and KongRoute 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 and KongRoute relations it creates a single entry (and thus a single KongPluginBinding) where KIC (and the linked implementation) would create 2:

Which issue this PR fixes

Fixes #525

Special notes for your reviewer:

PR Readiness Checklist:

Complete these before marking the PR as ready to review: