Improve logging and fix status patch issue - #47
Conversation
There was a problem hiding this comment.
Pull request overview
This PR reduces log noise during CloudProfile reconciliation and addresses a status patch failure mode by ensuring overly long metav1.Condition.Message values are truncated to Kubernetes’ maximum length.
Changes:
- Lowered verbosity of per-update reconciliation logs to
V(1)in the CloudProfile controller. - Truncated the “apply failed” condition message to avoid exceeding Kubernetes’
Condition.Messagelength limit. - Removed a verbose log when skipping USI image variants in the Glance source.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
controllers/cloud_profile.go |
Reduces reconcile log verbosity and truncates condition messages to prevent status patch failures. |
cloudprofilesync/ossync/source/glance/os_source.go |
Removes a verbose skip log when filtering USI image variants during version parsing. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
5503492 to
c7b6cdc
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Suppressed comments (1)
controllers/cloud_profile.go:266
- truncateConditionMessage slices the string at an arbitrary byte offset. If the message contains multi-byte UTF-8 characters, this can split a rune and produce invalid UTF-8; Go’s JSON encoding will replace invalid sequences, which can also change the final byte length and potentially re-trigger the original status-patch validation error.
Consider truncating on a UTF-8 rune boundary while still enforcing the byte limit.
return msg
}
const suffix = "...[truncated]"
return msg[:maxConditionMessageLen-len(suffix)] + suffix
}
c7b6cdc to
32ed6fd
Compare
32ed6fd to
9c373cd
Compare
|
@coderabbitai review |
Merging this branch will decrease overall coverage
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. Changed unit test files
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
controllers/cloud_profile.go:266
truncateConditionMessageslices the string by byte length. If the message contains non-ASCII characters, this can cut in the middle of a multi-byte UTF-8 rune and produce an invalid UTF-8 string, which can be rejected by the API server (or cause confusing output). Truncate at a rune boundary while still enforcing the byte limit.
const suffix = "...[truncated]"
return msg[:maxConditionMessageLen-len(suffix)] + suffix
}
No description provided.