Reduce excessive WARN logs for forbidden resource access #4356
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Optimized the PodOwnerCache logic to minimize WARN-level logs caused by forbidden access errors.
This improves log clarity by preventing unnecessary noise when the spiderpool-agent lacks permissions to access certain resources (e.g., redisfailovers in
databases.spotahome.com
).Previously, errors.IsForbidden was checking the wrapped err, which led to unexpected results. The IsForbidden check has now been moved to the correct position to ensure accurate logic.
优化了 PodOwnerCache 逻辑,以最大限度地减少由 权限不足(spiderpool 用了最小权限,来收集 AI workload pod owner) 错误导致的警告级别日志(PodOwnerCache 用来缓存 pod owner 信息)。
当 spiderpool-agent 缺乏访问某些资源的权限时(例如,
databases.spotahome.com
中的 redisfailovers ),这通过防止不必要的干扰来提高日志的清晰度。原先 errors.IsForbidden 判断的是经过封装后的 err,导致结果不符合预期。现已将 IsForbidden 判断移动到正确的位置,确保逻辑准确。