Merged
Conversation
6128858 to
5ead255
Compare
Previously, almost 70% of the SDK code size were created by k8s.io packages that the SDK doesn't need. These were linked into the SDK from the history package through the ConfigMap-backed store. To address this, this commit splits the ConfigMap- backed store with the k8s.io imports into a separate configmapstore package.
To align with the configmapstore package, we also split the AferoStore into a separate aferostore package. Then, since the package names now convey the information about the backing store, the store creation functions are renamed to just "New".
5ead255 to
8e60f8c
Compare
thomasten
reviewed
Mar 18, 2026
burgerdev
approved these changes
Mar 18, 2026
| "strings" | ||
| "time" | ||
|
|
||
| "github.com/edgelesssys/contrast/internal/history" |
Member
There was a problem hiding this comment.
There's still an inverse dependency here, but I can try to consolidate that later.
Member
Author
There was a problem hiding this comment.
This is from RecoverConfigMaps, which I'm not totally sure where to move to. Thanks!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The SDK previously caused quite large code to be generated. The following test program results in a 50MB binary, for example:
When analyzing the code with go-size-analyzer, it becomes apparent that most of the size stems from Kubernetes Go packages:
Note that this doesn't even include contributions of those packages to
.rodataand other sections for constants, strings, etc.@thomasten managed to trace this back to the
historypackage a while ago. This PR now addresses the bloat by splitting the subset ofhistorythat requires the Kubernetes imports, namely the ConfigMap-backed store, into a separate package. As Go links on package level, this is necessary to have it not be linked into the produced binaries. A separate commit then aligns the rest of the history package with those naming changes, extracting the other, Afero-backed store into a separate package. This change reduces the size of the test binary vom 50MB to 18MB, a reduction of almost 70%!See the commit messages for the individual technical details.