From 66980fe0871c8e7868c7e9b69239cbefea949a4b Mon Sep 17 00:00:00 2001 From: Punakshi Chaand Date: Wed, 11 Dec 2024 15:49:48 -0800 Subject: [PATCH] =?UTF-8?q?MESH-000:=20Add=20detailed=20logging=20for=20cl?= =?UTF-8?q?ient-initiated=20processing=20and=20gl=E2=80=A6=20(#364)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …obal traffic policy events (#830) (#831) ### Checklist 🚨 Please review this repository's [contribution guidelines](./CONTRIBUTING.md). - [ ] I've read and agree to the project's contribution guidelines. - [ ] I'm requesting to **pull a topic/feature/bugfix branch**. - [ ] I checked that my code additions will pass code linting checks and unit tests. - [ ] I updated unit and integration tests (if applicable). - [ ] I'm ready to notify the team of this contribution. ### Description What does this change do and why? [Link to related ISSUE] Thank you! Co-authored-by: Punakshi Chaand --- admiral/pkg/clusters/deployment_handler.go | 1 + admiral/pkg/clusters/rollout_handler.go | 1 + admiral/pkg/clusters/util.go | 7 +++++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/admiral/pkg/clusters/deployment_handler.go b/admiral/pkg/clusters/deployment_handler.go index de60fd3dd..a4d668a32 100644 --- a/admiral/pkg/clusters/deployment_handler.go +++ b/admiral/pkg/clusters/deployment_handler.go @@ -74,6 +74,7 @@ func HandleEventForDeployment(ctx context.Context, event admiral.EventType, obj // Use the same function as added deployment function to update and put new service entry in place to replace old one _, err := modifyServiceEntryForNewServiceOrPod(ctx, event, env, globalIdentifier, remoteRegistry) if common.ClientInitiatedProcessingEnabled() { + log.Infof(LogFormat, event, common.DeploymentResourceType, obj.Name, clusterName, "Client initiated processing started for "+globalIdentifier) depProcessErr := processClientDependencyRecord(ctx, remoteRegistry, globalIdentifier, clusterName, obj.Namespace) if depProcessErr != nil { return common.AppendError(err, depProcessErr) diff --git a/admiral/pkg/clusters/rollout_handler.go b/admiral/pkg/clusters/rollout_handler.go index be328e9aa..80b8bbf9c 100644 --- a/admiral/pkg/clusters/rollout_handler.go +++ b/admiral/pkg/clusters/rollout_handler.go @@ -72,6 +72,7 @@ func HandleEventForRollout(ctx context.Context, event admiral.EventType, obj *ar _, err := modifyServiceEntryForNewServiceOrPod(ctx, event, env, globalIdentifier, remoteRegistry) if common.ClientInitiatedProcessingEnabled() { + log.Infof(LogFormat, event, common.DeploymentResourceType, obj.Name, clusterName, "Client initiated processing started for "+globalIdentifier) rolloutProcessErr := processClientDependencyRecord(ctx, remoteRegistry, globalIdentifier, clusterName, obj.Namespace) if rolloutProcessErr != nil { return common.AppendError(err, rolloutProcessErr) diff --git a/admiral/pkg/clusters/util.go b/admiral/pkg/clusters/util.go index 931d6a38c..33f2828ce 100644 --- a/admiral/pkg/clusters/util.go +++ b/admiral/pkg/clusters/util.go @@ -351,12 +351,15 @@ func processClientDependencyRecord(ctx context.Context, remoteRegistry *RemoteRe var destinationsToBeProcessed []string destinationsToBeProcessed = getDestinationsToBeProcessedForClientInitiatedProcessing(remoteRegistry, globalIdentifier, clusterName, clientNs, destinationsToBeProcessed) - + log.Infof(LogFormat, "Update", common.DependencyResourceType, globalIdentifier, clusterName, fmt.Sprintf("destinationsToBeProcessed=%v", destinationsToBeProcessed)) var sourceClusterMap = common.NewMap() sourceClusterMap.Put(clusterName, clusterName) err := processDestinationsForSourceIdentity(ctx, remoteRegistry, "Update", true, sourceClusterMap, destinationsToBeProcessed, globalIdentifier, modifyServiceEntryForNewServiceOrPod) - return err + if err != nil { + return errors.New("failed to perform client initiated processing for " + globalIdentifier + ", got error: " + err.Error()) + } + return nil } func getDestinationsToBeProcessedForClientInitiatedProcessing(remoteRegistry *RemoteRegistry, globalIdentifier string, clusterName string, clientNs string, destinationsToBeProcessed []string) []string {