-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
buildkitd: allow multiple units for gc config #3773
Conversation
Would we also want something for durations? To do |
sgtm |
In addition to parsing the raw number of bytes, we can additionally supporting reading short notations from strings, such as "50MB", or "10GB". We can also support different percentages, such as "20%", which allows for consuming a maximum percentage of the disk easily (previously, only the default was set to 10%, with no ability to change to use an arbitrary percentage). Signed-off-by: Justin Chadwell <me@jedevc.com>
564c8bb
to
6fe8ffc
Compare
6fe8ffc
to
85ea36b
Compare
Signed-off-by: Justin Chadwell <me@jedevc.com>
85ea36b
to
e06c962
Compare
Can you update https://github.com/moby/buildkit/blob/master/docs/buildkitd.toml.md too? |
Done. I think we probably want to spend some time at some point updating the entire document, there's not a lot of consistency between the different documentation styles in the comments. |
Signed-off-by: Justin Chadwell <me@jedevc.com>
687ffa0
to
4cd5b7b
Compare
The ability to specify percentages is a great improvement. It will let us replace a percentage calculation in startup scripts. |
PTAL @tonistiigi |
var st syscall.Statfs_t | ||
if err := syscall.Statfs(root, &st); err != nil { | ||
return defaultCap | ||
} | ||
diskSize := int64(st.Bsize) * int64(st.Blocks) | ||
avail := diskSize / 10 | ||
avail := diskSize * d.Percentage / 100 | ||
return (avail/(1<<30) + 1) * 1e9 // round up |
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.
This "round up" still makes sense with user input?
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 so. It just rounds up to the closest gigabyte, which makes sense to me.
In addition to parsing the raw number of bytes, we can additionally supporting reading short notations from strings, such as "50MB", or "10GB". We can also support different percentages, such as "20%", which allows for consuming a maximum percentage of the disk easily (previously, only the default was set to 10%, with no ability to change to use an arbitrary percentage).