mirror of
https://github.com/cloudnative-pg/plugin-barman-cloud.git
synced 2026-07-09 19:22:21 +02:00
Compare commits
2 Commits
d6f2dc9e69
...
dcc8ab8f51
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dcc8ab8f51 | ||
|
|
287750e854 |
@ -81,6 +81,8 @@ func (c *CatalogMaintenanceRunnable) Start(ctx context.Context) error {
|
||||
// cycle enforces the retention policies. On success, it returns the amount
|
||||
// of time to wait to the next check.
|
||||
func (c *CatalogMaintenanceRunnable) cycle(ctx context.Context) (time.Duration, error) {
|
||||
contextLogger := log.FromContext(ctx)
|
||||
|
||||
var cluster cnpgv1.Cluster
|
||||
var barmanObjectStore barmancloudv1.ObjectStore
|
||||
|
||||
@ -88,7 +90,25 @@ func (c *CatalogMaintenanceRunnable) cycle(ctx context.Context) (time.Duration,
|
||||
return 0, err
|
||||
}
|
||||
|
||||
enabledForBackups := false
|
||||
for _, plugin := range cluster.Spec.Plugins {
|
||||
if plugin.Name == metadata.PluginName && plugin.IsEnabled() {
|
||||
enabledForBackups = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !enabledForBackups {
|
||||
contextLogger.Debug("Skipping retention policy" +
|
||||
" because the plugin is not enabled for backups")
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
configuration := config.NewFromCluster(&cluster)
|
||||
if configuration == nil || len(configuration.BarmanObjectName) == 0 {
|
||||
return 0, fmt.Errorf("invalid configuration, missing barman object store reference")
|
||||
}
|
||||
|
||||
if err := c.Client.Get(ctx, configuration.GetBarmanObjectKey(), &barmanObjectStore); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user