Repository navigation
Option to configure proxy cache TTL - #3238
manishtomar wants to merge 1 commit into
Conversation
Currently when registry is run as proxy it tries to cleanup unused blobs from its cache after 7 days which is hard-coded. This PR makes that value configurable. One can disable caching using this option. This allows one to temporarily mitigate distribution#2367 bug. Signed-off-by: Manish Tomar <[email protected]>
d689ee6 to
7937651
Compare
|
With recent TOS change from Docker a lot more people may run this project as a mirror and bug #2367 is a blocker in using it as mirror. |
| | `remoteurl`| yes | The URL for the repository on Docker Hub. | | ||
| | `username` | no | The username registered with Docker Hub which has access to the repository. | | ||
| | `password` | no | The password used to authenticate to Docker Hub using the username specified in `username`. | | ||
| | `ttl` | no | Expire proxy cache configured in "storage" after this time. Cache expiration is disabled if not provided. | |
There was a problem hiding this comment.
Should we keep the default same as the current value? (7 days)? I that case, possibly use some special value for disabling
There was a problem hiding this comment.
In this PR implementation, if no config is specified there is no expiration. I like this approach as it forces explicit intent by the operator, rather than hiding some opaque behaviour. As long as the behaviour is documented and we no longer pick arbitrary values I'm happy with this.
There was a problem hiding this comment.
One thing to note is that operators who might be used to seeing reduced space will see it growing unbounded after this PR is deployed. Considering most of the operators would've encountered this bug after 7 days I think its fine to have this backward incompatible change.
There was a problem hiding this comment.
If no default value set here, does it impact the upgrade scenario? The default expiration setting will change to none? We probably should document this change. @milosgajdos
There was a problem hiding this comment.
So this entry is used for generating the docs, actually. How we notify/warn users about this change is a whole another question. But I can see this turning a bit tricky. I had a read through related issues here and here and it seems that people either:
- Don't set
STORAGE_CACHE_BLOBDESCRIPTORwhen local file store is used - Build a custom image and set expiry
TTLto a very large number which essentially means cache indefinitely
There was a problem hiding this comment.
Anyone that's not happy with that can override it, and we could use a value of -1 to disable it.
Curious if we could make the type for the TTL a pointer instead, we should be able to tell 0 from not configured with a nil check then and not have to have special values.
There was a problem hiding this comment.
Since the default behavior is effectively broken (in a way that is difficult to debug) I feel changing the default behavior is the right thing to do. By keeping it same, we will still be making operators life difficult by silently failing to pull images after 7 days. Currently everyone who encounters the bug has to rebuild the code with high TTL and deploy it. The only thing this PR will do is avoid rebuilding from source. They will still have to face the error, google it and disable TTL to use it. Considering that the end state is always disabling TTL to make the system work why not make it default? FWIW while it seems bad to make backward-incompatible operator changes we've historically done that in the past with minor version upgrades. That is not a justification to make another one but seems justifiable in this case.
There was a problem hiding this comment.
Thanks, @manishtomar o/ I think we all agree here re: the default behavior being broken and our having to change it. The "issue" is not so much the change of the current behavior on main branch, which no one would object to going forward, but rather that we'd like to propagate this change into the next 2.7.x patch release and would like to avoid changing the existing behavior, rather than tracking another patch. Would you consider changing this PR to what @SteveLasker suggests in his comment ?
| "github.com/opencontainers/go-digest" | ||
| ) | ||
|
|
||
| // todo(richardscothern): from cache control header or config |
There was a problem hiding this comment.
I see the original todo mentioned respecting cache-control headers; that still something we want to add at some point?
There was a problem hiding this comment.
The TODO comment actually says: "...instead of hardcoding an arbitrary chosen constant here, we could either pick it from cache headers or we can make move it to config". Given this PR moves the TTL value to config, I think this comment no longer applies.
|
@dmcgowan ptal |
|
Any updates on this? |
| "github.com/opencontainers/go-digest" | ||
| ) | ||
|
|
||
| // todo(richardscothern): from cache control header or config |
There was a problem hiding this comment.
The TODO comment actually says: "...instead of hardcoding an arbitrary chosen constant here, we could either pick it from cache headers or we can make move it to config". Given this PR moves the TTL value to config, I think this comment no longer applies.
| | `remoteurl`| yes | The URL for the repository on Docker Hub. | | ||
| | `username` | no | The username registered with Docker Hub which has access to the repository. | | ||
| | `password` | no | The password used to authenticate to Docker Hub using the username specified in `username`. | | ||
| | `ttl` | no | Expire proxy cache configured in "storage" after this time. Cache expiration is disabled if not provided. | |
There was a problem hiding this comment.
In this PR implementation, if no config is specified there is no expiration. I like this approach as it forces explicit intent by the operator, rather than hiding some opaque behaviour. As long as the behaviour is documented and we no longer pick arbitrary values I'm happy with this.
| | `remoteurl`| yes | The URL for the repository on Docker Hub. | | ||
| | `username` | no | The username registered with Docker Hub which has access to the repository. | | ||
| | `password` | no | The password used to authenticate to Docker Hub using the username specified in `username`. | | ||
| | `ttl` | no | Expire proxy cache configured in "storage" after this time. Cache expiration is disabled if not provided. | |
There was a problem hiding this comment.
If no default value set here, does it impact the upgrade scenario? The default expiration setting will change to none? We probably should document this change. @milosgajdos
|
Can we make the default consistent with previous behavior in 2.7 (7-days), and have an option to change the behavior in 2.7 through config? Then, in 3.0, we can change the default. |
|
we also experiencing this somehow... it is not very frequent, it takes place maybe a couple times a week in a large fleet.. but when it happens it requires a restart of the pod. Since it seems to have backwards compatibility, what are we needing to move this forward ? |
|
There is something that I don't get. So, it seems there's a TTL set to 7 days by default that you want to make configurable. Am I missing something here ? What's the point of all this ? Thanks |
|
Really want to know what is missing in the PR before it can be merged. |
|
The problem is Existed for too long and maintainers seems like is not care about it. I'm working on this feature of ttl blobs and I will release it in liangyuanpeng/distribution. welcom everyone to work for it together. The feature will be like this:
Absolutely, it's great if some maintainers is really work for it. |
|
Heym @liangyuanpeng
This is fundamentally wrong conclusion. Maintainers DO care about this problem (see the discussion we had with the author of this PR), we just don't want to be breaking the existing behaviour for users. We've asked the author of the original PR to make some adjustments. If you create a PR that addresses the points we've raised in the discussion we'll be more than happy to review it and merge it into upstream. |
|
@milosgajdos Thanks for your reply and happy for my stupid conclusion. I would like to push this PR. |
|
I want to move forward with this PR, based on which I have made sure of compatibility, please take a look #3880. |
|
Closing, addressed in #3880 |
Currently when registry is run as proxy it tries to cleanup unused blobs from its cache after 7 days which is hard-coded. This PR makes that value configurable. One can disable caching using this option. This allows one to temporarily mitigate
#2367 bug.