Skip to content

Commit 465a0e6

Browse files
fix(deps): fix dependency update for kube 0.34/0.35
Signed-off-by: ivan katliarchuk <[email protected]>
1 parent 031b6e4 commit 465a0e6

18 files changed

+120
-58
lines changed

go.mod

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ require (
6969
gopkg.in/ns1/ns1-go.v2 v2.16.0
7070
istio.io/api v1.28.1
7171
istio.io/client-go v1.28.1
72-
k8s.io/api v0.34.3
73-
k8s.io/apimachinery v0.34.3
74-
k8s.io/client-go v0.34.3
72+
k8s.io/api v0.35.0
73+
k8s.io/apimachinery v0.35.0
74+
k8s.io/client-go v0.35.0
7575
k8s.io/klog/v2 v2.130.1
76-
k8s.io/utils v0.0.0-20250820121507-0af2bda4dd1d
76+
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4
7777
sigs.k8s.io/controller-runtime v0.22.4
7878
sigs.k8s.io/gateway-api v1.4.1
7979
)
@@ -201,7 +201,7 @@ require (
201201
gopkg.in/ini.v1 v1.67.0 // indirect
202202
gopkg.in/yaml.v2 v2.4.0 // indirect
203203
gopkg.in/yaml.v3 v3.0.1 // indirect
204-
k8s.io/kube-openapi v0.0.0-20250814151709-d7b6acb124c3 // indirect
204+
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect
205205
moul.io/http2curl v1.0.0 // indirect
206206
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
207207
sigs.k8s.io/randfill v1.0.0 // indirect

go.sum

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,6 +1454,8 @@ k8s.io/api v0.18.2/go.mod h1:SJCWI7OLzhZSvbY7U8zwNl9UA4o1fizoug34OV/2r78=
14541454
k8s.io/api v0.18.4/go.mod h1:lOIQAKYgai1+vz9J7YcDZwC26Z0zQewYOGWdyIPUUQ4=
14551455
k8s.io/api v0.34.3 h1:D12sTP257/jSH2vHV2EDYrb16bS7ULlHpdNdNhEw2S4=
14561456
k8s.io/api v0.34.3/go.mod h1:PyVQBF886Q5RSQZOim7DybQjAbVs8g7gwJNhGtY5MBk=
1457+
k8s.io/api v0.35.0 h1:iBAU5LTyBI9vw3L5glmat1njFK34srdLmktWwLTprlY=
1458+
k8s.io/api v0.35.0/go.mod h1:AQ0SNTzm4ZAczM03QH42c7l3bih1TbAXYo0DkF8ktnA=
14571459
k8s.io/apiextensions-apiserver v0.18.0/go.mod h1:18Cwn1Xws4xnWQNC00FLq1E350b9lUF+aOdIWDOZxgo=
14581460
k8s.io/apiextensions-apiserver v0.18.2/go.mod h1:q3faSnRGmYimiocj6cHQ1I3WpLqmDgJFlKL37fC4ZvY=
14591461
k8s.io/apiextensions-apiserver v0.18.4/go.mod h1:NYeyeYq4SIpFlPxSAB6jHPIdvu3hL0pc36wuRChybio=
@@ -1464,6 +1466,8 @@ k8s.io/apimachinery v0.18.2/go.mod h1:9SnR/e11v5IbyPCGbvJViimtJ0SwHG4nfZFjU77ftc
14641466
k8s.io/apimachinery v0.18.4/go.mod h1:OaXp26zu/5J7p0f92ASynJa1pZo06YlV9fG7BoWbCko=
14651467
k8s.io/apimachinery v0.34.3 h1:/TB+SFEiQvN9HPldtlWOTp0hWbJ+fjU+wkxysf/aQnE=
14661468
k8s.io/apimachinery v0.34.3/go.mod h1:/GwIlEcWuTX9zKIg2mbw0LRFIsXwrfoVxn+ef0X13lw=
1469+
k8s.io/apimachinery v0.35.0 h1:Z2L3IHvPVv/MJ7xRxHEtk6GoJElaAqDCCU0S6ncYok8=
1470+
k8s.io/apimachinery v0.35.0/go.mod h1:jQCgFZFR1F4Ik7hvr2g84RTJSZegBc8yHgFWKn//hns=
14671471
k8s.io/apiserver v0.18.0/go.mod h1:3S2O6FeBBd6XTo0njUrLxiqk8GNy6wWOftjhJcXYnjw=
14681472
k8s.io/apiserver v0.18.2/go.mod h1:Xbh066NqrZO8cbsoenCwyDJ1OSi8Ag8I2lezeHxzwzw=
14691473
k8s.io/apiserver v0.18.4/go.mod h1:q+zoFct5ABNnYkGIaGQ3bcbUNdmPyOCoEBcg51LChY8=
@@ -1474,6 +1478,8 @@ k8s.io/client-go v0.18.2/go.mod h1:Xcm5wVGXX9HAA2JJ2sSBUn3tCJ+4SVlCbl2MNNv+CIU=
14741478
k8s.io/client-go v0.18.4/go.mod h1:f5sXwL4yAZRkAtzOxRWUhA/N8XzGCb+nPZI8PfobZ9g=
14751479
k8s.io/client-go v0.34.3 h1:wtYtpzy/OPNYf7WyNBTj3iUA0XaBHVqhv4Iv3tbrF5A=
14761480
k8s.io/client-go v0.34.3/go.mod h1:OxxeYagaP9Kdf78UrKLa3YZixMCfP6bgPwPwNBQBzpM=
1481+
k8s.io/client-go v0.35.0 h1:IAW0ifFbfQQwQmga0UdoH0yvdqrbwMdq9vIFEhRpxBE=
1482+
k8s.io/client-go v0.35.0/go.mod h1:q2E5AAyqcbeLGPdoRB+Nxe3KYTfPce1Dnu1myQdqz9o=
14771483
k8s.io/code-generator v0.18.0/go.mod h1:+UHX5rSbxmR8kzS+FAv7um6dtYrZokQvjHpDSYRVkTc=
14781484
k8s.io/code-generator v0.18.2/go.mod h1:+UHX5rSbxmR8kzS+FAv7um6dtYrZokQvjHpDSYRVkTc=
14791485
k8s.io/code-generator v0.18.4/go.mod h1:TgNEVx9hCyPGpdtCWA34olQYLkh3ok9ar7XfSsr8b6c=
@@ -1493,6 +1499,8 @@ k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c/go.mod h1:GRQhZsXIAJ1xR0C
14931499
k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E=
14941500
k8s.io/kube-openapi v0.0.0-20250814151709-d7b6acb124c3 h1:liMHz39T5dJO1aOKHLvwaCjDbf07wVh6yaUlTpunnkE=
14951501
k8s.io/kube-openapi v0.0.0-20250814151709-d7b6acb124c3/go.mod h1:UZ2yyWbFTpuhSbFhv24aGNOdoRdJZgsIObGBUaYVsts=
1502+
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 h1:Y3gxNAuB0OBLImH611+UDZcmKS3g6CthxToOb37KgwE=
1503+
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912/go.mod h1:kdmbQkyfwUagLfXIad1y2TdrjPFWp2Q89B3qkRwf/pQ=
14961504
k8s.io/kubectl v0.18.0/go.mod h1:LOkWx9Z5DXMEg5KtOjHhRiC1fqJPLyCr3KtQgEolCkU=
14971505
k8s.io/kubectl v0.18.4/go.mod h1:EzB+nfeUWk6fm6giXQ8P4Fayw3dsN+M7Wjy23mTRtB0=
14981506
k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk=
@@ -1502,6 +1510,8 @@ k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl
15021510
k8s.io/utils v0.0.0-20200603063816-c1c6865ac451/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
15031511
k8s.io/utils v0.0.0-20250820121507-0af2bda4dd1d h1:wAhiDyZ4Tdtt7e46e9M5ZSAJ/MnPGPs+Ki1gHw4w1R0=
15041512
k8s.io/utils v0.0.0-20250820121507-0af2bda4dd1d/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
1513+
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 h1:SjGebBtkBqHFOli+05xYbK8YF1Dzkbzn+gDM4X9T4Ck=
1514+
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
15051515
moul.io/http2curl v1.0.0 h1:6XwpyZOYsgZJrU8exnG87ncVkU1FVCcTRpwzOkTDUi8=
15061516
moul.io/http2curl v1.0.0/go.mod h1:f6cULg+e4Md/oW1cYmwW4IWQOVl2lGbmCNGOHvzX2kE=
15071517
rsc.io/letsencrypt v0.0.3/go.mod h1:buyQKZ6IXrRnB7TdkHP0RyEybLx18HHyOSoTyoOLqNY=

source/contour_httpproxy.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func NewContourHTTPProxySource(
7373
httpProxyInformer := informerFactory.ForResource(projectcontour.HTTPProxyGVR)
7474

7575
// Add default resource event handlers to properly initialize informer.
76-
httpProxyInformer.Informer().AddEventHandler(
76+
_, _ = httpProxyInformer.Informer().AddEventHandler(
7777
cache.ResourceEventHandlerFuncs{
7878
AddFunc: func(obj interface{}) {
7979
},
@@ -83,7 +83,7 @@ func NewContourHTTPProxySource(
8383
informerFactory.Start(ctx.Done())
8484

8585
// wait for the local cache to be populated.
86-
if err := informers.WaitForDynamicCacheSync(context.Background(), informerFactory); err != nil {
86+
if err := informers.WaitForDynamicCacheSync(ctx, informerFactory); err != nil {
8787
return nil, err
8888
}
8989

source/gateway.go

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ import (
2929
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3030
"k8s.io/apimachinery/pkg/labels"
3131
"k8s.io/apimachinery/pkg/types"
32-
"k8s.io/apimachinery/pkg/util/wait"
3332
kubeinformers "k8s.io/client-go/informers"
3433
coreinformers "k8s.io/client-go/informers/core/v1"
3534
"k8s.io/client-go/tools/cache"
35+
"sigs.k8s.io/external-dns/source/informers"
3636
v1 "sigs.k8s.io/gateway-api/apis/v1"
3737
"sigs.k8s.io/gateway-api/apis/v1beta1"
3838
gateway "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned"
@@ -42,7 +42,6 @@ import (
4242
"sigs.k8s.io/external-dns/endpoint"
4343
"sigs.k8s.io/external-dns/source/annotations"
4444
"sigs.k8s.io/external-dns/source/fqdn"
45-
"sigs.k8s.io/external-dns/source/informers"
4645
)
4746

4847
const (
@@ -78,9 +77,8 @@ func newGatewayInformerFactory(client gateway.Interface, namespace string, label
7877
opts = append(opts, gwinformers.WithNamespace(namespace))
7978
}
8079
if labelSelector != nil && !labelSelector.Empty() {
81-
lbls := labelSelector.String()
8280
opts = append(opts, gwinformers.WithTweakListOptions(func(o *metav1.ListOptions) {
83-
o.LabelSelector = lbls
81+
o.LabelSelector = labelSelector.String()
8482
}))
8583
}
8684
return gwinformers.NewSharedInformerFactoryWithOptions(client, 0, opts...)
@@ -105,9 +103,13 @@ type gatewayRouteSource struct {
105103
ignoreHostnameAnnotation bool
106104
}
107105

108-
func newGatewayRouteSource(clients ClientGenerator, config *Config, kind string, newInformerFn newGatewayRouteInformerFunc) (Source, error) {
109-
ctx := context.TODO()
110-
106+
func newGatewayRouteSource(
107+
ctx context.Context,
108+
clients ClientGenerator,
109+
config *Config,
110+
kind string,
111+
newInformerFn newGatewayRouteInformerFunc,
112+
) (Source, error) {
111113
gwLabels, err := getLabelSelector(config.GatewayLabelFilter)
112114
if err != nil {
113115
return nil, err
@@ -150,18 +152,20 @@ func newGatewayRouteSource(clients ClientGenerator, config *Config, kind string,
150152
nsInformer := kubeInformerFactory.Core().V1().Namespaces() // TODO: Namespace informer should be shared across gateway sources.
151153
nsInformer.Informer() // Register with factory before starting.
152154

153-
informerFactory.Start(wait.NeverStop)
154-
kubeInformerFactory.Start(wait.NeverStop)
155-
if rtInformerFactory != informerFactory {
156-
rtInformerFactory.Start(wait.NeverStop)
155+
informerFactory.Start(ctx.Done())
156+
kubeInformerFactory.Start(ctx.Done())
157157

158+
if rtInformerFactory != informerFactory {
159+
rtInformerFactory.Start(ctx.Done())
158160
if err := informers.WaitForCacheSync(ctx, rtInformerFactory); err != nil {
159161
return nil, err
160162
}
161163
}
164+
162165
if err := informers.WaitForCacheSync(ctx, informerFactory); err != nil {
163166
return nil, err
164167
}
168+
165169
if err := informers.WaitForCacheSync(ctx, kubeInformerFactory); err != nil {
166170
return nil, err
167171
}
@@ -187,12 +191,12 @@ func newGatewayRouteSource(clients ClientGenerator, config *Config, kind string,
187191
return src, nil
188192
}
189193

190-
func (src *gatewayRouteSource) AddEventHandler(ctx context.Context, handler func()) {
194+
func (src *gatewayRouteSource) AddEventHandler(_ context.Context, handler func()) {
191195
log.Debugf("Adding event handlers for %s", src.rtKind)
192196
eventHandler := eventHandlerFunc(handler)
193-
src.gwInformer.Informer().AddEventHandler(eventHandler)
194-
src.rtInformer.Informer().AddEventHandler(eventHandler)
195-
src.nsInformer.Informer().AddEventHandler(eventHandler)
197+
_, _ = src.gwInformer.Informer().AddEventHandler(eventHandler)
198+
_, _ = src.rtInformer.Informer().AddEventHandler(eventHandler)
199+
_, _ = src.nsInformer.Informer().AddEventHandler(eventHandler)
196200
}
197201

198202
func (src *gatewayRouteSource) Endpoints(ctx context.Context) ([]*endpoint.Endpoint, error) {

source/gateway_grpcroute.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ limitations under the License.
1717
package source
1818

1919
import (
20+
"context"
21+
2022
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2123
"k8s.io/apimachinery/pkg/labels"
2224
v1 "sigs.k8s.io/gateway-api/apis/v1"
@@ -25,8 +27,12 @@ import (
2527
)
2628

2729
// NewGatewayGRPCRouteSource creates a new Gateway GRPCRoute source with the given config.
28-
func NewGatewayGRPCRouteSource(clients ClientGenerator, config *Config) (Source, error) {
29-
return newGatewayRouteSource(clients, config, "GRPCRoute", func(factory informers.SharedInformerFactory) gatewayRouteInformer {
30+
func NewGatewayGRPCRouteSource(
31+
ctx context.Context,
32+
clients ClientGenerator,
33+
config *Config,
34+
) (Source, error) {
35+
return newGatewayRouteSource(ctx, clients, config, "GRPCRoute", func(factory informers.SharedInformerFactory) gatewayRouteInformer {
3036
return &gatewayGRPCRouteInformer{factory.Gateway().V1().GRPCRoutes()}
3137
})
3238
}

source/gateway_grpcroute_test.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,32 @@ package source
1919
import (
2020
"context"
2121
"testing"
22+
"time"
2223

2324
"github.com/stretchr/testify/require"
2425
corev1 "k8s.io/api/core/v1"
2526
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2627
kubefake "k8s.io/client-go/kubernetes/fake"
2728
"sigs.k8s.io/external-dns/endpoint"
29+
2830
"sigs.k8s.io/external-dns/source/annotations"
2931
v1 "sigs.k8s.io/gateway-api/apis/v1"
30-
v1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1"
32+
"sigs.k8s.io/gateway-api/apis/v1beta1"
3133
gatewayfake "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/fake"
3234
)
3335

3436
func TestGatewayGRPCRouteSourceEndpoints(t *testing.T) {
3537
t.Parallel()
3638

37-
gwClient := gatewayfake.NewSimpleClientset()
38-
kubeClient := kubefake.NewSimpleClientset()
39+
ctx, cancel := context.WithTimeout(t.Context(), 1*time.Second)
40+
defer cancel()
41+
42+
gwClient := gatewayfake.NewClientset()
43+
kubeClient := kubefake.NewClientset()
3944
clients := new(MockClientGenerator)
4045
clients.On("GatewayClient").Return(gwClient, nil)
4146
clients.On("KubeClient").Return(kubeClient, nil)
4247

43-
ctx := context.Background()
4448
ns := &corev1.Namespace{
4549
ObjectMeta: metav1.ObjectMeta{
4650
Name: "default",
@@ -88,7 +92,7 @@ func TestGatewayGRPCRouteSourceEndpoints(t *testing.T) {
8892
_, err = gwClient.GatewayV1().GRPCRoutes(rt.Namespace).Create(ctx, rt, metav1.CreateOptions{})
8993
require.NoError(t, err, "failed to create GRPCRoute")
9094

91-
src, err := NewGatewayGRPCRouteSource(clients, &Config{
95+
src, err := NewGatewayGRPCRouteSource(ctx, clients, &Config{
9296
FQDNTemplate: "{{.Name}}-template.foobar.internal",
9397
CombineFQDNAndAnnotation: true,
9498
})

source/gateway_httproute.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ limitations under the License.
1717
package source
1818

1919
import (
20+
"context"
21+
2022
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2123
"k8s.io/apimachinery/pkg/labels"
2224
v1 "sigs.k8s.io/gateway-api/apis/v1"
@@ -26,8 +28,12 @@ import (
2628
)
2729

2830
// NewGatewayHTTPRouteSource creates a new Gateway HTTPRoute source with the given config.
29-
func NewGatewayHTTPRouteSource(clients ClientGenerator, config *Config) (Source, error) {
30-
return newGatewayRouteSource(clients, config, "HTTPRoute", func(factory informers.SharedInformerFactory) gatewayRouteInformer {
31+
func NewGatewayHTTPRouteSource(
32+
ctx context.Context,
33+
clients ClientGenerator,
34+
config *Config,
35+
) (Source, error) {
36+
return newGatewayRouteSource(ctx, clients, config, "HTTPRoute", func(factory informers.SharedInformerFactory) gatewayRouteInformer {
3137
return &gatewayHTTPRouteInformer{factory.Gateway().V1beta1().HTTPRoutes()}
3238
})
3339
}

source/gateway_httproute_test.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package source
1919
import (
2020
"context"
2121
"testing"
22+
"time"
2223

2324
log "github.com/sirupsen/logrus"
2425
"github.com/stretchr/testify/require"
@@ -1547,18 +1548,20 @@ func TestGatewayHTTPRouteSourceEndpoints(t *testing.T) {
15471548
t.Parallel()
15481549
}
15491550

1550-
ctx := context.Background()
1551+
ctx, cancel := context.WithTimeout(t.Context(), 1*time.Second)
1552+
defer cancel()
1553+
15511554
gwClient := gatewayfake.NewSimpleClientset()
1555+
kubeClient := kubefake.NewClientset()
1556+
15521557
for _, gw := range tt.gateways {
15531558
_, err := gwClient.GatewayV1beta1().Gateways(gw.Namespace).Create(ctx, gw, metav1.CreateOptions{})
15541559
require.NoError(t, err, "failed to create Gateway")
1555-
15561560
}
15571561
for _, rt := range tt.routes {
15581562
_, err := gwClient.GatewayV1beta1().HTTPRoutes(rt.Namespace).Create(ctx, rt, metav1.CreateOptions{})
15591563
require.NoError(t, err, "failed to create HTTPRoute")
15601564
}
1561-
kubeClient := kubefake.NewSimpleClientset()
15621565
for _, ns := range tt.namespaces {
15631566
_, err := kubeClient.CoreV1().Namespaces().Create(ctx, ns, metav1.CreateOptions{})
15641567
require.NoError(t, err, "failed to create Namespace")
@@ -1568,7 +1571,7 @@ func TestGatewayHTTPRouteSourceEndpoints(t *testing.T) {
15681571
clients.On("GatewayClient").Return(gwClient, nil)
15691572
clients.On("KubeClient").Return(kubeClient, nil)
15701573

1571-
src, err := NewGatewayHTTPRouteSource(clients, &tt.config)
1574+
src, err := NewGatewayHTTPRouteSource(t.Context(), clients, &tt.config)
15721575
require.NoError(t, err, "failed to create Gateway HTTPRoute Source")
15731576

15741577
hook := testutils.LogsUnderTestWithLogLevel(log.DebugLevel, t)

source/gateway_tcproute.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ limitations under the License.
1717
package source
1818

1919
import (
20+
"context"
21+
2022
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2123
"k8s.io/apimachinery/pkg/labels"
2224
v1 "sigs.k8s.io/gateway-api/apis/v1"
@@ -26,8 +28,12 @@ import (
2628
)
2729

2830
// NewGatewayTCPRouteSource creates a new Gateway TCPRoute source with the given config.
29-
func NewGatewayTCPRouteSource(clients ClientGenerator, config *Config) (Source, error) {
30-
return newGatewayRouteSource(clients, config, "TCPRoute", func(factory informers.SharedInformerFactory) gatewayRouteInformer {
31+
func NewGatewayTCPRouteSource(
32+
ctx context.Context,
33+
clients ClientGenerator,
34+
config *Config,
35+
) (Source, error) {
36+
return newGatewayRouteSource(ctx, clients, config, "TCPRoute", func(factory informers.SharedInformerFactory) gatewayRouteInformer {
3137
return &gatewayTCPRouteInformer{factory.Gateway().V1alpha2().TCPRoutes()}
3238
})
3339
}

source/gateway_tcproute_test.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package source
1919
import (
2020
"context"
2121
"testing"
22+
"time"
2223

2324
"github.com/stretchr/testify/require"
2425
corev1 "k8s.io/api/core/v1"
@@ -35,13 +36,16 @@ import (
3536
func TestGatewayTCPRouteSourceEndpoints(t *testing.T) {
3637
t.Parallel()
3738

39+
ctx, cancel := context.WithTimeout(t.Context(), 10*time.Second)
40+
defer cancel()
41+
3842
gwClient := gatewayfake.NewSimpleClientset()
39-
kubeClient := kubefake.NewSimpleClientset()
43+
kubeClient := kubefake.NewClientset()
44+
4045
clients := new(MockClientGenerator)
4146
clients.On("GatewayClient").Return(gwClient, nil)
4247
clients.On("KubeClient").Return(kubeClient, nil)
4348

44-
ctx := context.Background()
4549
ns := &corev1.Namespace{
4650
ObjectMeta: metav1.ObjectMeta{
4751
Name: "default",
@@ -88,7 +92,7 @@ func TestGatewayTCPRouteSourceEndpoints(t *testing.T) {
8892
_, err = gwClient.GatewayV1alpha2().TCPRoutes(rt.Namespace).Create(ctx, rt, metav1.CreateOptions{})
8993
require.NoError(t, err, "failed to create TCPRoute")
9094

91-
src, err := NewGatewayTCPRouteSource(clients, &Config{
95+
src, err := NewGatewayTCPRouteSource(ctx, clients, &Config{
9296
FQDNTemplate: "{{.Name}}-template.foobar.internal",
9397
CombineFQDNAndAnnotation: true,
9498
})

0 commit comments

Comments
 (0)