Scan registry images before pods are deployed #464
Replies: 1 comment 6 replies
-
@xtreme-conor-nosal Thank you for starting this discussion. I think this is an interesting idea and some time back we actually tried implementing a similar POC. At that time we considered a CRD to represent a container registry with a subset of repositories. The main reason for that was to use Starboard as an admission controller that could reference existing VulnerabilityReports and reject workloads that use vulnerable images. We stepped back from this idea though with assumption that such use case is probably more suitable for container registry management service or a separate project. For example, Harbor registry with its pluggable vulnerability scanners or trivy-enforcer. Beyond that, Starboard associates a VulnerabiltyReport with a K8s workload to inherit the workload's life cycle. This way we could leverage K8s garbage collection, i.e. delete the VulnerabilityReports when a K8s workload is deleted or rescan the workload when the VulnerabiltiyReport is deleted. VulnerabilityReports are namespace-scoped resources in order to configure RBAC permissions at the same granularity as K8s workloads. With proposed ArtifactReference we'll have to specify what would be the lifecycle of such CRD and how it relates to built-in K8s resources such as Pods or ReplicaSets. We also consider the Starboard Operator with etcd storage as a runtime security toolkit. We do not store any data that's not pertinent to running K8s workloads Neither we store historical reports. Anyway we're happy to continue the discussion and see what others think about this approach. /cc @knqyf263 @jerbia @itaysk @amitbis |
Beta Was this translation helpful? Give feedback.
-
The starboard operator currently watches pods to trigger a scan. In some cases it's desirable to scan an artifact before the code is deployed and running.
A new
ArtifactReference
CRD could be defined:A new controller would then trigger a scan when a new ArtifactReference instance is created. The initial implementation could rely on the operator to update the CRD when a new image is in the registry.
The functionality could be extended to support polling the registry for new tags or digests if neither is specified. This may require a status field for the reconciler to capture what was scanned:
The implementation could largely reuse the logic of
VulnerabilityReportReconciler.reconcilePods
(read the artifact reference, check ownership, check for existing VulnerabilityReport/Job, check throttling, submit the scan). The usage ofcorev1.PodSpec
andContainerImages
may need to be abstracted as this flow would not have a Pod or a container name.Beta Was this translation helpful? Give feedback.
All reactions