Skip to content

Scanner configuration is cluster-wide, so a mixed-OS cluster cannot use a different scanner per node OS #1288

Description

@charleswool

Problem

Eraser configures a single scanner for the whole cluster:

components:
  scanner:
    enabled: true
    image:
      repo: ghcr.io/eraser-dev/eraser-trivy-scanner
      tag: v1.5.0-beta.1
    request: { mem: 500Mi, cpu: 1000m }
    limit:   { mem: 2Gi }
    config: |
      cacheDir: /var/lib/trivy
      ...

On a mixed-OS cluster the appropriate scanner differs by node OS. Today there is
no way to express that: image, config, request and limit are all
cluster-wide.

This became concrete with the Windows support in v1.5.0-beta.1. trivy-scanner
publishes no windows/amd64 layer, so on a mixed cluster you must either run no
scanner at all, or replace trivy everywhere with something that also works on
Windows.

Why the obvious workarounds don't hold up

Multi-platform image. Because the scanner is a single reference, a
Windows-only image is also scheduled onto Linux nodes, where containerd fails it
with parent snapshot ... does not exist. So a Windows scanner image must be
multi-platform.

One index, two implementations. An OCI index can hold unrelated images per
platform, so crane index append -m <trivy-linux> -m <other-windows> -t combined
does work today. But:

  • config is one blob shared by both scanners, so it has to carry both schemas
    and rely on each ignoring the other's keys.
  • request/limit are shared, so a Windows scanner inherits trivy's 1000m/2Gi
    envelope whether or not it needs it.
  • provenance is opaque: one tag, two unrelated projects, indistinguishable from
    the reference.

That's serviceable for a demo and poor for anything shipped.

Proposal

Allow the scanner component to be configured per node OS, defaulting to today's
behaviour when no override is present. Shape is yours to choose; one option:

components:
  scanner:
    enabled: true
    image: { repo: ghcr.io/eraser-dev/eraser-trivy-scanner, tag: v1.5.0-beta.1 }
    request: { mem: 500Mi, cpu: 1000m }
    windows:
      image: { repo: example.azurecr.io/my-windows-scanner, tag: v1 }
      request: { mem: 64Mi, cpu: 50m }
      config: |
        ...

The same argument applies in principle to collector and remover, though
those ship multi-platform images built from one source, so the need is far less
pressing.

Related

Context

Raised while validating the Windows pipeline for the AKS Image Cleaner addon,
where the intended configuration is trivy on Linux nodes and a different scanner
on Windows nodes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions