You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Auto Discovery failed to fetch Scan for removed pod with no scans made before. #2699
I deployed SCB Auto Discovery to kubernetes, annotated existing namespace with some pods in it. Then killed nginx pod and Auto Discovery service failed to fetch Scan and process another events.
Describe the bug
Secure Code Box auto discovery service tries to fetch ScheduledScan for pod with no scans made before.
Steps To Reproduce
Deploy auto-dicovery by instruction to namespace infra-securecodebox.
Annotate namespace that already has pods in it.
k annotate ns infra-securecodebox auto-discovery.securecodebox.io/enabled=true
k run -n infra-securecodebox --rm -it --image nginx:alpine3.17 nginx-test-scan --set config.containerAutoDiscovery.enabled=true
Expected behavior
Secure Code Box auto discovery service ignores deletion of pod with no scans.
changed the title [-]Auto Discovery failed to fetch ScheduledScans for removed pod with no scans made before.[/-][+]Auto Discovery failed to fetch Scan for removed pod with no scans made before.[/+]on Oct 8, 2024
Hi thanks for the report, yeah that shouldn't log out such a error 👍
Btw if I deploy container to the same namespace as auto-discovery service it won't work. Just no action when creating container
Did you annotate the namespace for the auto-discovery with the annotation?
When annotating a existing namespace with existing deployments it sometimes takes the auto-discovery a while to detect these services, this is a known problem unfortunatly. Haven't had the time yet to debug this fully. :/
I definitely annotated namespace, because service log warning about non-existent scan type during direst deployment. After that I created scan type. Also service sees when pod is deleted and logs warning about non-existent Scan for this container.
While addressing your issue, I've removed unnecessary logs related to the deletion of pods without scans. Additionally, I've slightly updated the documentation page for ContainerAutoDiscovery for improved clarity (Link).
Btw if I deploy container to the same namespace as auto-discovery service it won't work. Just no action when creating container
I wasn't able to reproduce it. If the issue remains after updating to the latest release, please let us know. In any case, thank you for your contribution so far!
But serviceDiscovery works in the same namespace, containerDiscovery - no. There are just no logs.
I've added logs to ContainerAutoDiscovery about tracking newly discovered unscanned pods and the deletion of orphaned trivy scans, so now it should be more transparent (Commit).
Activity
[-]Auto Discovery failed to fetch ScheduledScans for removed pod with no scans made before.[/-][+]Auto Discovery failed to fetch Scan for removed pod with no scans made before.[/+]paraddise commentedon Oct 8, 2024
I think it should be fixed here https://github.com/secureCodeBox/secureCodeBox/blob/main/auto-discovery/kubernetes/controllers/container_scan_controller.go#L422
Maybe we can ignore NotFound error
paraddise commentedon Oct 8, 2024
Oh, I see
getOrphanedScanImageIDsin case of error just returns empty array, so this must not affect other eventsparaddise commentedon Oct 8, 2024
Btw if I deploy container to the same namespace as auto-discovery service it won't work. Just no action when creating container
J12934 commentedon Oct 9, 2024
Hi thanks for the report, yeah that shouldn't log out such a error 👍
Did you annotate the namespace for the auto-discovery with the annotation?
When annotating a existing namespace with existing deployments it sometimes takes the auto-discovery a while to detect these services, this is a known problem unfortunatly. Haven't had the time yet to debug this fully. :/
paraddise commentedon Oct 9, 2024
I definitely annotated namespace, because service log warning about non-existent scan type during direst deployment. After that I created scan type. Also service sees when pod is deleted and logs warning about non-existent
Scanfor this container.paraddise commentedon Oct 9, 2024
But serviceDiscovery works in the same namespace, containerDiscovery - no. There are just no logs.
#2680 Handle missing ScheduledScan gracefully by auto-discovery
BorisShek commentedon Mar 23, 2025
Hi @paraddise,
While addressing your issue, I've removed unnecessary logs related to the deletion of pods without scans. Additionally, I've slightly updated the documentation page for ContainerAutoDiscovery for improved clarity (Link).
I wasn't able to reproduce it. If the issue remains after updating to the latest release, please let us know. In any case, thank you for your contribution so far!
I've added logs to ContainerAutoDiscovery about tracking newly discovered unscanned pods and the deletion of orphaned trivy scans, so now it should be more transparent (Commit).