Skip to content

Conversation

Copy link
Contributor

Copilot AI commented May 27, 2025

This PR adds event recording to the trafficManagerBackend controller, following the same pattern used in the trafficmanagerprofile controller. Events are now emitted for important state changes and operations:

Added events for:

  • Successfully configuring endpoints in Azure Traffic Manager
  • Removing all endpoints due to zero weight setting
  • Deletion of Azure Traffic Manager endpoints
  • Various error conditions (profile not found, service import not found, API failures)

Implementation details:

  • Added constants for event reasons (backendEventReasonAccepted, backendEventReasonDeleted, backendEventReasonAzureAPIError)
  • Added ControllerName constant for use in event recording
  • Added EventRecorder field to the Reconciler struct
  • Initialized EventRecorder in main.go
  • Added event recording in key functions:
    • handleDelete
    • handleUpdate
    • validateTrafficManagerProfile
    • validateAzureTrafficManagerProfile
    • validateServiceImportAndCleanupEndpointsIfInvalid
  • Added validation helpers for testing events in integration tests

These events will help users and operators understand the status and lifecycle of the trafficManagerBackend resources and troubleshoot issues when they occur.

Fixes #306.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cdn.fwupd.org
    • Triggering command: /usr/bin/fwupdmgr refresh (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] add events to the trafficManagerBackend controller Add events to the trafficManagerBackend controller May 27, 2025
Copilot AI requested a review from zhiying-lin May 27, 2025 02:18
@codecov
Copy link

codecov bot commented May 27, 2025

Codecov Report

Attention: Patch coverage is 72.72727% with 3 lines in your changes missing coverage. Please review.

Project coverage is 80.48%. Comparing base (af25d4f) to head (50a233b).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...ontrollers/hub/trafficmanagerbackend/controller.go 72.72% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #312      +/-   ##
==========================================
+ Coverage   80.30%   80.48%   +0.17%     
==========================================
  Files          29       29              
  Lines        4108     4161      +53     
==========================================
+ Hits         3299     3349      +50     
- Misses        643      647       +4     
+ Partials      166      165       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@zhiying-lin zhiying-lin changed the title Add events to the trafficManagerBackend controller feat: add events to the trafficManagerBackend controller May 27, 2025
@zhiying-lin zhiying-lin marked this pull request as ready for review May 28, 2025 13:05
@zhiying-lin zhiying-lin merged commit 926b788 into main May 30, 2025
9 of 10 checks passed
@zhiying-lin zhiying-lin deleted the copilot/fix-306-2 branch May 30, 2025 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add events to the trafficManagerBackend controller

3 participants