chore: add resource context to status error messages and logs#2735
chore: add resource context to status error messages and logs#2735BigOrangeQWQ wants to merge 4 commits intoapache:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves troubleshooting for APISIX sync failures by enriching status condition messages and some error logs with Kubernetes resource context (kind/namespace/name), making it easier to correlate a failure back to the originating object.
Changes:
- Add a helper to append
(resource: Kind/namespace/name)to sync failure error messages when resource labels are available. - Update status failure handling to use the enriched message for both “empty” and “detailed” failure paths.
- Add unit tests for the message builder and status update map keying behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| internal/provider/apisix/status.go | Builds enriched error messages with resource context and adds more context to failure logs during status updates. |
| internal/provider/apisix/status_test.go | Adds unit tests covering the new error-message formatting helper and status map updates. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The test failure occurred in tlsroute.go. This appears to be a pre-existing bug unrelated to the changes in this PR. It looks like this issue might be related to the changes in this PR. I might have misjudged earlier. I'm investigating it now. |
Type of change:
What this PR does / why we need it:
Fixes #2714
When APISIX sync fails, the error messages in resource status lack resource context (kind/namespace/name), making it difficult to quickly identify which resource caused the problem.
This PR enriches error messages and logs with resource information to make troubleshooting easier.
Before:
After:
Pre-submission checklist: