Skip to content

Commit 33ef061

Browse files
committed
feat: kong's TCPIngress conversion
Signed-off-by: Mattia Lavacca <[email protected]>
1 parent 1633f2e commit 33ef061

16 files changed

+892
-57
lines changed

go.mod

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ go 1.21
44

55
require (
66
github.com/google/go-cmp v0.6.0
7+
github.com/kong/kubernetes-ingress-controller/v2 v2.12.3
78
github.com/spf13/cobra v1.8.0
8-
github.com/stretchr/testify v1.8.4
9+
github.com/stretchr/testify v1.9.0
10+
istio.io/api v1.20.0
911
k8s.io/api v0.28.4
1012
k8s.io/apimachinery v0.28.4
1113
k8s.io/cli-runtime v0.28.4
@@ -17,12 +19,11 @@ require (
1719

1820
require (
1921
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
20-
github.com/pmezard/go-difflib v1.0.0 // indirect
21-
istio.io/api v1.20.0 // indirect
22+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
2223
)
2324

2425
require (
25-
github.com/davecgh/go-spew v1.1.1 // indirect
26+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
2627
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
2728
github.com/evanphx/json-patch v5.7.0+incompatible // indirect
2829
github.com/evanphx/json-patch/v5 v5.7.0 // indirect
@@ -64,13 +65,13 @@ require (
6465
google.golang.org/appengine v1.6.8 // indirect
6566
google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect
6667
google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f // indirect
67-
google.golang.org/protobuf v1.31.0 // indirect
68+
google.golang.org/protobuf v1.31.0
6869
gopkg.in/evanphx/json-patch.v5 v5.7.0 // indirect
6970
gopkg.in/inf.v0 v0.9.1 // indirect
7071
gopkg.in/yaml.v2 v2.4.0 // indirect
7172
gopkg.in/yaml.v3 v3.0.1 // indirect
7273
istio.io/client-go v1.19.0-alpha.1.0.20231130185426-9f1859c8ff42
73-
k8s.io/klog/v2 v2.110.1 // indirect
74+
k8s.io/klog/v2 v2.110.1
7475
k8s.io/kube-openapi v0.0.0-20231113174909-778a5567bc1e // indirect
7576
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
7677
sigs.k8s.io/kustomize/api v0.15.0 // indirect

go.sum

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL
55
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
66
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
77
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
8-
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
98
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
9+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
10+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1011
github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g=
1112
github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
1213
github.com/evanphx/json-patch v5.7.0+incompatible h1:vgGkfT/9f8zE6tvSCe74nfpAVDQ2tG6yudJd8LBksgI=
@@ -66,6 +67,8 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr
6667
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
6768
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
6869
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
70+
github.com/kong/kubernetes-ingress-controller/v2 v2.12.3 h1:HxQA6vp14rNMC4cIo81SMuNXD2vCUNMihPlQveTT9K4=
71+
github.com/kong/kubernetes-ingress-controller/v2 v2.12.3/go.mod h1:f2wIi3/yrwBYT+C/jtpB8tA+kEzewqLwOUGUwE5n+nk=
6972
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
7073
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
7174
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
@@ -88,6 +91,7 @@ github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 h1:n6/
8891
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00/go.mod h1:Pm3mSP3c5uWn86xMLZ5Sa7JB9GsEZySvHYXCTK4E9q4=
8992
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
9093
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
94+
github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc=
9195
github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU=
9296
github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM=
9397
github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI=
@@ -96,8 +100,9 @@ github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+v
96100
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
97101
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
98102
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
99-
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
100103
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
104+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
105+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
101106
github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q=
102107
github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY=
103108
github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw=
@@ -117,15 +122,16 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
117122
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
118123
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
119124
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
120-
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
121125
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
126+
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
127+
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
122128
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
123129
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
124130
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
125131
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
126132
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
127-
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
128-
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
133+
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
134+
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
129135
github.com/xlab/treeprint v1.2.0 h1:HzHnuAF1plUN2zGlAFHbSQP2qJ0ZAD3XF5XD7OesXRQ=
130136
github.com/xlab/treeprint v1.2.0/go.mod h1:gj5Gd3gPdKtR1ikdDK6fnFLdmIS0X30kTTuNd/WEJu0=
131137
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=

pkg/i2gw/ingress2gateway.go

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,14 @@ package i2gw
1919
import (
2020
"context"
2121
"fmt"
22+
"maps"
2223

24+
"k8s.io/apimachinery/pkg/types"
2325
"k8s.io/apimachinery/pkg/util/validation/field"
2426
"sigs.k8s.io/controller-runtime/pkg/client"
2527
"sigs.k8s.io/controller-runtime/pkg/client/config"
28+
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
29+
gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
2630
)
2731

2832
func ToGatewayAPIResources(ctx context.Context, namespace string, inputFile string, providers []string) ([]GatewayResources, error) {
@@ -105,6 +109,7 @@ func constructProviders(conf *ProviderConf, providers []string) (map[ProviderNam
105109
if !ok {
106110
return nil, fmt.Errorf("%s is not a supported provider", requestedProvider)
107111
}
112+
108113
providerByName[requestedProviderName] = newProviderFunc(conf)
109114
}
110115

@@ -127,3 +132,64 @@ func GetSupportedProviders() []string {
127132
}
128133
return supportedProviders
129134
}
135+
136+
// MergeGatewayResources accept multiple GatewayResources and create a unique Resource struct
137+
// built as follows:
138+
// - GatewayClasses, *Routes, and ReferenceGrants are grouped into the same maps
139+
// - Gateways may have the same NamespaceName even if they come from different
140+
// ingresses, as they have a their GatewayClass' name as name. For this reason,
141+
// if there are mutiple gateways named the same, their listeners are merged into
142+
// a unique Gateway.
143+
func MergeGatewayResources(gatewayResources ...GatewayResources) (GatewayResources, field.ErrorList) {
144+
mergedGatewayResources := GatewayResources{
145+
Gateways: make(map[types.NamespacedName]gatewayv1.Gateway),
146+
GatewayClasses: make(map[types.NamespacedName]gatewayv1.GatewayClass),
147+
HTTPRoutes: make(map[types.NamespacedName]gatewayv1.HTTPRoute),
148+
TLSRoutes: make(map[types.NamespacedName]gatewayv1alpha2.TLSRoute),
149+
TCPRoutes: make(map[types.NamespacedName]gatewayv1alpha2.TCPRoute),
150+
UDPRoutes: make(map[types.NamespacedName]gatewayv1alpha2.UDPRoute),
151+
ReferenceGrants: make(map[types.NamespacedName]gatewayv1alpha2.ReferenceGrant),
152+
}
153+
var errs field.ErrorList
154+
mergedGatewayResources.Gateways, errs = mergeGateways(gatewayResources)
155+
if len(errs) > 0 {
156+
return GatewayResources{}, errs
157+
}
158+
for _, gr := range gatewayResources {
159+
maps.Copy(mergedGatewayResources.GatewayClasses, gr.GatewayClasses)
160+
maps.Copy(mergedGatewayResources.HTTPRoutes, gr.HTTPRoutes)
161+
maps.Copy(mergedGatewayResources.TLSRoutes, gr.TLSRoutes)
162+
maps.Copy(mergedGatewayResources.TCPRoutes, gr.TCPRoutes)
163+
maps.Copy(mergedGatewayResources.UDPRoutes, gr.UDPRoutes)
164+
maps.Copy(mergedGatewayResources.ReferenceGrants, gr.ReferenceGrants)
165+
}
166+
return mergedGatewayResources, errs
167+
}
168+
169+
func mergeGateways(gatewaResources []GatewayResources) (map[types.NamespacedName]gatewayv1.Gateway, field.ErrorList) {
170+
newGateways := map[types.NamespacedName]gatewayv1.Gateway{}
171+
errs := field.ErrorList{}
172+
173+
for _, gr := range gatewaResources {
174+
for _, g := range gr.Gateways {
175+
nn := types.NamespacedName{Namespace: g.Namespace, Name: g.Name}
176+
if existingGateway, ok := newGateways[nn]; ok {
177+
g.Spec.Listeners = append(g.Spec.Listeners, existingGateway.Spec.Listeners...)
178+
g.Spec.Addresses = append(g.Spec.Addresses, existingGateway.Spec.Addresses...)
179+
}
180+
newGateways[nn] = g
181+
// 64 is the maximum number of listeners a Gateway can have
182+
if len(g.Spec.Listeners) > 64 {
183+
fieldPath := field.NewPath(fmt.Sprintf("%s/%s", nn.Namespace, nn.Name)).Child("spec").Child("listeners")
184+
errs = append(errs, field.Invalid(fieldPath, g, "error while merging gateway listeners: a gateway cannot have more than 64 listeners"))
185+
}
186+
// 16 is the maximum number of addresses a Gateway can have
187+
if len(g.Spec.Addresses) > 16 {
188+
fieldPath := field.NewPath(fmt.Sprintf("%s/%s", nn.Namespace, nn.Name)).Child("spec").Child("addresses")
189+
errs = append(errs, field.Invalid(fieldPath, g, "error while merging gateway listeners: a gateway cannot have more than 16 addresses"))
190+
}
191+
}
192+
}
193+
194+
return newGateways, errs
195+
}

pkg/i2gw/providers/common/resource_reader.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import (
3333
)
3434

3535
func ReadIngressesFromCluster(ctx context.Context, client client.Client, ingressClass string) (map[types.NamespacedName]*networkingv1.Ingress, error) {
36-
3736
var ingressList networkingv1.IngressList
3837
err := client.List(ctx, &ingressList)
3938
if err != nil {

pkg/i2gw/providers/common/utils.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,18 @@ func NameFromHost(host string) string {
9595
reg2, _ := regexp.Compile("^[^a-zA-Z0-9]+")
9696
step2 := reg2.ReplaceAllString(step1, "")
9797
// if nothing left, return "all-hosts"
98-
if len(host) == 0 {
98+
if len(host) == 0 || host == "*" {
9999
return "all-hosts"
100100
}
101101
return step2
102102
}
103103

104104
func RouteName(ingressName, host string) string {
105-
return fmt.Sprintf("%s-%s", ingressName, NameFromHost(host))
105+
routeName := ingressName
106+
if host != "" {
107+
routeName = fmt.Sprintf("%s-%s", ingressName, NameFromHost(host))
108+
}
109+
return routeName
106110
}
107111

108112
func ToBackendRef(ib networkingv1.IngressBackend, path *field.Path) (*gatewayv1.BackendRef, *field.Error) {

pkg/i2gw/providers/kong/annotations.go renamed to pkg/i2gw/providers/kong/consts.go

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ limitations under the License.
1616

1717
package kong
1818

19-
import "fmt"
19+
import (
20+
"fmt"
21+
22+
"k8s.io/apimachinery/pkg/runtime/schema"
23+
gatewayv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1"
24+
)
2025

2126
const (
2227
annotationPrefix = "konghq.com"
@@ -26,6 +31,23 @@ const (
2631
pluginsKey = "plugins"
2732
)
2833

34+
const (
35+
v1beta1Version string = "v1beta1"
36+
37+
kongResourcesGroup gatewayv1beta1.Group = "configuration.konghq.com"
38+
39+
kongPluginKind gatewayv1beta1.Kind = "KongPlugin"
40+
tcpIngressKind gatewayv1beta1.Kind = "TCPIngress"
41+
)
42+
43+
var (
44+
tcpIngressGVK = schema.GroupVersionKind{
45+
Group: string(kongResourcesGroup),
46+
Version: v1beta1Version,
47+
Kind: string(tcpIngressKind),
48+
}
49+
)
50+
2951
func kongAnnotation(suffix string) string {
3052
return fmt.Sprintf("%s/%s", annotationPrefix, suffix)
3153
}

pkg/i2gw/providers/kong/converter.go

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ limitations under the License.
1717
package kong
1818

1919
import (
20-
"github.com/kubernetes-sigs/ingress2gateway/pkg/i2gw"
21-
"github.com/kubernetes-sigs/ingress2gateway/pkg/i2gw/providers/common"
2220
networkingv1 "k8s.io/api/networking/v1"
2321
"k8s.io/apimachinery/pkg/util/validation/field"
22+
23+
"github.com/kubernetes-sigs/ingress2gateway/pkg/i2gw"
24+
"github.com/kubernetes-sigs/ingress2gateway/pkg/i2gw/providers/common"
25+
"github.com/kubernetes-sigs/ingress2gateway/pkg/i2gw/providers/kong/crds"
2426
)
2527

2628
// converter implements the ToGatewayAPI function of i2gw.ResourceConverter interface.
@@ -43,24 +45,37 @@ func newConverter() *converter {
4345
}
4446
}
4547

46-
func (c *converter) convert(storage *storage) (i2gw.GatewayResources, field.ErrorList) {
48+
func (c *converter) convert(storage storage) (i2gw.GatewayResources, field.ErrorList) {
4749
ingressList := []networkingv1.Ingress{}
48-
for _, ing := range storage.Ingresses {
49-
ingressList = append(ingressList, *ing)
50+
for _, ingress := range storage.Ingresses {
51+
ingressList = append(ingressList, *ingress)
5052
}
5153

54+
globalErrs := field.ErrorList{}
55+
5256
// Convert plain ingress resources to gateway resources, ignoring all
5357
// provider-specific features.
5458
gatewayResources, errs := common.ToGateway(ingressList, c.implementationSpecificOptions)
5559
if len(errs) > 0 {
56-
return i2gw.GatewayResources{}, errs
60+
globalErrs = append(globalErrs, errs...)
61+
}
62+
63+
tcpGatewayResources, errs := crds.TCPIngressToGatewayAPI(storage.TCPIngresses)
64+
if len(errs) > 0 {
65+
globalErrs = append(globalErrs, errs...)
66+
}
67+
68+
gatewayResources, errs = i2gw.MergeGatewayResources(gatewayResources, tcpGatewayResources)
69+
if len(errs) > 0 {
70+
globalErrs = append(globalErrs, errs...)
5771
}
5872

5973
for _, parseFeatureFunc := range c.featureParsers {
6074
// Apply the feature parsing function to the gateway resources, one by one.
61-
parseErrs := parseFeatureFunc(i2gw.InputResources{Ingresses: ingressList}, &gatewayResources)
75+
errs = parseFeatureFunc(i2gw.InputResources{Ingresses: ingressList}, &gatewayResources)
6276
// Append the parsing errors to the error list.
63-
errs = append(errs, parseErrs...)
77+
globalErrs = append(globalErrs, errs...)
6478
}
65-
return gatewayResources, errs
79+
80+
return gatewayResources, globalErrs
6681
}

pkg/i2gw/providers/kong/converter_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ func Test_ToGateway(t *testing.T) {
138138
{
139139
Type: gatewayv1.HTTPRouteFilterExtensionRef,
140140
ExtensionRef: &gatewayv1.LocalObjectReference{
141-
Group: kongPluginGroup,
141+
Group: kongResourcesGroup,
142142
Kind: kongPluginKind,
143143
Name: gatewayv1.ObjectName("plugin1"),
144144
},
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
Copyright 2023 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package crds
18+
19+
import (
20+
kongv1beta1 "github.com/kong/kubernetes-ingress-controller/v2/pkg/apis/configuration/v1beta1"
21+
)
22+
23+
type ruleGroupKey string
24+
25+
type tcpIngressAggregator struct {
26+
ruleGroups map[ruleGroupKey]*tcpIngressRuleGroup
27+
}
28+
29+
type tcpIngressRuleGroup struct {
30+
namespace string
31+
name string
32+
ingressClass string
33+
host string
34+
port int
35+
tls []kongv1beta1.IngressTLS
36+
rules []ingressRule
37+
}
38+
39+
type ingressRule struct {
40+
rule kongv1beta1.IngressRule
41+
}

0 commit comments

Comments
 (0)