Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes two issues related to intent processing and pod identification: (1) adds command regex filtering to ensure only processes matching the intent's CommandRegex are scheduled, and (2) improves the pod UID regex pattern to correctly handle both systemd (underscore) and cgroupfs (dash) formats with strict UUID structure validation.
Changes:
- Added command regex filtering in ProcessIntents to match processes against intent CommandRegex before creating scheduling intents
- Updated podRegex pattern from a loose pattern to strict UUID format validation supporting both underscore and dash separators
| if process.Command == pauseCommand { | ||
| continue | ||
| } | ||
| if !regexp.MustCompile(intent.CommandRegex).MatchString(process.Command) { |
There was a problem hiding this comment.
The regex is being compiled on every iteration of the process loop. This is inefficient and can cause performance issues when processing pods with many processes. Consider compiling the regex once outside the loop or caching compiled regex patterns.
| if !regexp.MustCompile(intent.CommandRegex).MatchString(process.Command) { | ||
| continue | ||
| } |
There was a problem hiding this comment.
The new command regex filtering logic lacks test coverage. The ProcessIntents function now filters processes based on CommandRegex, but there are no tests verifying this behavior. Consider adding tests that verify processes are correctly filtered based on the regex pattern, including edge cases like invalid regex patterns or partial matches.
No description provided.