mirror of
https://github.com/project-zot/zot.git
synced 2026-06-17 12:58:02 +08:00
feat: the default retention delay is not the GC delay (#3447)
Most users don't make the difference between retention deleting untagged manifests vs GC deleting other blobs. This causes confusion since the GC delay and the retention delay (used for untagged manifests and orphan referrers) have different defaults, and are set separately in the zot configuration. Most users don't configrue retention policies, and they still expect untagged manifests to be deleted at GC time. With this change, if retention delay is not specified in the config file, the value used is the GC delay. If GC delay is also unspecified in the config file, the default GC delay is used for both. Signed-off-by: Andrei Aaron <andreifdaaron@gmail.com>
This commit is contained in:
@@ -724,6 +724,10 @@ func applyDefaultValues(config *config.Config, viperInstance *viper.Viper, logge
|
||||
if viperInstance.Get("storage::gcinterval") == nil {
|
||||
config.Storage.GCInterval = 0
|
||||
}
|
||||
} else if !viperInstance.IsSet("storage::retention::delay") {
|
||||
// if GC is enabled, retentionDelay is set to gcDelay by default
|
||||
// it could be default gcDelay or the custom value set in the config file
|
||||
config.Storage.Retention.Delay = config.Storage.GCDelay
|
||||
}
|
||||
|
||||
// apply deleteUntagged default
|
||||
@@ -802,7 +806,9 @@ func applyDefaultValues(config *config.Config, viperInstance *viper.Viper, logge
|
||||
|
||||
// and retentionDelay is not set, it is set to default value
|
||||
if !viperInstance.IsSet("storage::subpaths::" + name + "::retention::delay") {
|
||||
storageConfig.Retention.Delay = storageConstants.DefaultRetentionDelay
|
||||
// retentionDelay is set to gcDelay by default
|
||||
// it could be default gcDelay or the custom value set in the config file
|
||||
storageConfig.Retention.Delay = storageConfig.GCDelay
|
||||
}
|
||||
|
||||
// and gcInterval is not set, it is set to default value
|
||||
|
||||
Reference in New Issue
Block a user