Skip to content

Commit 84672ca

Browse files
authored
chore: cleanup logging when inserting proxy service cluster (#7431)
cleanup Signed-off-by: jukie <[email protected]>
1 parent 8929f89 commit 84672ca

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

internal/provider/kubernetes/controller.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,7 +1470,7 @@ func (r *gatewayAPIReconciler) processGateways(ctx context.Context, managedGC *g
14701470
if r.isGatewayClassMerged(managedGC.Name) {
14711471
mergedGateways = true
14721472
// processGatewayClassParamsRef has been called for this GatewayClass, its EnvoyProxy should exist in resourceTree
1473-
r.processServiceClusterForGatewayClass(resourceTree.EnvoyProxyForGatewayClass, managedGC, resourceMap)
1473+
r.processServiceClusterForGatewayClass(ctx, resourceTree.EnvoyProxyForGatewayClass, managedGC, resourceMap)
14741474
}
14751475

14761476
for i := range gatewayList.Items {
@@ -1576,7 +1576,7 @@ func (r *gatewayAPIReconciler) processGateways(ctx context.Context, managedGC *g
15761576
if ep == nil && resourceTree.EnvoyProxyForGatewayClass != nil {
15771577
ep = resourceTree.EnvoyProxyForGatewayClass
15781578
}
1579-
r.processServiceClusterForGateway(ep, gtw, resourceMap)
1579+
r.processServiceClusterForGateway(ctx, ep, gtw, resourceMap)
15801580
}
15811581

15821582
if !resourceMap.allAssociatedGateways.Has(gtwNamespacedName) {
@@ -1589,7 +1589,7 @@ func (r *gatewayAPIReconciler) processGateways(ctx context.Context, managedGC *g
15891589
}
15901590

15911591
// Called on a GatewayClass when merged gateways mode is enabled for it.
1592-
func (r *gatewayAPIReconciler) processServiceClusterForGatewayClass(ep *egv1a1.EnvoyProxy, gatewayClass *gwapiv1.GatewayClass, resourceMap *resourceMappings) {
1592+
func (r *gatewayAPIReconciler) processServiceClusterForGatewayClass(ctx context.Context, ep *egv1a1.EnvoyProxy, gatewayClass *gwapiv1.GatewayClass, resourceMap *resourceMappings) {
15931593
// Skip processing if topology injector is disabled
15941594
if r.envoyGateway != nil && r.envoyGateway.TopologyInjectorDisabled() {
15951595
return
@@ -1605,11 +1605,11 @@ func (r *gatewayAPIReconciler) processServiceClusterForGatewayClass(ep *egv1a1.E
16051605
}
16061606
}
16071607

1608-
r.insertProxyServiceIfExists(proxySvcName, proxySvcNamespace, resourceMap)
1608+
r.insertProxyServiceIfExists(ctx, proxySvcName, proxySvcNamespace, resourceMap)
16091609
}
16101610

16111611
// Called on a Gateway when merged gateways mode is not enabled for its parent GatewayClass.
1612-
func (r *gatewayAPIReconciler) processServiceClusterForGateway(ep *egv1a1.EnvoyProxy, gateway *gwapiv1.Gateway, resourceMap *resourceMappings) {
1612+
func (r *gatewayAPIReconciler) processServiceClusterForGateway(ctx context.Context, ep *egv1a1.EnvoyProxy, gateway *gwapiv1.Gateway, resourceMap *resourceMappings) {
16131613
// Skip processing if topology injector is disabled
16141614
if r.envoyGateway != nil && r.envoyGateway.TopologyInjectorDisabled() {
16151615
return
@@ -1630,17 +1630,17 @@ func (r *gatewayAPIReconciler) processServiceClusterForGateway(ep *egv1a1.EnvoyP
16301630
}
16311631
}
16321632

1633-
r.insertProxyServiceIfExists(proxySvcName, proxySvcNamespace, resourceMap)
1633+
r.insertProxyServiceIfExists(ctx, proxySvcName, proxySvcNamespace, resourceMap)
16341634
}
16351635

1636-
func (r *gatewayAPIReconciler) insertProxyServiceIfExists(name, namespace string, resourceMap *resourceMappings) {
1636+
func (r *gatewayAPIReconciler) insertProxyServiceIfExists(ctx context.Context, name, namespace string, resourceMap *resourceMappings) {
16371637
svcNN := types.NamespacedName{Name: name, Namespace: namespace}
16381638
svc := new(corev1.Service)
1639-
err := r.client.Get(context.Background(), svcNN, svc)
1639+
err := r.client.Get(ctx, svcNN, svc)
16401640
// Only insert if service exists
16411641
if err != nil {
16421642
if !kerrors.IsNotFound(err) {
1643-
r.log.Error(err, "failed to get proxy service", "namespace", namespace, "name", name)
1643+
r.log.Info("failed to get proxy service", "namespace", namespace, "name", name, "error", err)
16441644
}
16451645
return
16461646
}

internal/provider/kubernetes/controller_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,7 +1335,7 @@ func TestProcessServiceClusterForGatewayClass(t *testing.T) {
13351335
Build()
13361336
r.namespace = "envoy-gateway-system"
13371337

1338-
r.processServiceClusterForGatewayClass(tc.envoyProxy, tc.gatewayClass, resourceMap)
1338+
r.processServiceClusterForGatewayClass(context.Background(), tc.envoyProxy, tc.gatewayClass, resourceMap)
13391339

13401340
expectedRef := gwapiv1.BackendObjectReference{
13411341
Kind: ptr.To(gwapiv1.Kind(resource.KindService)),
@@ -1517,7 +1517,7 @@ func TestProcessServiceClusterForGateway(t *testing.T) {
15171517
tc.envoyProxy = tc.gatewayClassEnvoyProxy
15181518
}
15191519

1520-
r.processServiceClusterForGateway(tc.envoyProxy, tc.gateway, resourceMap)
1520+
r.processServiceClusterForGateway(context.Background(), tc.envoyProxy, tc.gateway, resourceMap)
15211521

15221522
expectedRef := gwapiv1.BackendObjectReference{
15231523
Kind: ptr.To(gwapiv1.Kind(resource.KindService)),

0 commit comments

Comments
 (0)