Skip to content

[dmt] collect mount files#418

Merged
ldmonster merged 1 commit into
mainfrom
fix/mount-points-files
Jul 8, 2026
Merged

[dmt] collect mount files#418
ldmonster merged 1 commit into
mainfrom
fix/mount-points-files

Conversation

@diyliv

@diyliv diyliv commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Parse files section in mount-points.yaml: the mount-points container rule only collected dirs, ignoring files entries.
  • Fix: added Files []string field to mountPointsFile struct and iterate over mpf.Files alongside mpf.Dirs in collectMountPointsDirs.
  • Test: added TestMountPointsContainerRule_FilesDeclared covering files section.
  • Affected files: pkg/linters/container/rules/mount_points.go, pkg/linters/container/rules/mount_points_test.go

Context

The mount-points rule requires every volumeMount.mountPath in Deployment/DaemonSet/StatefulSet to be declared in a mount-points.yaml. However, mount-points.yaml supports both dirs and files sections, but the linter only read dirs. This caused false positives for mount paths declared as files (e.g., /etc/app/config.yaml, /run/xtables.lock) — the linter warned they were "not declared" even though they were present in files.

Example

Before (false positive):

Container "main" mountPath "/run/xtables.lock" is not declared in any mount-points.yaml

Even though mount-points.yaml contains:

files:
  - /run/xtables.lock

After: no warning — file mount paths are recognized.

Signed-off-by: diyliv <onlogn081@gmail.com>
@diyliv diyliv self-assigned this Jul 8, 2026
@diyliv diyliv marked this pull request as draft July 8, 2026 08:49
@diyliv diyliv requested a review from ldmonster July 8, 2026 08:49
@diyliv diyliv added enhancement New feature or request go Pull requests that update go code labels Jul 8, 2026
@diyliv diyliv changed the title collect mount files [dmt] collect mount files Jul 8, 2026
@diyliv diyliv marked this pull request as ready for review July 8, 2026 09:27
@ldmonster ldmonster merged commit 6448f38 into main Jul 8, 2026
4 of 9 checks passed
@ldmonster ldmonster deleted the fix/mount-points-files branch July 8, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request go Pull requests that update go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants