-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
make systemd and its dependencies optional via 'no_systemd' build tag (2nd take) #3959
base: main
Are you sure you want to change the base?
Conversation
45d2baa
to
70341b5
Compare
70341b5
to
93bc193
Compare
No idea how to fix the lint error - running gofumpt didn't seem to be sufficient. Maybe the problem is the vendor dir, which isn't at all gofumpt'ed. |
} | ||
|
||
func NewUnifiedManager(config *configs.Cgroup, path string) (cgroups.Manager, error) { | ||
return nil, errors.New("no lennartix") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the term used in this error message will be very confusing to the majority of users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
Overall LGTM, just a few minor issues:
The |
I was talking about utils_linux.go file. The (better, I guess) alternative to the above is to drop the |
51a3899
to
9167c11
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@opencontainers/runc-maintainers PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
- This will reduce the size of
runc
binary file by 700k+.
It is useful for my daily use, but I think upstream projects(containerd/docker/k8s) may not use this feature. - This PR will make the code more clear and readable.
9167c11
to
c1e8e1f
Compare
@metux Please use |
c7e2881
to
cb1899c
Compare
done |
Simplify the branching between systemd and pure cgroups. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Factor out all references to Lennartix-specific dbus property struct into some alias. That's helpful in making it possible to build it w/o any systemd dependencies (which would make the binary at least 10% smaller.) Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Factor out an init function specific to Lennartix platform, so subsequent patches can easily make building systemd support build-time optional. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Running under systemd requires lots of special code that contributes to ca. 10 percent (ca. 1 MB) to the binary size. This is only needed on targets that might run systemd - there're dozens of distros, let alone embedded/edge devices or special images (eg. cluster worker nodes) that do not and never will run systemd, thus do not need that code at all. It's not just about reducing memory consumption, but also having over 10.000 lines of code less to audit. In order not to change default behaviour, introducing an inverse build tag, 'no_systemd', for explicitly opting out from systemd special handlings. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Fix lint-extra err: Warning: var-naming: func addCpuQuota should be addCPUQuota (revive) Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
cb1899c
to
203096c
Compare
@metux needs a rebase. Guess we can merge it right after. |
@metux Are you still working on this PR? Please rebase, I think we can merge this one, and in the future release we can also provide a binary without |
If @metux can no longer work on this, perhaps I can carry this one. |
Hello folks,
this is my second take for making systemd stuff build-time optional. (obsoletes #2987)
It's been quite a while since the last time, and lots of things changed.
These patches first factors out systemd specific stuff in easily digestable steps, bevor adding the actual build flag.
Several functions are dummies on no_systemd flag (that shouldn't be actually called) for sake of simpler code flow.