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

use stored mount or device count for ignorevolumeless pods for node cleanup #141

Merged
merged 2 commits into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/containerscan/allowedlist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ general:
- CVE-2022-0778
- CVE-2022-2526
- CVE-2022-27664
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should CVE-2022-27664 be removed implementing the workaround found by the Yulan team?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes when we implement that

- CVE-2022-40674
# Disputed CVEs
- CVE-2019-1010022
- CVE-2022-26280
Expand Down
8 changes: 4 additions & 4 deletions internal/monitor/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,10 @@ func (pm *PodMonitorType) nodeModeCleanupPods(node *v1.Node) bool {

// Check containers to make sure they're not running. This uses the containerInfos map obtained above.
pod := podInfo.Pod
// Get the PVs associated with this pod.
pvlist, err := K8sAPI.GetPersistentVolumesInPod(ctx, pod)
if err == nil && IgnoreVolumelessPods && len(pvlist) == 0 {
log.Infof("IgnoreVolumelessPods %t pvc count %d", IgnoreVolumelessPods, len(pvlist))

// ignore volumeless pods if needed
if IgnoreVolumelessPods && len(podInfo.Mounts) == 0 && len(podInfo.Devices) == 0 {
log.Infof("IgnoreVolumelessPods %t mount %d device %d", IgnoreVolumelessPods, len(podInfo.Mounts), len(podInfo.Devices))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add the podkey to this log statement, similar to line 314 below. Otherwise good to go.

return true
}
for _, containerStatus := range pod.Status.ContainerStatuses {
Expand Down