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

Adding pod-template-hash label #167

Merged
merged 2 commits into from
Jan 1, 2024
Merged

Adding pod-template-hash label #167

merged 2 commits into from
Jan 1, 2024

Conversation

dwertent
Copy link

@dwertent dwertent commented Dec 31, 2023

Type

enhancement


Description

This PR introduces the following changes:

  • The pod-template-hash label is now retrieved from the pod in the getContainerInfo function.
  • The podTemplateHash attribute is added to the watchedContainer object in the ensureImageInfo function.
  • Error messages in the getContainerInfo function have been updated to include the podTemplateHash attribute.

PR changes walkthrough

Relevant files                                                                                                                                 
Enhancement
1 files
relevancy_manager.go                                                                               
    pkg/relevancymanager/v1/relevancy_manager.go

    The changes in this file involve adding a new attribute
    podTemplateHash to the getContainerInfo function. This
    function now retrieves the pod-template-hash label from
    the pod and returns it along with other container
    information. The podTemplateHash is also added to the
    watchedContainer object in the ensureImageInfo function.
    Error messages in the function have been updated to include
    this new attribute.

+19/-12

User description

Overview

Signed-off-by: David Wertenteil <dwertent@armosec.io>
@codiumai-pr-agent-free codiumai-pr-agent-free bot added the enhancement New feature or request label Dec 31, 2023
Copy link

PR Description updated to latest commit (c98e5d0)

Copy link

PR Analysis

  • 🎯 Main theme: Adding pod-template-hash label to getContainerInfo function
  • 📝 PR summary: This PR enhances the getContainerInfo function in relevancy_manager.go by adding a new attribute podTemplateHash. This attribute retrieves the pod-template-hash label from the pod. The podTemplateHash attribute is then added to the watchedContainer object in the ensureImageInfo function.
  • 📌 Type of PR: Enhancement
  • 🧪 Relevant tests added: No
  • ⏱️ Estimated effort to review [1-5]: 2, because the PR involves changes in a single file and the changes are straightforward, involving the addition of a new attribute and its usage.
  • 🔒 Security concerns: No security concerns found

PR Feedback

💡 General suggestions: The PR seems to be well implemented with clear and concise changes. However, it would be beneficial to include tests that verify the new functionality. This would ensure that the podTemplateHash is correctly retrieved and added to the watchedContainer object.

🤖 Code feedback:
relevant filepkg/relevancymanager/v1/relevancy_manager.go
suggestion      

Consider handling the error when retrieving the pod-template-hash label. Currently, the error is ignored which could lead to unexpected behavior if the label retrieval fails. [important]

relevant linepodTemplateHash, _ = pod.GetLabel("pod-template-hash")

relevant filepkg/relevancymanager/v1/relevancy_manager.go
suggestion      

It would be beneficial to add a check to ensure that podTemplateHash is not an empty string before assigning it to watchedContainer.TemplateHash. This would prevent potential issues if the pod-template-hash label is not found. [medium]

relevant linewatchedContainer.TemplateHash = podTemplateHash

✨ Usage tips:

To invoke the PR-Agent, add a comment using one of the following commands:

  • /review: Request a review of your Pull Request.
  • /describe: Update the PR title and description based on the contents of the PR.
  • /improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
  • /ask <QUESTION>: Ask a question about the PR.
  • /update_changelog: Update the changelog based on the PR's contents.
  • /add_docs 💎: Generate docstring for new components introduced in the PR.
  • /generate_labels 💎: Generate labels for the PR based on the PR's contents.
  • /analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

See the tools guide for more details.
To edit any configuration parameter from the configuration.toml, add --config_path=new_value.
For example: /review --pr_reviewer.extra_instructions="focus on the file: ..."
To list the possible configuration parameters, add a /config comment.

Copy link

Summary:

  • License scan: success
  • Credentials scan: success
  • Vulnerabilities scan: failure
  • Unit test: success
  • Go linting: success

Signed-off-by: David Wertenteil <dwertent@armosec.io>
@dwertent dwertent added the release Create release label Jan 1, 2024
@dwertent dwertent merged commit 0a0b76e into main Jan 1, 2024
4 checks passed
@dwertent dwertent deleted the temaplte-hash-lable branch January 1, 2024 17:32
Copy link

github-actions bot commented Jan 1, 2024

Summary:

  • License scan: success
  • Credentials scan: success
  • Vulnerabilities scan: failure
  • Unit test: success
  • Go linting: success

dwertent pushed a commit that referenced this pull request Jan 2, 2024
* support syft types

Signed-off-by: DanielGrunbergerCA <grunbagrunba@gmail.com>

* fix func call

Signed-off-by: DanielGrunbergerCA <grunbagrunba@gmail.com>

* init map

Signed-off-by: DanielGrunbergerCA <grunbagrunba@gmail.com>

* update go:

Signed-off-by: DanielGrunbergerCA <grunbagrunba@gmail.com>

* update go mod

Signed-off-by: David Wertenteil <dwertent@armosec.io>

* skip exec events with empty path

Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>

* ignore ebpf events with empty container name

Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>

* avoid race condition between container start and activity reporting

Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>

* remove secrets from obj

Signed-off-by: David Wertenteil <dwertent@armosec.io>

* Add TemplateHash label (#165)

* Add TemplateHash label

Signed-off-by: David Wertenteil <dwertent@armosec.io>

* fixed test

Signed-off-by: David Wertenteil <dwertent@armosec.io>

---------

Signed-off-by: David Wertenteil <dwertent@armosec.io>

* Bump k8s-interface to 155 (#166)

* bump k8s-interface to 155

Signed-off-by: David Wertenteil <dwertent@armosec.io>

* fixed name

Signed-off-by: David Wertenteil <dwertent@armosec.io>

---------

Signed-off-by: David Wertenteil <dwertent@armosec.io>

* Adding pod-template-hash label (#167)

* Adding pod-template-hash label

Signed-off-by: David Wertenteil <dwertent@armosec.io>

* bump k8-interface pkg

Signed-off-by: David Wertenteil <dwertent@armosec.io>

---------

Signed-off-by: David Wertenteil <dwertent@armosec.io>

* Call InstanceIDToSlug instead of GetSlug

Signed-off-by: David Wertenteil <dwertent@armosec.io>

* support syft types

Signed-off-by: DanielGrunbergerCA <grunbagrunba@gmail.com>

* fix func call

Signed-off-by: DanielGrunbergerCA <grunbagrunba@gmail.com>

* init map

Signed-off-by: DanielGrunbergerCA <grunbagrunba@gmail.com>

* update go:

Signed-off-by: DanielGrunbergerCA <grunbagrunba@gmail.com>

* update go mod

Signed-off-by: David Wertenteil <dwertent@armosec.io>

* remove secrets from obj

Signed-off-by: David Wertenteil <dwertent@armosec.io>

---------

Signed-off-by: DanielGrunbergerCA <grunbagrunba@gmail.com>
Signed-off-by: David Wertenteil <dwertent@armosec.io>
Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>
Co-authored-by: DanielGrunbergerCA <grunbagrunba@gmail.com>
Co-authored-by: Matthias Bertschy <matthias.bertschy@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request release Create release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant