Skip to content

fix: Ensure configFile volume is mounted for initContainer#2713

Merged
simar7 merged 9 commits intoaquasecurity:mainfrom
bananasplit393:main
Aug 22, 2025
Merged

fix: Ensure configFile volume is mounted for initContainer#2713
simar7 merged 9 commits intoaquasecurity:mainfrom
bananasplit393:main

Conversation

@bananasplit393
Copy link
Copy Markdown
Contributor

Fixes #2711

This PR resolves a bug where the configFile feature is not properly implemented in the scan jobs created in Standalone mode.

Currently, the initContainer spec is defined before the GenerateConfigFileVolumeIfAvailable() function is called. As a result, the volume mount for the configFile is never added to the initContainer, preventing it from accessing any custom configuration.

This change moves the GenerateConfigFileVolumeIfAvailable() call to a position before the initContainers slice is defined. This ensures that the initContainer correctly receives the volume mount, making the configFile feature fully functional for all containers within the scan job pod.

Tests have been updated to mirror the code change.

@bananasplit393 bananasplit393 requested a review from simar7 as a code owner August 18, 2025 14:05
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Aug 18, 2025

CLA assistant check
All committers have signed the CLA.

@bananasplit393 bananasplit393 changed the title Fix: Ensure configFile volume is mounted for initContainer fix: Ensure configFile volume is mounted for initContainer Aug 18, 2025
@github-actions github-actions bot added the bug label Aug 18, 2025
trivy-operator Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do we really need this file?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No, we do not. I do not know how it got through... It is removed now, thank you.

@afdesk
Copy link
Copy Markdown
Contributor

afdesk commented Aug 22, 2025

@bananasplit393 thanks for your time and efforts
I left a comment to clarify the PR

@bananasplit393 bananasplit393 requested a review from afdesk August 22, 2025 07:47
@ReneDiff
Copy link
Copy Markdown
Contributor

@bananasplit393 thanks for your time and efforts I left a comment to clarify the PR

Hey, we just realized that our fork was 4 commits behind main, so we merged again - so we need a new review... 😅

@afdesk
Copy link
Copy Markdown
Contributor

afdesk commented Aug 22, 2025

thank you guys!

Copy link
Copy Markdown
Contributor

@afdesk afdesk left a comment

Choose a reason for hiding this comment

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

LGTM!
Trivy-operator based on this branch works correctly.
checked on docker.io/afdesk/trivy-operator:fixTrivyConfig

@simar7 simar7 merged commit e830a7b into aquasecurity:main Aug 22, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Operator self-scan job enters Error state after applying fix for configFile volume mount

5 participants