derailed / popeye

๐Ÿ‘€ A Kubernetes cluster resource sanitizer
https://popeyecli.io
Other
5.32k stars 286 forks source link

Populate container list to allow filtering #380

Open dbaudracco opened 1 week ago

dbaudracco commented 1 week ago

This PR fixes the exclusion of containers not working

Background

When using a spinach file like

---
popeye:
  excludes:
    linters:
      deployments:
        instances:
          - codes:
              - 106
            containers:
              - "rx:.*init.*"

I noticed that the relevant containers were not excluded:

ยท namespace/varnish.................................................................................๐Ÿ˜ฑ ๐Ÿณ init-varnish ๐Ÿ˜ฑ [POP-106] No resources requests/limits defined.

After some debugging it appears that this is because the container list is not populated for the appropriate resources: this PR addresses the issue

ยท namespace/varnish.................................................................................โœ…

Todo

dbaudracco commented 1 week ago

If I'm not wrong this supersedes https://github.com/derailed/popeye/pull/267, fixes https://github.com/derailed/popeye/issues/200 and https://github.com/derailed/popeye/issues/168