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

SBOM Volume Fails to create due object name character limit #2253

Open
Hacks4Snacks opened this issue Sep 6, 2024 · 0 comments
Open

SBOM Volume Fails to create due object name character limit #2253

Hacks4Snacks opened this issue Sep 6, 2024 · 0 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@Hacks4Snacks
Copy link
Contributor

What steps did you take and what happened:

When kubernetes objects to be scanned have long names, scan jobs will fail when SBOM creation is enabled due to object name character lengths. The SBOM volume name adds a prefix of "sbomvol-" and does not account for the length of the cname object, leading cases where the volume name can exceed 63 characters.

What did you expect to happen:

Truncation of object names within defined limits to prevent object creation failures leading to scan job issue.

Anything else you would like to add:

Log Example:

{"level":"error","ts":"2024-09-06T18:46:57Z","msg":"Reconciler error","controller":"job","controllerGroup":"batch","controllerKind":"Job","Job":{"name":"3813e146-da61-4481-ad6f-1b0f035c0be5-action-bmmrunreadcmd","namespace":"nc-system"},"namespace":"nc-system","name":"3813e146-da61-4481-ad6f-1b0f035c0be5-action-bmmrunreadcmd","reconcileID":"d6629cac-e98d-46a9-817a-946e39289392","error":"creating scan job failed: test-system/scan-vulnerabilityreport-796d577555: Job.batch "scan-vulnerabilityreport-796d577555" is invalid: [spec.template.spec.volumes[2].name: Invalid value: "sbomvol-3813e146-da61-4481-ad6f-1b0f035c0be5-action-testreadcmd": must be no more than 63 characters, spec.template.spec.containers[0].volumeMounts[2].name: Not found: "sbomvol-3813e146-da61-4481-ad6f-1b0f035c0be5-action-bmmrunreadcmd"]","stacktrace":"sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\t/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:324\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:261\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\t/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:222"}

Environment:

  • Trivy-Operator version (use trivy-operator version): v0.22.0
  • Kubernetes version (use kubectl version): v1.29.7
  • OS (macOS 10.15, Windows 10, Ubuntu 19.10 etc): Azure Linux 2
@Hacks4Snacks Hacks4Snacks added the kind/bug Categorizes issue or PR as related to a bug. label Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant