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

Separate the API into its own module #2243

Open
Starttoaster opened this issue Aug 28, 2024 · 1 comment
Open

Separate the API into its own module #2243

Starttoaster opened this issue Aug 28, 2024 · 1 comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/stale Denotes an issue or PR has remained open with no activity and will be auto-closed.

Comments

@Starttoaster
Copy link
Contributor

Starttoaster commented Aug 28, 2024

Trivy Operator v0.21.2 introduced a ton of new indirect dependencies, which makes using github.com/aquasecurity/trivy-operator v0.21.2 as a Go module quite large. I have a project that utilizes the v1alpha1 API for making requests with client-go into the native Go types/structs. But I noticed that upon updating my module for trivy-operator, my binary size more than doubled. I then noticed my indirect dependencies added dozens of new entries, and downgraded to Trivy Operator v0.21.1, before all of these dependencies started getting pulled in. But realistically, I just need the API structs in a module with their deepcopy methods to make GET requests for those Kinds with client-go.

My project is located at https://github.com/starttoaster/trivy-operator-explorer for reference.

I believe tools like mine bring value to trivy-operator and its maintainers by making it easier for cluster maintainers to parse the custom resource reports trivy-operator generates, making it more likely people use your tools. In that way, I think it benefits you (as well as me of course) to have a separate go module for the API structs.

I understand that unused pieces of the trivy-operator package shouldn't end up getting linked by the Go compiler, but interestingly, the linker seems to be pulling in an additional 60MB of content from >v0.21.1 of trivy-operator even though I'm just using the API structs. I find it difficult to believe I'm actually using an additional 60MB of source code from just the API, so I'm not sure what else could be going on here, to be honest. But if you take a look at the diff of the pull request I linked, all those indirect dependencies are coming from the latest versions of trivy-operator, which is kind of crazy.

@Starttoaster Starttoaster added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 28, 2024
Copy link

This issue is stale because it has been labeled with inactivity.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and will be auto-closed. label Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/stale Denotes an issue or PR has remained open with no activity and will be auto-closed.
Projects
None yet
Development

No branches or pull requests

1 participant