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

Check initContainers if they have env vars from a configmap or a secret #388

Merged
merged 2 commits into from
Dec 9, 2024

Conversation

almilaneze
Copy link
Contributor

What this PR does / why we need it?

Configmaps and secrets which were used only to provide env vars from them to an initContainer were wrongly evaluated as not used as there was not validation for this use case. Removal of such a cm or secret will prevent the POD from starting successfully.

PR Checklist

  • This PR adds K8s exceptions (false positives)
  • This PR adds new code
  • This PR includes tests for new/existing code
  • This PR adds docs

GitHub Issue

Closes [#385 ]

Notes for your reviewers

@codecov-commenter
Copy link

codecov-commenter commented Dec 5, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 43.43%. Comparing base (050c06d) to head (1a2d93d).
Report is 1 commits behind head on main.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #388      +/-   ##
==========================================
+ Coverage   43.39%   43.43%   +0.03%     
==========================================
  Files          63       63              
  Lines        4019     4043      +24     
==========================================
+ Hits         1744     1756      +12     
- Misses       2029     2039      +10     
- Partials      246      248       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yonahd yonahd linked an issue Dec 5, 2024 that may be closed by this pull request
@almilaneze almilaneze force-pushed the bug385-initcont-cm-sec branch from 93affb4 to ab12334 Compare December 5, 2024 12:51
Copy link
Owner

@yonahd yonahd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. Minor comment

pkg/kor/configmaps_test.go Show resolved Hide resolved
pkg/kor/secrets_test.go Outdated Show resolved Hide resolved
@almilaneze almilaneze force-pushed the bug385-initcont-cm-sec branch from 751571f to 1a2d93d Compare December 9, 2024 13:36
Copy link
Owner

@yonahd yonahd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Thanks!

@yonahd yonahd merged commit 6d80b66 into yonahd:main Dec 9, 2024
1 check passed
@almilaneze almilaneze deleted the bug385-initcont-cm-sec branch December 9, 2024 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrongly marks a configmap as unused
3 participants