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

fix: removing underscore from VulnerabilityReport names #287

Merged
merged 2 commits into from
Jun 6, 2024
Merged

Conversation

matheusfm
Copy link
Contributor

@matheusfm matheusfm commented Jun 5, 2024

Description

This PR fixes a bug in worker container when creating VulnerabilityReports for images named with underscore.

2024-06-05T20:06:48Z	ERROR	worker	failed to run worker	{"error": "failed to create VulnerabilityReport \"kind-kind-mfmoraesnginxx86_64latest-q758l\": VulnerabilityReport.zora.undistro.io \"kind-kind-mfmoraesnginxx86_64latest-q758l\" is invalid: metadata.name: Invalid value: \"kind-kind-mfmoraesnginxx86_64latest-q758l\": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')"}
main.main
	/workspace/cmd/worker/main.go:42
runtime.main
	/usr/local/go/src/runtime/proc.go:267

Linked Issues

UD-1516

How has this been tested?

  1. Create a cluster and run a pod with an image named with underscore:
kind create cluster
kubectl run nginx --image=mfmoraes/nginxx86_64:latest --image-pull-policy=IfNotPresent
  1. Install Zora and wait for the vulnerability scan.

  2. Check if a vulnerability report for mfmoraes/nginxx86_64:latest image is created.

kubectl get vulns -n zora-system | grep nginx
  1. We expect to see:
kind-kind-mfmoraesnginxx8664latest-6m7rk                               kind-kind   mfmoraes/nginxx86_64:latest                                   102     2          15     86s

Checklist

  • I have labeled this PR with the relevant Type labels
  • I have documented my code (if applicable)
  • My changes are covered by tests

@matheusfm matheusfm added the bug 🐛 Something isn't working label Jun 5, 2024
@matheusfm matheusfm requested a review from knrc June 5, 2024 20:39
@matheusfm matheusfm self-assigned this Jun 5, 2024
@matheusfm matheusfm merged commit 38efb24 into main Jun 6, 2024
4 checks passed
@matheusfm matheusfm deleted the UD-1516 branch June 6, 2024 11:49
@matheusfm matheusfm mentioned this pull request Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants