Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to selects events from pods with specific labels #120

Closed
wants to merge 1 commit into from
Closed

Allow to selects events from pods with specific labels #120

wants to merge 1 commit into from

Conversation

ilpianista
Copy link

@ilpianista ilpianista commented Sep 1, 2023

PR Type:

Enhancement


PR Description:

This PR introduces a new feature that allows the node-agent to monitor only specific pods that match certain labels. This is achieved by adding a new configuration parameter that allows specifying these labels. The changes mainly affect the container watcher and the configuration files.


PR Main Files Walkthrough:

pkg/containerwatcher/v1/container_watcher.go: The changes in this file allow the container watcher to filter and select events from pods that match the specified labels. If the labels are specified in the configuration, they are used to create a container selector. This selector is then used when adding tracers for exec and open events.
pkg/config/config.go: A new field PodWatchLabels of type map[string]string is added to the Config struct. This field is used to store the labels that will be used to select the pods to monitor.
go.sum: The dependencies in the go.sum file are updated to include new packages that are used in the implementation of the new feature.
go.mod: The go.mod file is updated to include the new dependencies that are used in the implementation of the new feature.


User Description:

Overview

I would like to use node-agent only on some pod matching some specific labels. Thus, I've added a parameter which permits to specify those labels.

Checklist before requesting a review

put an [x] in the box to get it checked

  • My code follows the style guidelines of this project
  • I have commented on my code, particularly in hard-to-understand areas
  • I have performed a self-review of my code
  • If it is a core feature, I have added thorough tests.
  • New and existing unit tests pass locally with my changes

Please open the PR against the dev branch (Unless the PR contains only documentation changes)

There's no dev branch :-)

@codiumai-pr-agent-free codiumai-pr-agent-free bot added the enhancement New feature or request label Sep 1, 2023
@codiumai-pr-agent-free
Copy link

PR Analysis

  • 🎯 Main theme: Adding a feature to monitor specific pods that match certain labels.
  • 📝 PR summary: This PR introduces a new feature that allows the node-agent to monitor only specific pods that match certain labels. This is achieved by adding a new configuration parameter that allows specifying these labels. The changes mainly affect the container watcher and the configuration files.
  • 📌 Type of PR: Enhancement
  • 🧪 Relevant tests added: No
  • 🔒 Security concerns: No security concerns found

PR Feedback

  • 💡 General suggestions: The feature introduced in this PR is a valuable addition to the project. However, it would be beneficial to include tests that verify the correct functionality of this new feature. Additionally, it would be helpful to include error handling for the case where the specified labels do not match any pods.

  • 🤖 Code feedback:

    • relevant file: pkg/containerwatcher/v1/container_watcher.go
      suggestion: Consider adding error handling for the case where the specified labels do not match any pods. This will improve the robustness of the code. [important]
      relevant line: if len(ch.cfg.PodWatchLabels) > 0 {

    • relevant file: pkg/config/config.go
      suggestion: It would be beneficial to add validation for the new PodWatchLabels field in the Config struct. This will ensure that the labels are in the correct format before they are used to select pods. [medium]
      relevant line: PodWatchLabels map[string]string mapstructure:"podWatchLabels"

How to use

To invoke the PR-Agent, add a comment using one of the following commands:
/review [-i]: Request a review of your Pull Request. For an incremental review, which only considers changes since the last review, include the '-i' option.
/describe: Modify the PR title and description based on the contents of the PR.
/improve [--extended]: Suggest improvements to the code in the PR. Extended mode employs several calls, and provides a more thorough feedback.
/ask <QUESTION>: Pose a question about the PR.
/update_changelog: Update the changelog based on the PR's contents.

To edit any configuration parameter from configuration.toml, add --config_path=new_value
For example: /review --pr_reviewer.extra_instructions="focus on the file: ..."
To list the possible configuration parameters, use the /config command.

@ilpianista ilpianista closed this Oct 18, 2023
@ilpianista ilpianista deleted the feature/pod-watch-labels branch October 18, 2023 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant