Skip to content

Commit

Permalink
MESH-000: Add detailed logging for client-initiated processing and gl… (
Browse files Browse the repository at this point in the history
#364)

…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 <[email protected]>
  • Loading branch information
Punakshi and Punakshi Chaand authored Dec 11, 2024
1 parent 61c8b71 commit 66980fe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions admiral/pkg/clusters/deployment_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions admiral/pkg/clusters/rollout_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 5 additions & 2 deletions admiral/pkg/clusters/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 66980fe

Please sign in to comment.