From 50170b194d7643c3cc9860974c0d43425ef83520 Mon Sep 17 00:00:00 2001 From: "jan.walther" Date: Mon, 9 Sep 2024 23:24:09 +0200 Subject: [PATCH] Add logging --- internal/envoy/resource.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/envoy/resource.go b/internal/envoy/resource.go index 0355c9c..9cd8e0e 100644 --- a/internal/envoy/resource.go +++ b/internal/envoy/resource.go @@ -56,12 +56,13 @@ func MapSnapshot(ctx context.Context, client ctrlclient.Client, loadBalancers [] var cluster []types.Resource log := ctrl.LoggerFrom(ctx) + log.Info("Creating snapshot") addressesMap := make(map[string][]kubelbv1alpha1.EndpointAddress) for _, lb := range loadBalancers { // multiple endpoints represent multiple clusters - log.V(2).Info("Adding load balancer", "name", lb.Name, "namespace", lb.Namespace) + log.Info("Adding load balancer", "name", lb.Name, "namespace", lb.Namespace) for i, lbEndpoint := range lb.Spec.Endpoints { - log.V(2).Info("Adding endpoint", "name", lbEndpoint.AddressesReference.Name) + log.Info("Adding endpoint", "name", lbEndpoint.AddressesReference.Name) if lbEndpoint.AddressesReference != nil { // Check if map already contains the key if val, ok := addressesMap[fmt.Sprintf(endpointAddressReferencePattern, lb.Namespace, lbEndpoint.AddressesReference.Name)]; ok { @@ -80,7 +81,7 @@ func MapSnapshot(ctx context.Context, client ctrlclient.Client, loadBalancers [] } for _, lbEndpointPort := range lbEndpoint.Ports { - log.V(2).Info("Adding port", "port", lbEndpointPort.Port, "protocol", lbEndpointPort.Protocol) + log.Info("Adding port", "port", lbEndpointPort.Port, "protocol", lbEndpointPort.Protocol) var lbEndpoints []*envoyEndpoint.LbEndpoint key := fmt.Sprintf(kubelb.EnvoyResourceIdentifierPattern, lb.Namespace, lb.Name, i, lbEndpointPort.Port, lbEndpointPort.Protocol) @@ -103,7 +104,7 @@ func MapSnapshot(ctx context.Context, client ctrlclient.Client, loadBalancers [] } else if lbEndpointPort.Protocol == corev1.ProtocolUDP { listener = append(listener, makeUDPListener(key, key, port)) } - log.V(2).Info("adding cluster", "key", key, "ports", len(lbEndpoint.Ports)) + log.Info("adding cluster", "key", key, "ports", len(lbEndpoint.Ports)) cluster = append(cluster, makeCluster(key, lbEndpoints)) }