Skip to content

Commit

Permalink
address review's comments
Browse files Browse the repository at this point in the history
Signed-off-by: Mattia Lavacca <[email protected]>
  • Loading branch information
mlavacca committed Oct 23, 2023
1 parent a0bca0b commit 7452b69
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/i2gw/providers/kong/converter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ func Test_ToGateway(t *testing.T) {
{
Type: gatewayv1beta1.HTTPRouteFilterExtensionRef,
ExtensionRef: &gatewayv1beta1.LocalObjectReference{
Group: gatewayv1beta1.Group("configuration.konghq.com/v1"),
Kind: gatewayv1beta1.Kind("KongPlugin"),
Group: kongPluginGroup,
Kind: kongPluginKind,
Name: gatewayv1beta1.ObjectName("plugin1"),
},
},
Expand Down
9 changes: 7 additions & 2 deletions pkg/i2gw/providers/kong/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ import (
gatewayv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1"
)

const (
kongPluginGroup gatewayv1beta1.Group = "configuration.konghq.com/v1"
kongPluginKind gatewayv1beta1.Kind = "KongPlugin"
)

// pluginsFeature parses the Kong Ingress Controller plugins annotation and converts it
// into HTTPRoutes rule's ExtensionRef filters.
// It's possible to define a list of plugins to attach to the same HTTPRoute by setting
Expand Down Expand Up @@ -61,8 +66,8 @@ func parsePluginsAnnotation(ingressNamespace, ingressName string, annotations ma
filters = append(filters, gatewayv1beta1.HTTPRouteFilter{
Type: gatewayv1beta1.HTTPRouteFilterExtensionRef,
ExtensionRef: &gatewayv1beta1.LocalObjectReference{
Group: gatewayv1beta1.Group("configuration.konghq.com/v1"),
Kind: gatewayv1beta1.Kind("KongPlugin"),
Group: kongPluginGroup,
Kind: kongPluginKind,
Name: gatewayv1beta1.ObjectName(v),
},
})
Expand Down

0 comments on commit 7452b69

Please sign in to comment.