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

[FEATURE] Allow include/exclude of Labels that should be converted to Tags as a regular expression #526

Open
fbuchmeier-abi opened this issue Nov 22, 2023 · 3 comments
Labels
help wanted Denotes an issue that needs help from a contributor. kind/feature Categorizes issue or PR as related to a new feature.

Comments

@fbuchmeier-abi
Copy link

fbuchmeier-abi commented Nov 22, 2023

Greetings!

Background

we are happily using the sbom-operator with DependencyTrack in multiple Kubernetes (Kops & EKS) clusters. We want to scan as much workloads as possible so we keep our label selectors for the sbom-operator quite lose.

As of recently, we have noticed that our DependencyTrack instance was running quite slow and the connected database had a very high and constant CPU usage.

After investigating, we found that the number of tags in the corresponding table TAGS in DependencyTrack has grown to about 480 000 entries. As queries related to this table amount to almost all our CPU usage, we've analysed the content further and found that 2/3 of tags stored are controller-uid=SOME_UUI and the rest is mostly job-name=SOME_KUBERNETES_JOB_NAME. In our opinion, those two labels are created by several CronJobs we have running in our clusters. Each time a CronJob is triggered, it will create a new job (job-name) and a new pod. This pod will then inherit both the job-name label as well as the controller-uid from the new job.

Since we want to know which images and dependencies are using in our CronJob, we want to keep scanning them if possible.

Suggestion

The sbom-operator currently appends all labels of a given pod to the tags of the project in DependencyTrack, as can be seen here: https://github.com/ckotzbauer/sbom-operator/blob/main/internal/target/dtrack/dtrack_target.go#L153

Our suggestion would be to add a new configuration that allows filtering of labels that get transformed to tags.

  • label-filter (regular expression) - Allows filtering of labels that get converted to tags in the target system (e.g. DependencyTrack). This can be used to include only required labels or exclude noisy labels like controller-uid on pods created by CronJobs. To exclude controller-uid as well as job-name, set the filter to: (?i:(controller-uid|job-name))

Implementation

If desired, we can create a Pull Request that implements this feature, otherwise we can also support in testing or reviewing it.

Thank you for your support and have a great day,
Florian.

@fbuchmeier-abi fbuchmeier-abi changed the title [FEATURE] Allow include/exclude for Labels that should be converted to Tags as a regular expression [FEATURE] Allow include/exclude of Labels that should be converted to Tags as a regular expression Nov 22, 2023
@ckotzbauer
Copy link
Owner

Thanks for your suggestion. This sounds good, I would be happy if you can create a PR for that!

@ckotzbauer ckotzbauer added the kind/feature Categorizes issue or PR as related to a new feature. label Dec 3, 2023
@ckotzbauer ckotzbauer added the help wanted Denotes an issue that needs help from a contributor. label Dec 12, 2023
Copy link

This issue is stale because it has been open 90 days with no activity. Remove stale label with /remove-lifecycle stale or comment or this will be closed in 5 days.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 12, 2024
@ckotzbauer ckotzbauer removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 14, 2024
Copy link

This issue is stale because it has been open 90 days with no activity. Remove stale label with /remove-lifecycle stale or comment or this will be closed in 5 days.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 13, 2024
@ckotzbauer ckotzbauer removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

2 participants