builder: fall back to defaultKeepStorage if keepStorage is unset for GC policy#49062
Conversation
…GC policy Signed-off-by: David Karlsson <[email protected]>
90ae132 to
b08ff81
Compare
|
cc @crazy-max @jsternberg in case this was intentional, and |
jsternberg
left a comment
There was a problem hiding this comment.
This looks correct to me.
|
Thanks! Yup looked good to me as well; just a quick sanity check in case I missed something, thanks!! |
|
That's not how this is supposed to work. DefaultKeepStorage and Rules and exclusive properties. If you set |
|
@tonistiigi the code before this PR would produce an obscure error if the field was left empty in the config (which was the case @dvdksn ran into), should it be required to set it to (for the latter case, we may need to look what type we currently use, as it may not be possible to distinguish "default" from "not set" - I'd have to double check that). |
|
Fixing the parse error is correct, but if the storage value is not set by the user, then it should be |
|
@tonistiigi how do you feel about making defaultKeepStorage the fallback though? I find it odd that the defaults are not used at all if you define a custom rule. What about this:
|
|
@tonis this PR looking like the correct logic? |
|
I am the wrong @tonis :)
N, 19. detsember 2024, 19:31 Sebastiaan van Stijn ***@***.***>
kirjutas:
… @tonis <https://github.com/tonis> this PR looking like the correct logic?
- #49147 <#49147>
—
Reply to this email directly, view it on GitHub
<#49062 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFSRB3M7BCXGUACW5ZDRJD2GL7GTAVCNFSM6AAAAABTNCX3DKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNJVGI4DOMJSGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
Oh! Sorry for that! I blame GitHub autocomplete 🙈🙈 (nice to meet you though!) |
|
@dvdksn I don't think this makes sense because even if you just set |
|
Yes that warning sounds like a good addition! |
- What I did
Builder GC policies without a
keepStorageoption set should fall back to using thedefaultKeepStoragevalue. But currently, the policy'skeepStorageis parsed unconditionally, meaning that if it's unset, an error occurs:The only way to get a policy to use
defaultKeepStoragelimit for GC would be to set it to"0".This patch is to make sure policy
keepStorageis conditionally parsed, if set, otherwise thedefaultKeepStorageis used.I also modified related error messages:
- How I did it
- How to verify it
Tested manually;
{ "builder": { "gc": { "enabled": true, "defaultKeepStorage": "10GB", "policy": [ { "filter": ["unused-for=2200h"] } ] } } }- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)